diff --git a/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java b/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java index 5f717a6f..44775dfe 100644 --- a/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java +++ b/buildcraft_server/net/minecraft/src/buildcraft/core/CoreProxy.java @@ -10,7 +10,9 @@ package net.minecraft.src.buildcraft.core; import java.io.File; +import java.util.List; +import net.minecraft.src.AxisAlignedBB; import net.minecraft.src.Block; import net.minecraft.src.EntityItem; import net.minecraft.src.EntityPlayer; @@ -51,13 +53,9 @@ public class CoreProxy { public static void sendToPlayers(Packet packet, World w, int x, int y, int z, int maxDistance, NetworkMod mod) { if (packet != null) { - for (int j = 0; j < w.playerEntities.size(); j++) { - EntityPlayerMP player = (EntityPlayerMP)w.playerEntities.get(j); - - if (Math.abs(player.posX - x) <= maxDistance - && Math.abs(player.posY - y) <= maxDistance - && Math.abs(player.posZ - z) <= maxDistance) - player.playerNetServerHandler.sendPacket(packet); + List players = w.getEntitiesWithinAABB(EntityPlayerMP.class, AxisAlignedBB.getBoundingBoxFromPool(x - maxDistance, y - maxDistance, z - maxDistance, x + maxDistance, y + maxDistance, z + maxDistance)); + for (EntityPlayerMP player: players) { + player.playerNetServerHandler.sendPacket(packet); } } }