use of logisticspipes.utils.PlayerCollectionList in project LogisticsPipes by RS485.
the class MainProxy method isAnyoneWatching.
// ignores dimension; more stringent check done inside sendPacketToAllWatching
public static boolean isAnyoneWatching(int X, int Z, int dimensionID) {
ChunkPos chunk = new ChunkPos(X >> 4, Z >> 4);
PlayerCollectionList players = LogisticsEventListener.watcherList.get(chunk);
if (players == null) {
return false;
}
return !players.isEmptyWithoutCheck();
}
use of logisticspipes.utils.PlayerCollectionList in project LogisticsPipes by RS485.
the class MainProxy method sendPacketToAllWatchingChunk.
public static void sendPacketToAllWatchingChunk(int X, int Z, int dimensionId, ModernPacket packet) {
if (!MainProxy.isServer()) {
System.err.println("sendPacketToAllWatchingChunk called clientside !");
new Exception().printStackTrace();
return;
}
ChunkPos chunk = new ChunkPos(X >> 4, Z >> 4);
PlayerCollectionList players = LogisticsEventListener.watcherList.get(chunk);
if (players != null) {
for (EntityPlayer player : players.players()) {
if (player.world.provider.getDimension() == dimensionId) {
MainProxy.sendPacketToPlayer(packet, player);
}
}
}
}
use of logisticspipes.utils.PlayerCollectionList in project LogisticsPipes by RS485.
the class LogisticsEventListener method watchChunk.
@SubscribeEvent
public void watchChunk(Watch event) {
ChunkPos pos = event.getChunkInstance().getPos();
if (!LogisticsEventListener.watcherList.containsKey(pos)) {
LogisticsEventListener.watcherList.put(pos, new PlayerCollectionList());
}
LogisticsEventListener.watcherList.get(pos).add(event.getPlayer());
}
Aggregations