Implemented entity.getNearbyEntities()

This commit is contained in:
Stephen 2011-03-27 19:50:43 -04:00 committed by Erik Broes
parent a0b2a26c3a
commit 5247bcba64

View File

@ -1,13 +1,15 @@
package org.bukkit.craftbukkit.entity; package org.bukkit.craftbukkit.entity;
import net.minecraft.server.*; import net.minecraft.server.*;
import net.minecraft.server.WorldServer;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import java.util.List;
public abstract class CraftEntity implements org.bukkit.entity.Entity { public abstract class CraftEntity implements org.bukkit.entity.Entity {
protected final CraftServer server; protected final CraftServer server;
protected Entity entity; protected Entity entity;
@ -127,6 +129,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
teleport(destination); teleport(destination);
} }
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z){
List<Entity> notchEntityList = entity.world.b(entity, entity.boundingBox.b(x,y,z));
List<org.bukkit.entity.Entity> bukkitEntityList = new java.util.ArrayList<org.bukkit.entity.Entity>(notchEntityList.size());
for (Entity e: notchEntityList){
bukkitEntityList.add(e.getBukkitEntity());
}
return bukkitEntityList;
}
public int getEntityId() { public int getEntityId() {
return entity.id; return entity.id;
} }