From 5247bcba64f161ff1223525e5d4353e6158de3a0 Mon Sep 17 00:00:00 2001 From: Stephen Date: Sun, 27 Mar 2011 19:50:43 -0400 Subject: [PATCH] Implemented entity.getNearbyEntities() --- .../org/bukkit/craftbukkit/entity/CraftEntity.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 3e1f5acf7a..a9fc75fb44 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1,13 +1,15 @@ package org.bukkit.craftbukkit.entity; import net.minecraft.server.*; -import net.minecraft.server.WorldServer; + import org.bukkit.Location; import org.bukkit.World; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.util.Vector; +import java.util.List; + public abstract class CraftEntity implements org.bukkit.entity.Entity { protected final CraftServer server; protected Entity entity; @@ -127,6 +129,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { teleport(destination); } + public List getNearbyEntities(double x, double y, double z){ + List notchEntityList = entity.world.b(entity, entity.boundingBox.b(x,y,z)); + List bukkitEntityList = new java.util.ArrayList(notchEntityList.size()); + for (Entity e: notchEntityList){ + bukkitEntityList.add(e.getBukkitEntity()); + } + return bukkitEntityList; + } + public int getEntityId() { return entity.id; }