Search in sources :

Example 1 with PlayerChunkMap

use of net.minecraft.server.management.PlayerChunkMap 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

Predicate (com.google.common.base.Predicate)1 PlayerChunkMap (net.minecraft.server.management.PlayerChunkMap)1 PlayerChunkMapEntry (net.minecraft.server.management.PlayerChunkMapEntry)1 WorldServer (net.minecraft.world.WorldServer)1 ChunkProviderServer (net.minecraft.world.gen.ChunkProviderServer)1