Java 类org.bukkit.craftbukkit.util.LongHash 实例源码

项目:ThermosRebased    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = world.theChunkProviderServer.loadedChunkHashMap.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:ThermosRebased    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:Thermos    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap_KC.add(LongHash.toLong(x, z), chunk); // Passes to chunkt_TH
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility
        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:KCauldron    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = world.theChunkProviderServer.loadedChunkHashMap_KC.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:KCauldron    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap_KC.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:CauldronGit    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = world.theChunkProviderServer.loadedChunkHashMap.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:CauldronGit    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:Cauldron-Old    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = world.theChunkProviderServer.loadedChunkHashMap.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:Cauldron-Old    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:Cauldron-Reloaded    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = world.theChunkProviderServer.loadedChunkHashMap.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:Cauldron-Reloaded    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:FFoKC    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = (net.minecraft.world.chunk.Chunk) world.theChunkProviderServer.loadedChunkHashMap_KC.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:FFoKC    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap_KC.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility
        //world.theChunkProviderServer.loadedChunkHashMap.add(ChunkCoordIntPair.chunkXZ2Int(x, z), chunk);

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:CraftBukkit    文件:CraftWorld.java   
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
    if (safe && isChunkInUse(x, z)) {
        return false;
    }

    net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
    if (chunk.mustSave) {   // If chunk had previously been queued to save, must do save to avoid loss of that data
        save = true;
    }

    chunk.removeEntities(); // Always remove entities - even if discarding, need to get them out of world table

    if (save && !(chunk instanceof EmptyChunk)) {
        world.chunkProviderServer.saveChunk(chunk);
        world.chunkProviderServer.saveChunkNOP(chunk);
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    world.chunkProviderServer.chunks.remove(LongHash.toLong(x, z));

    return true;
}
项目:CraftBukkit    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.chunkProviderServer.getChunkAt(x, z) != null;
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));

    if (chunk == null) {
        chunk = world.chunkProviderServer.loadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
    }
    return chunk != null;
}
项目:CraftBukkit    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.chunkProviderServer.chunks.put(LongHash.toLong(x, z), chunk);

        chunk.addEntities();

        if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z).done && world.chunkProviderServer.isChunkLoaded(x - 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x, z - 1).done && world.chunkProviderServer.isChunkLoaded(x + 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z - 1);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z - 1).done && world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:CraftBukkit    文件:ChunkProviderServer.java   
public Chunk getOrCreateChunk(int i, int j) {
    // CraftBukkit start
    Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));

    chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
    if (chunk == this.emptyChunk) return chunk;
    if (i != chunk.locX || j != chunk.locZ) {
        b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at  (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
        b.error(chunk.getClass().getName());
        Throwable ex = new Throwable();
        ex.fillInStackTrace();
        ex.printStackTrace();
    }
    return chunk;
    // CraftBukkit end
}
项目:Craftbukkit    文件:CraftWorld.java   
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
    if (safe && isChunkInUse(x, z)) {
        return false;
    }

    net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
    if (chunk.mustSave) {   // If chunk had previously been queued to save, must do save to avoid loss of that data
        save = true;
    }

    chunk.removeEntities(); // Always remove entities - even if discarding, need to get them out of world table

    if (save && !(chunk instanceof EmptyChunk)) {
        world.chunkProviderServer.saveChunk(chunk);
        world.chunkProviderServer.saveChunkNOP(chunk);
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    world.chunkProviderServer.chunks.remove(LongHash.toLong(x, z));

    return true;
}
项目:Craftbukkit    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.chunkProviderServer.getChunkAt(x, z) != null;
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));

    if (chunk == null) {
        chunk = world.chunkProviderServer.loadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
    }
    return chunk != null;
}
项目:Craftbukkit    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int cx, int cz) {
    if (chunk != null) {
        world.chunkProviderServer.chunks.put(LongHash.toLong(cx, cz), chunk);

        chunk.addEntities();

        // Update neighbor counts
        for (int x = -2; x < 3; x++) {
            for (int z = -2; z < 3; z++) {
                if (x == 0 && z == 0) {
                    continue;
                }

                net.minecraft.server.Chunk neighbor = world.chunkProviderServer.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
                if (neighbor != null) {
                    neighbor.setNeighborLoaded(-x, -z);
                    chunk.setNeighborLoaded(x, z);
                }
            }
        }
        // CraftBukkit end

        chunk.loadNearby(world.chunkProviderServer, world.chunkProviderServer, cx, cz);
    }
}
项目:Almura-Server    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    if (Thread.currentThread() != MinecraftServer.getServer().primaryThread) throw new IllegalStateException("Asynchronous chunk load!"); // Spigot
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.chunkProviderServer.getChunkAt(x, z) != null;
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));

    if (chunk == null) {
        chunk = world.chunkProviderServer.loadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
    }
    return chunk != null;
}
项目:Almura-Server    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.chunkProviderServer.chunks.put(LongHash.toLong(x, z), chunk);

        chunk.addEntities();

        if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z).done && world.chunkProviderServer.isChunkLoaded(x - 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x, z - 1).done && world.chunkProviderServer.isChunkLoaded(x + 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z - 1);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z - 1).done && world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:Almura-Server    文件:ChunkProviderServer.java   
public Chunk getOrCreateChunk(int i, int j) {
    // CraftBukkit start
    Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));

    chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
    if (chunk == this.emptyChunk) return chunk;
    if (i != chunk.x || j != chunk.z) {
        this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at  (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
        this.world.getLogger().severe(chunk.getClass().getName());
        Throwable ex = new Throwable();
        ex.fillInStackTrace();
        ex.printStackTrace();
    }
    return chunk;
    // CraftBukkit end
}
项目:Tweakkit-Server    文件:CraftWorld.java   
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
    org.spigotmc.AsyncCatcher.catchOp( "chunk unload"); // Spigot
    if (safe && isChunkInUse(x, z)) {
        return false;
    }

    net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
    if (chunk.mustSave) {   // If chunk had previously been queued to save, must do save to avoid loss of that data
        save = true;
    }

    chunk.removeEntities(); // Always remove entities - even if discarding, need to get them out of world table

    if (save && !(chunk instanceof EmptyChunk)) {
        world.chunkProviderServer.saveChunk(chunk);
        world.chunkProviderServer.saveChunkNOP(chunk);
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    world.chunkProviderServer.chunks.remove(LongHash.toLong(x, z));

    return true;
}
项目:Tweakkit-Server    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    org.spigotmc.AsyncCatcher.catchOp( "chunk load"); // Spigot
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.chunkProviderServer.getChunkAt(x, z) != null;
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.chunkProviderServer.loadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:Tweakkit-Server    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.chunkProviderServer.chunks.put(LongHash.toLong(x, z), chunk);

        chunk.addEntities();

        if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z).done && world.chunkProviderServer.isChunkLoaded(x - 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x, z - 1).done && world.chunkProviderServer.isChunkLoaded(x + 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z - 1);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z - 1).done && world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:Tweakkit-Server    文件:ChunkProviderServer.java   
public Chunk getOrCreateChunk(int i, int j) {
    // CraftBukkit start
    Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));

    chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
    if (chunk == this.emptyChunk) return chunk;
    if (i != chunk.locX || j != chunk.locZ) {
        b.error("Chunk (" + chunk.locX + ", " + chunk.locZ + ") stored at  (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
        b.error(chunk.getClass().getName());
        Throwable ex = new Throwable();
        ex.fillInStackTrace();
        ex.printStackTrace();
    }
    return chunk;
    // CraftBukkit end
}
项目:Cauldron    文件:ChunkProviderServer.java   
public Chunk provideChunk(int p_73154_1_, int p_73154_2_)
{
    // CraftBukkit start
    Chunk chunk = (Chunk) this.loadedChunkHashMap.get(LongHash.toLong(p_73154_1_, p_73154_2_));
    chunk = chunk == null ? (shouldLoadChunk() ? this.loadChunk(p_73154_1_, p_73154_2_) : this.defaultEmptyChunk) : chunk; // Cauldron handle forge server tick events and load the chunk within 5 seconds of the world being loaded (for chunk loaders)

    if (chunk == this.defaultEmptyChunk)
    {
        return chunk;
    }

    if (p_73154_1_ != chunk.xPosition || p_73154_2_ != chunk.zPosition)
    {
        logger.error("Chunk (" + chunk.xPosition + ", " + chunk.zPosition + ") stored at  (" + p_73154_1_ + ", " + p_73154_2_ + ") in world '" + worldObj.getWorld().getName() + "'");
        logger.error(chunk.getClass().getName());
        Throwable ex = new Throwable();
        ex.fillInStackTrace();
        ex.printStackTrace();
    }
    chunk.lastAccessedTick = MinecraftServer.getServer().getTickCounter(); // Cauldron
    return chunk;
    // CraftBukkit end
}
项目:Cauldron    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.theChunkProviderServer.loadChunk(x, z) != null;
    }

    world.theChunkProviderServer.chunksToUnload.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = world.theChunkProviderServer.loadedChunkHashMap.get(LongHash.toLong(x, z));

    if (chunk == null) {
        world.timings.syncChunkLoadTimer.startTiming(); // Spigot
        chunk = world.theChunkProviderServer.safeLoadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
        world.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }
    return chunk != null;
}
项目:Cauldron    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.theChunkProviderServer.loadedChunkHashMap.put(LongHash.toLong(x, z), chunk);
        world.theChunkProviderServer.loadedChunks.add(chunk); // Cauldron - vanilla compatibility

        chunk.onChunkLoad();

        if (!chunk.isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z) && !world.theChunkProviderServer.provideChunk(x - 1, z).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z + 1) && world.theChunkProviderServer.chunkExists(x, z + 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z);
        }

        if (world.theChunkProviderServer.chunkExists(x, z - 1) && !world.theChunkProviderServer.provideChunk(x, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x + 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x + 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x, z - 1);
        }

        if (world.theChunkProviderServer.chunkExists(x - 1, z - 1) && !world.theChunkProviderServer.provideChunk(x - 1, z - 1).isTerrainPopulated && world.theChunkProviderServer.chunkExists(x - 1, z - 1) && world.theChunkProviderServer.chunkExists(x, z - 1) && world.theChunkProviderServer.chunkExists(x - 1, z)) {
            world.theChunkProviderServer.populate(world.theChunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:SpigotSource    文件:SpawnerCreature.java   
private int getEntityCount(WorldServer server, Class oClass)
{
    int i = 0;
    Iterator<Long> it = this.b.iterator();
    while ( it.hasNext() )
    {
        Long coord = it.next();
        int x = LongHash.msw( coord );
        int z = LongHash.lsw( coord );
        if ( !((ChunkProviderServer)server.chunkProvider).unloadQueue.contains( coord ) && server.isChunkLoaded( x, z, true ) )
        {
            i += server.getChunkAt( x, z ).entityCount.get( oClass );
        }
    }
    return i;
}
项目:Craft-city    文件:CraftWorld.java   
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
    if (safe && isChunkInUse(x, z)) {
        return false;
    }

    net.minecraft.server.Chunk chunk = world.chunkProviderServer.getOrCreateChunk(x, z);
    if (chunk.mustSave) {   // If chunk had previously been queued to save, must do save to avoid loss of that data
        save = true;
    }

    chunk.removeEntities(); // Always remove entities - even if discarding, need to get them out of world table

    if (save && !(chunk instanceof EmptyChunk)) {
        world.chunkProviderServer.saveChunk(chunk);
        world.chunkProviderServer.saveChunkNOP(chunk);
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    world.chunkProviderServer.chunks.remove(LongHash.toLong(x, z));

    return true;
}
项目:Craft-city    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.chunkProviderServer.getChunkAt(x, z) != null;
    }

    world.chunkProviderServer.unloadQueue.remove(x, z);
    net.minecraft.server.Chunk chunk = world.chunkProviderServer.chunks.get(LongHash.toLong(x, z));

    if (chunk == null) {
        chunk = world.chunkProviderServer.loadChunk(x, z);

        chunkLoadPostProcess(chunk, x, z);
    }
    return chunk != null;
}
项目:Craft-city    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.server.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.chunkProviderServer.chunks.put(LongHash.toLong(x, z), chunk);

        chunk.addEntities();

        if (!chunk.done && world.chunkProviderServer.isChunkLoaded(x + 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z).done && world.chunkProviderServer.isChunkLoaded(x - 1, z + 1) && world.chunkProviderServer.isChunkLoaded(x, z + 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z);
        }

        if (world.chunkProviderServer.isChunkLoaded(x, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x, z - 1).done && world.chunkProviderServer.isChunkLoaded(x + 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x + 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x, z - 1);
        }

        if (world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && !world.chunkProviderServer.getOrCreateChunk(x - 1, z - 1).done && world.chunkProviderServer.isChunkLoaded(x - 1, z - 1) && world.chunkProviderServer.isChunkLoaded(x, z - 1) && world.chunkProviderServer.isChunkLoaded(x - 1, z)) {
            world.chunkProviderServer.getChunkAt(world.chunkProviderServer, x - 1, z - 1);
        }
    }
}
项目:Craft-city    文件:ChunkProviderServer.java   
public Chunk getOrCreateChunk(int i, int j) {
    // CraftBukkit start
    Chunk chunk = (Chunk) this.chunks.get(LongHash.toLong(i, j));

    chunk = chunk == null ? (!this.world.isLoading && !this.forceChunkLoad ? this.emptyChunk : this.getChunkAt(i, j)) : chunk;
    if (chunk == this.emptyChunk) return chunk;
    if (i != chunk.x || j != chunk.z) {
        this.world.getLogger().severe("Chunk (" + chunk.x + ", " + chunk.z + ") stored at  (" + i + ", " + j + ") in world '" + world.getWorld().getName() + "'");
        this.world.getLogger().severe(chunk.getClass().getName());
        Throwable ex = new Throwable();
        ex.fillInStackTrace();
        ex.printStackTrace();
    }
    return chunk;
    // CraftBukkit end
}
项目:MCPBukkit    文件:CraftWorld.java   
public boolean unloadChunk(int x, int z, boolean save, boolean safe) {
    if (safe && isChunkInUse(x, z)) {
        return false;
    }

    net.minecraft.world.chunk.Chunk chunk = world.field_73059_b.func_73154_d(x, z);
    if (chunk.mustSave) {   // If chunk had previously been queued to save, must do save to avoid loss of that data
        save = true;
    }

    chunk.func_76623_d(); // Always remove entities - even if discarding, need to get them out of world table

    if (save && !(chunk instanceof net.minecraft.world.chunk.EmptyChunk)) {
        world.field_73059_b.func_73242_b(chunk);
        world.field_73059_b.func_73243_a(chunk);
    }

    world.field_73059_b.field_73248_b.remove(x, z);
    world.field_73059_b.field_73244_f.remove(LongHash.toLong(x, z));

    return true;
}
项目:MCPBukkit    文件:CraftWorld.java   
public boolean loadChunk(int x, int z, boolean generate) {
    chunkLoadCount++;
    if (generate) {
        // Use the default variant of loadChunk when generate == true.
        return world.field_73059_b.func_73158_c(x, z) != null;
    }

    world.field_73059_b.field_73248_b.remove(x, z);
    net.minecraft.world.chunk.Chunk chunk = (net.minecraft.world.chunk.Chunk) world.field_73059_b.field_73244_f.get(LongHash.toLong(x, z));

    if (chunk == null) {
        chunk = world.field_73059_b.func_73239_e(x, z);

        chunkLoadPostProcess(chunk, x, z);
    }
    return chunk != null;
}
项目:MCPBukkit    文件:CraftWorld.java   
private void chunkLoadPostProcess(net.minecraft.world.chunk.Chunk chunk, int x, int z) {
    if (chunk != null) {
        world.field_73059_b.field_73244_f.put(LongHash.toLong(x, z), chunk);

        chunk.func_76631_c();

        if (!chunk.field_76646_k && world.field_73059_b.func_73149_a(x + 1, z + 1) && world.field_73059_b.func_73149_a(x, z + 1) && world.field_73059_b.func_73149_a(x + 1, z)) {
            world.field_73059_b.func_73153_a(world.field_73059_b, x, z);
        }

        if (world.field_73059_b.func_73149_a(x - 1, z) && !world.field_73059_b.func_73154_d(x - 1, z).field_76646_k && world.field_73059_b.func_73149_a(x - 1, z + 1) && world.field_73059_b.func_73149_a(x, z + 1) && world.field_73059_b.func_73149_a(x - 1, z)) {
            world.field_73059_b.func_73153_a(world.field_73059_b, x - 1, z);
        }

        if (world.field_73059_b.func_73149_a(x, z - 1) && !world.field_73059_b.func_73154_d(x, z - 1).field_76646_k && world.field_73059_b.func_73149_a(x + 1, z - 1) && world.field_73059_b.func_73149_a(x, z - 1) && world.field_73059_b.func_73149_a(x + 1, z)) {
            world.field_73059_b.func_73153_a(world.field_73059_b, x, z - 1);
        }

        if (world.field_73059_b.func_73149_a(x - 1, z - 1) && !world.field_73059_b.func_73154_d(x - 1, z - 1).field_76646_k && world.field_73059_b.func_73149_a(x - 1, z - 1) && world.field_73059_b.func_73149_a(x, z - 1) && world.field_73059_b.func_73149_a(x - 1, z)) {
            world.field_73059_b.func_73153_a(world.field_73059_b, x - 1, z - 1);
        }
    }
}
项目:Thermos    文件:VanillaChunkHashMap.java   
private long V2B(long key) {
    if(notRealFace)
    {
        return key;
    }
    else
    {
        return ChunkCoordIntPair.chunkXZ2Int(LongHash.msw(key) , LongHash.lsw(key));
    }
    //return LongHash.toLong((int) (key & 0xFFFFFFFFL), (int) (key >>> 32));
}
项目:CraftBukkit    文件:ChunkIOProvider.java   
public void callStage2(QueuedChunk queuedChunk, Chunk chunk) throws RuntimeException {
    if (chunk == null) {
        // If the chunk loading failed just do it synchronously (may generate)
        queuedChunk.provider.originalGetChunkAt(queuedChunk.x, queuedChunk.z);
        return;
    }

    queuedChunk.loader.loadEntities(chunk, queuedChunk.compound.getCompound("Level"), queuedChunk.world);
    chunk.lastSaved = queuedChunk.provider.world.getTime();
    queuedChunk.provider.chunks.put(LongHash.toLong(queuedChunk.x, queuedChunk.z), chunk);
    chunk.addEntities();

    if (queuedChunk.provider.chunkProvider != null) {
        queuedChunk.provider.chunkProvider.recreateStructures(queuedChunk.x, queuedChunk.z);
    }

    Server server = queuedChunk.provider.world.getServer();
    if (server != null) {
        server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, false));
    }

    // Update neighbor counts
    for (int x = -2; x < 3; x++) {
        for (int z = -2; z < 3; z++) {
            if (x == 0 && z == 0) {
                continue;
            }

            Chunk neighbor = queuedChunk.provider.getChunkIfLoaded(chunk.locX + x, chunk.locZ + z);
            if (neighbor != null) {
                neighbor.setNeighborLoaded(-x, -z);
                chunk.setNeighborLoaded(x, z);
            }
        }
    }

    chunk.loadNearby(queuedChunk.provider, queuedChunk.provider, queuedChunk.x, queuedChunk.z);
}