|
@@ -49,10 +49,26 @@ public class Utils {
|
|
|
double sqareRadius = radius * radius;
|
|
|
return w.getWorld().getEntitiesWithinAABB(type, buildBoxAround(x, y, z, radius), ent -> ent.getDistanceSq(x, y, z) <= sqareRadius);
|
|
|
}
|
|
|
+
|
|
|
+ public static List<Entity> getEntities(Entity ent, double radius) {
|
|
|
+ double sqareRadius = radius * radius;
|
|
|
+ double x = ent.getPosX();
|
|
|
+ double y = ent.getPosY();
|
|
|
+ double z = ent.getPosZ();
|
|
|
+ return ent.world.getEntitiesInAABBexcluding(ent, buildBoxAround(x, y, z, radius), e -> e.getDistanceSq(x, y, z) <= sqareRadius);
|
|
|
+ }
|
|
|
+
|
|
|
+ public static List<Entity> getEntities(Location loc, double radius) {
|
|
|
+ double sqareRadius = radius * radius;
|
|
|
+ double x = loc.getX();
|
|
|
+ double y = loc.getY();
|
|
|
+ double z = loc.getZ();
|
|
|
+ return loc.getWorld().getEntitiesInAABBexcluding(null, buildBoxAround(x, y, z, radius), ent -> ent.getDistanceSq(x, y, z) <= sqareRadius);
|
|
|
+ }
|
|
|
|
|
|
public static List<PlayerEntity> getPlayers(IWorld w, double x, double y, double z, double radius) {
|
|
|
double sqareRadius = radius * radius;
|
|
|
- return w.getWorld().getEntitiesWithinAABB(PlayerEntity.class, buildBoxAround(x, y, z, radius), p -> p.getDistanceSq(x, y, z) <= sqareRadius);
|
|
|
+ return w.getEntitiesWithinAABB(PlayerEntity.class, buildBoxAround(x, y, z, radius), p -> p.getDistanceSq(x, y, z) <= sqareRadius);
|
|
|
}
|
|
|
|
|
|
public static List<PlayerEntity> getPlayers(Entity not, double radius) {
|
|
@@ -66,6 +82,15 @@ public class Utils {
|
|
|
return not.world.getEntitiesWithinAABB(LivingEntity.class, buildBoxAround(not.getPosX(), not.getPosY(), not.getPosZ(), radius),
|
|
|
p -> p != not && p.getDistanceSq(not) <= sqareRadius);
|
|
|
}
|
|
|
+
|
|
|
+ public static List<LivingEntity> getLiving(Location loc, double radius) {
|
|
|
+ double sqareRadius = radius * radius;
|
|
|
+ double x = loc.getX();
|
|
|
+ double y = loc.getY();
|
|
|
+ double z = loc.getZ();
|
|
|
+ return loc.getWorld().getEntitiesWithinAABB(LivingEntity.class, buildBoxAround(x, y, z, radius),
|
|
|
+ p -> p.getDistanceSq(x, y, z) <= sqareRadius);
|
|
|
+ }
|
|
|
|
|
|
public static <T extends Entity> T getEntity(IWorld w, double x, double y, double z, double radius, Class<T> type) {
|
|
|
return getEntities(w, x, y, z, radius, type).stream()
|