Search in sources :

Example 6 with ThreadedAnvilChunkStorage

use of net.minecraft.server.world.ThreadedAnvilChunkStorage in project ImmersivePortalsMod by qouteall.

the class ChunkDataSyncManager method sendWatchPackets.

private void sendWatchPackets(ServerPlayerEntity player, DimensionalChunkPos chunkPos, IEThreadedAnvilChunkStorage ieStorage) {
    McHelper.getServer().getProfiler().push("send_chunk_data");
    Chunk chunk = McHelper.getServer().getWorld(chunkPos.dimension).getChunk(chunkPos.x, chunkPos.z);
    assert chunk != null;
    assert !(chunk instanceof EmptyChunk);
    player.networkHandler.sendPacket(MyNetwork.createRedirectedMessage(chunkPos.dimension, new ChunkDataS2CPacket(((WorldChunk) chunk), 65535)));
    player.networkHandler.sendPacket(MyNetwork.createRedirectedMessage(chunkPos.dimension, new LightUpdateS2CPacket(chunkPos.getChunkPos(), ieStorage.getLightingProvider())));
    // update the entity trackers
    ((ThreadedAnvilChunkStorage) ieStorage).updateCameraPosition(player);
    McHelper.getServer().getProfiler().pop();
}
Also used : EmptyChunk(net.minecraft.world.chunk.EmptyChunk) WorldChunk(net.minecraft.world.chunk.WorldChunk) LightUpdateS2CPacket(net.minecraft.client.network.packet.LightUpdateS2CPacket) ChunkDataS2CPacket(net.minecraft.client.network.packet.ChunkDataS2CPacket) ThreadedAnvilChunkStorage(net.minecraft.server.world.ThreadedAnvilChunkStorage) IEThreadedAnvilChunkStorage(com.qouteall.immersive_portals.ducks.IEThreadedAnvilChunkStorage) WorldChunk(net.minecraft.world.chunk.WorldChunk) EmptyChunk(net.minecraft.world.chunk.EmptyChunk) Chunk(net.minecraft.world.chunk.Chunk)

Example 7 with ThreadedAnvilChunkStorage

use of net.minecraft.server.world.ThreadedAnvilChunkStorage in project dynmap by webbukkit.

the class FabricMapChunkCache method readChunk.

private CompoundTag readChunk(int x, int z) {
    try {
        ThreadedAnvilChunkStorage acl = cps.threadedAnvilChunkStorage;
        ChunkPos coord = new ChunkPos(x, z);
        return acl.getTagAt(coord);
    } catch (Exception exc) {
        Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc);
        return null;
    }
}
Also used : ThreadedAnvilChunkStorage(net.minecraft.server.world.ThreadedAnvilChunkStorage) ChunkPos(net.minecraft.util.math.ChunkPos)

Example 8 with ThreadedAnvilChunkStorage

use of net.minecraft.server.world.ThreadedAnvilChunkStorage in project dynmap by webbukkit.

the class FabricMapChunkCache method readChunk.

private NbtCompound readChunk(int x, int z) {
    try {
        ThreadedAnvilChunkStorage acl = cps.threadedAnvilChunkStorage;
        ChunkPos coord = new ChunkPos(x, z);
        return acl.getNbt(coord);
    } catch (Exception exc) {
        Log.severe(String.format("Error reading chunk: %s,%d,%d", dw.getName(), x, z), exc);
        return null;
    }
}
Also used : ThreadedAnvilChunkStorage(net.minecraft.server.world.ThreadedAnvilChunkStorage) ChunkPos(net.minecraft.util.math.ChunkPos)

Aggregations

ThreadedAnvilChunkStorage (net.minecraft.server.world.ThreadedAnvilChunkStorage)8 ChunkPos (net.minecraft.util.math.ChunkPos)6 IEThreadedAnvilChunkStorage (com.qouteall.immersive_portals.ducks.IEThreadedAnvilChunkStorage)2 Either (com.mojang.datafixers.util.Either)1 ChunkDataS2CPacket (net.minecraft.client.network.packet.ChunkDataS2CPacket)1 LightUpdateS2CPacket (net.minecraft.client.network.packet.LightUpdateS2CPacket)1 ChunkHolder (net.minecraft.server.world.ChunkHolder)1 Chunk (net.minecraft.world.chunk.Chunk)1 EmptyChunk (net.minecraft.world.chunk.EmptyChunk)1 WorldChunk (net.minecraft.world.chunk.WorldChunk)1