Skip to content

Commit

Permalink
Add 0.00000000001 to "ambit radius squared" calculations to account f… (
Browse files Browse the repository at this point in the history
  • Loading branch information
SamsTheNerd authored Nov 5, 2024
2 parents d5920c9 + 3f6b70e commit 77f5cfe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public boolean isVecInRangeEnvironment(Vec3 vec) {
if (sentinel != null
&& sentinel.extendsRange()
&& caster.level().dimension() == sentinel.dimension()
&& vec.distanceToSqr(sentinel.position()) <= SENTINEL_RADIUS * SENTINEL_RADIUS
&& vec.distanceToSqr(sentinel.position()) <= SENTINEL_RADIUS * SENTINEL_RADIUS + 0.00000000001
) {
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,13 @@ public boolean isVecInRangeEnvironment(Vec3 vec) {
if (sentinel != null
&& sentinel.extendsRange()
&& this.caster.level().dimension() == sentinel.dimension()
&& vec.distanceToSqr(sentinel.position()) <= SENTINEL_RADIUS * SENTINEL_RADIUS
// adding 0.00000000001 to avoid machine precision errors at specific angles
&& vec.distanceToSqr(sentinel.position()) <= SENTINEL_RADIUS * SENTINEL_RADIUS + 0.00000000001
) {
return true;
}

return vec.distanceToSqr(this.caster.position()) <= AMBIT_RADIUS * AMBIT_RADIUS;
return vec.distanceToSqr(this.caster.position()) <= AMBIT_RADIUS * AMBIT_RADIUS + 0.00000000001;
}

@Override
Expand Down

0 comments on commit 77f5cfe

Please sign in to comment.