mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 19:46:42 +01:00
Fixed issues with distance calculation
This commit is contained in:
parent
0af0cb2182
commit
296d6dc255
1 changed files with 2 additions and 2 deletions
|
@ -60,8 +60,8 @@ public interface VecHelper {
|
||||||
|
|
||||||
static Stream<Entity> findAllEntitiesInRange(@Nullable Entity origin, World w, BlockPos pos, double radius) {
|
static Stream<Entity> findAllEntitiesInRange(@Nullable Entity origin, World w, BlockPos pos, double radius) {
|
||||||
return w.getEntities(origin, new Box(pos).expand(radius), e -> {
|
return w.getEntities(origin, new Box(pos).expand(radius), e -> {
|
||||||
double dist = e.squaredDistanceTo(pos.getX(), pos.getY(), pos.getZ());
|
double dist = Math.sqrt(e.squaredDistanceTo(pos.getX(), pos.getY(), pos.getZ()));
|
||||||
double dist2 = e.squaredDistanceTo(pos.getX(), pos.getY() - e.getStandingEyeHeight(), pos.getZ());
|
double dist2 = Math.sqrt(e.squaredDistanceTo(pos.getX(), pos.getY() - e.getStandingEyeHeight(), pos.getZ()));
|
||||||
|
|
||||||
return dist <= radius || dist2 <= radius;
|
return dist <= radius || dist2 <= radius;
|
||||||
}).stream();
|
}).stream();
|
||||||
|
|
Loading…
Reference in a new issue