From 5e9f698fac73a155217f9b42fdb203ea067961e8 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sun, 6 Sep 2015 14:54:41 +1000 Subject: [PATCH] SPIGOT-1165: Restore getNearbyEntities behaviour to include spectators. --- src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 2 +- .../org/bukkit/craftbukkit/entity/CraftEntity.java | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index 554e3b784e..2bbbdd3776 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -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); - List entityList = getHandle().getEntities(null, bb); + List entityList = getHandle().a((net.minecraft.server.Entity) null, bb, null); // PAIL : rename List bukkitEntityList = new ArrayList(entityList.size()); for (Object entity : entityList) { bukkitEntityList.add(((net.minecraft.server.Entity) entity).getBukkitEntity()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java index 8f5c0587ff..b986a4678d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java @@ -1,6 +1,8 @@ package org.bukkit.craftbukkit.entity; import com.google.common.base.Preconditions; +import java.util.ArrayList; +import java.util.Collection; import java.util.List; import java.util.Set; import java.util.UUID; @@ -247,14 +249,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } public List getNearbyEntities(double x, double y, double z) { - @SuppressWarnings("unchecked") - List notchEntityList = entity.world.getEntities(entity, entity.getBoundingBox().grow(x, y, z)); - List bukkitEntityList = new java.util.ArrayList(notchEntityList.size()); - - for (Entity e : notchEntityList) { - bukkitEntityList.add(e.getBukkitEntity()); - } - return bukkitEntityList; + return new ArrayList(getHandle().getWorld().getWorld().getNearbyEntities(getLocation(), x, y, z)); } public int getEntityId() {