Archiviert
13
0

Implement World.getNearbyEntities

Dieser Commit ist enthalten in:
Nathan Wolf 2015-04-06 06:30:17 -07:00 committet von md_5
Ursprung 7d020a7041
Commit 96c2c39245

Datei anzeigen

@ -3,6 +3,7 @@ package org.bukkit.craftbukkit;
import java.io.File;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Iterator;
@ -703,6 +704,21 @@ public class CraftWorld implements World {
return list;
}
@Override
public Collection<Entity> getNearbyEntities(Location location, double x, double y, double z) {
if (location == null || !location.getWorld().equals(this)) {
return Collections.emptyList();
}
AxisAlignedBB bb = new AxisAlignedBB(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z);
List<net.minecraft.server.Entity> entityList = getHandle().getEntities(null, bb);
List<Entity> bukkitEntityList = new ArrayList<org.bukkit.entity.Entity>(entityList.size());
for (Object entity : entityList) {
bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity());
}
return bukkitEntityList;
}
public List<Player> getPlayers() {
List<Player> list = new ArrayList<Player>();