Used getEntitiesWithinAABB instead of getting all the players of the world for sendToPlayers.
This commit is contained in:
parent
0111cd7528
commit
93cd7fe74e
1 changed files with 5 additions and 7 deletions
|
@ -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,12 +53,8 @@ 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)
|
||||
List<EntityPlayerMP> 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue