Search in sources :

Example 1 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.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)

Example 2 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.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)

Example 3 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)

Example 4 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)

Example 5 with ThreadedAnvilChunkStorage

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

the class ChunkDataSyncManager method sendPacketMultiThreaded.

private void sendPacketMultiThreaded(ServerPlayerEntity player, DimensionalChunkPos chunkPos, IEThreadedAnvilChunkStorage ieStorage) {
    ModMain.serverTaskList.addTask(() -> {
        ChunkHolder chunkHolder = ieStorage.getChunkHolder_(chunkPos.getChunkPos().toLong());
        if (chunkHolder == null) {
            // TODO cleanup it
            SGlobal.chunkTrackingGraph.setIsLoadedByPortal(chunkPos.dimension, chunkPos.getChunkPos(), true);
            return false;
        }
        CompletableFuture<Either<Chunk, ChunkHolder.Unloaded>> future = chunkHolder.createFuture(ChunkStatus.FULL, ((ThreadedAnvilChunkStorage) ieStorage));
        future.thenAcceptAsync(either -> {
            ModMain.serverTaskList.addTask(() -> {
                sendWatchPackets(player, chunkPos, ieStorage);
                return true;
            });
        });
        return true;
    });
}
Also used : ChunkHolder(net.minecraft.server.world.ChunkHolder) Either(com.mojang.datafixers.util.Either) ThreadedAnvilChunkStorage(net.minecraft.server.world.ThreadedAnvilChunkStorage) IEThreadedAnvilChunkStorage(com.qouteall.immersive_portals.ducks.IEThreadedAnvilChunkStorage)

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