SPIGOT-1165: Restore getNearbyEntities behaviour to include spectators.

This commit is contained in:
md_5 2015-09-06 14:54:41 +10:00
parent 9a17f01ff1
commit 5e9f698fac
2 changed files with 4 additions and 9 deletions

View file

@ -712,7 +712,7 @@ public class CraftWorld implements World {
} }
AxisAlignedBB bb = new AxisAlignedBB(location.getX() - x, location.getY() - y, location.getZ() - z, location.getX() + x, location.getY() + y, location.getZ() + z); 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<net.minecraft.server.Entity> entityList = getHandle().a((net.minecraft.server.Entity) null, bb, null); // PAIL : rename
List<Entity> bukkitEntityList = new ArrayList<org.bukkit.entity.Entity>(entityList.size()); List<Entity> bukkitEntityList = new ArrayList<org.bukkit.entity.Entity>(entityList.size());
for (Object entity : entityList) { for (Object entity : entityList) {
bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity()); bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity());

View file

@ -1,6 +1,8 @@
package org.bukkit.craftbukkit.entity; package org.bukkit.craftbukkit.entity;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
@ -247,14 +249,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
} }
public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) { public List<org.bukkit.entity.Entity> getNearbyEntities(double x, double y, double z) {
@SuppressWarnings("unchecked") return new ArrayList<org.bukkit.entity.Entity>(getHandle().getWorld().getWorld().getNearbyEntities(getLocation(), x, y, z));
List<Entity> notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(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() {