Search in sources :

Example 1 with PlayerChunkMapEntry

use of net.minecraft.server.management.PlayerChunkMapEntry in project Railcraft by Railcraft.

the class PacketDispatcher method sendToWatchers.

public static void sendToWatchers(Packet packet, WorldServer world, int worldX, int worldZ) {
    int chunkX = worldX >> 4;
    int chunkZ = worldZ >> 4;
    PlayerChunkMapEntry chunkManager = world.getPlayerChunkMap().getEntry(chunkX, chunkZ);
    if (chunkManager != null)
        chunkManager.sendPacket(packet);
}
Also used : PlayerChunkMapEntry(net.minecraft.server.management.PlayerChunkMapEntry) TargetPoint(net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)

Example 2 with PlayerChunkMapEntry

use of net.minecraft.server.management.PlayerChunkMapEntry in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class PhysicsObject method injectChunkIntoWorld.

public void injectChunkIntoWorld(Chunk chunk, int x, int z, boolean putInId2ChunkMap) {
    ChunkProviderServer provider = (ChunkProviderServer) worldObj.getChunkProvider();
    //TileEntities will break if you don't do this
    chunk.isChunkLoaded = true;
    chunk.isModified = true;
    claimedChunks[x - ownedChunks.minX][z - ownedChunks.minZ] = chunk;
    if (putInId2ChunkMap) {
        provider.id2ChunkMap.put(ChunkPos.chunkXZ2Int(x, z), chunk);
    }
    PlayerChunkMap map = ((WorldServer) worldObj).getPlayerChunkMap();
    PlayerChunkMapEntry entry = new PlayerChunkMapEntry(map, x, z) {

        @Override
        public boolean hasPlayerMatchingInRange(double range, Predicate<EntityPlayerMP> predicate) {
            return true;
        }
    };
    long i = map.getIndex(x, z);
    map.playerInstances.put(i, entry);
    map.playerInstanceList.add(entry);
    entry.sentToPlayers = true;
    entry.players = watchingPlayers;
    claimedChunksEntries[x - ownedChunks.minX][z - ownedChunks.minZ] = entry;
//		MinecraftForge.EVENT_BUS.post(new ChunkEvent.Load(chunk));
}
Also used : ChunkProviderServer(net.minecraft.world.gen.ChunkProviderServer) WorldServer(net.minecraft.world.WorldServer) PlayerChunkMapEntry(net.minecraft.server.management.PlayerChunkMapEntry) PlayerChunkMap(net.minecraft.server.management.PlayerChunkMap) Predicate(com.google.common.base.Predicate)

Aggregations

PlayerChunkMapEntry (net.minecraft.server.management.PlayerChunkMapEntry)2 Predicate (com.google.common.base.Predicate)1 PlayerChunkMap (net.minecraft.server.management.PlayerChunkMap)1 WorldServer (net.minecraft.world.WorldServer)1 ChunkProviderServer (net.minecraft.world.gen.ChunkProviderServer)1 TargetPoint (net.minecraftforge.fml.common.network.NetworkRegistry.TargetPoint)1