Search in sources :

Example 1 with ChunkCoordIntPair

use of net.minecraft.server.v1_16_R3.ChunkCoordIntPair in project dynmap by webbukkit.

the class MapChunkCache115 method loadChunk.

// Load generic chunk from unloaded chunk
protected GenericChunk loadChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
    GenericChunk gc = null;
    try {
        nbt = cw.getHandle().getChunkProvider().playerChunkMap.read(cc);
    } catch (IOException iox) {
    }
    if (nbt != null) {
        gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
    }
    return gc;
}
Also used : ChunkCoordIntPair(net.minecraft.server.v1_15_R1.ChunkCoordIntPair) GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_15_R1.NBTTagCompound) IOException(java.io.IOException) CraftWorld(org.bukkit.craftbukkit.v1_15_R1.CraftWorld)

Example 2 with ChunkCoordIntPair

use of net.minecraft.server.v1_16_R3.ChunkCoordIntPair in project dynmap by webbukkit.

the class MapChunkCache116_3 method loadChunk.

// Load generic chunk from unloaded chunk
protected GenericChunk loadChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
    GenericChunk gc = null;
    try {
        nbt = cw.getHandle().getChunkProvider().playerChunkMap.read(cc);
    } catch (IOException iox) {
    }
    if (nbt != null) {
        gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
    }
    return gc;
}
Also used : ChunkCoordIntPair(net.minecraft.server.v1_16_R2.ChunkCoordIntPair) GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_16_R2.NBTTagCompound) IOException(java.io.IOException) CraftWorld(org.bukkit.craftbukkit.v1_16_R2.CraftWorld)

Example 3 with ChunkCoordIntPair

use of net.minecraft.server.v1_16_R3.ChunkCoordIntPair in project dynmap by webbukkit.

the class MapChunkCache116 method loadChunk.

// Load generic chunk from unloaded chunk
protected GenericChunk loadChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
    GenericChunk gc = null;
    try {
        nbt = cw.getHandle().getChunkProvider().playerChunkMap.read(cc);
    } catch (IOException iox) {
    }
    if (nbt != null) {
        gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
    }
    return gc;
}
Also used : ChunkCoordIntPair(net.minecraft.server.v1_16_R1.ChunkCoordIntPair) GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_16_R1.NBTTagCompound) IOException(java.io.IOException) CraftWorld(org.bukkit.craftbukkit.v1_16_R1.CraftWorld)

Example 4 with ChunkCoordIntPair

use of net.minecraft.server.v1_16_R3.ChunkCoordIntPair in project dynmap by webbukkit.

the class MapChunkCache114_1 method loadChunk.

// Load generic chunk from unloaded chunk
protected GenericChunk loadChunk(DynmapChunk chunk) {
    CraftWorld cw = (CraftWorld) w;
    NBTTagCompound nbt = null;
    ChunkCoordIntPair cc = new ChunkCoordIntPair(chunk.x, chunk.z);
    GenericChunk gc = null;
    try {
        nbt = cw.getHandle().getChunkProvider().playerChunkMap.read(cc);
    } catch (IOException iox) {
    }
    if (nbt != null) {
        gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
    }
    return gc;
}
Also used : ChunkCoordIntPair(net.minecraft.server.v1_14_R1.ChunkCoordIntPair) GenericChunk(org.dynmap.common.chunk.GenericChunk) NBTTagCompound(net.minecraft.server.v1_14_R1.NBTTagCompound) IOException(java.io.IOException) CraftWorld(org.bukkit.craftbukkit.v1_14_R1.CraftWorld)

Example 5 with ChunkCoordIntPair

use of net.minecraft.server.v1_16_R3.ChunkCoordIntPair in project THP-Engine by TheHollowPlanetMC.

the class MultiBlockChangePacketHandler method rewrite.

@Override
public Object rewrite(Object packet, EnginePlayer EnginePlayer, boolean cacheSetting) {
    ParallelUniverse universe = EnginePlayer.getUniverse();
    if (universe == null)
        return packet;
    String worldName = EnginePlayer.getBukkitPlayer().getWorld().getName();
    ParallelWorld parallelWorld = universe.getWorld(worldName);
    try {
        ChunkCoordIntPair aValue = (ChunkCoordIntPair) a.get(packet);
        PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] bValue = (PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[]) b.get(packet);
        int chunkX = aValue.x;
        int chunkZ = aValue.z;
        ParallelChunk parallelChunk = parallelWorld.getChunk(chunkX, chunkZ);
        if (parallelChunk == null)
            return packet;
        PacketPlayOutMultiBlockChange newPacket = new PacketPlayOutMultiBlockChange();
        a.set(newPacket, aValue);
        int length = bValue.length;
        PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[] newInfo = new PacketPlayOutMultiBlockChange.MultiBlockChangeInfo[length];
        for (int index = 0; index < length; index++) {
            PacketPlayOutMultiBlockChange.MultiBlockChangeInfo info = bValue[index];
            BlockPosition bp = info.a();
            BlockData blockData = parallelChunk.getBlockData(bp.getX(), bp.getY(), bp.getZ());
            if (blockData == null) {
                newInfo[index] = info;
            } else {
                newInfo[index] = newPacket.new MultiBlockChangeInfo(info.b(), ((CraftBlockData) blockData).getState());
            }
        }
        b.set(newPacket, newInfo);
        return newPacket;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return packet;
}
Also used : ParallelWorld(thpmc.engine.api.world.parallel.ParallelWorld) ChunkCoordIntPair(net.minecraft.server.v1_15_R1.ChunkCoordIntPair) PacketPlayOutMultiBlockChange(net.minecraft.server.v1_15_R1.PacketPlayOutMultiBlockChange) BlockPosition(net.minecraft.server.v1_15_R1.BlockPosition) ParallelChunk(thpmc.engine.api.world.parallel.ParallelChunk) CraftBlockData(org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData) ParallelUniverse(thpmc.engine.api.world.parallel.ParallelUniverse) BlockData(org.bukkit.block.data.BlockData) CraftBlockData(org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData)

Aggregations

IOException (java.io.IOException)5 GenericChunk (org.dynmap.common.chunk.GenericChunk)5 ChunkCoordIntPair (net.minecraft.server.v1_15_R1.ChunkCoordIntPair)2 ChunkCoordIntPair (net.minecraft.server.v1_16_R2.ChunkCoordIntPair)2 NBTTagCompound (net.minecraft.server.v1_16_R2.NBTTagCompound)2 CraftWorld (org.bukkit.craftbukkit.v1_16_R2.CraftWorld)2 ChunkCoordIntPair (net.minecraft.server.v1_14_R1.ChunkCoordIntPair)1 NBTTagCompound (net.minecraft.server.v1_14_R1.NBTTagCompound)1 BlockPosition (net.minecraft.server.v1_15_R1.BlockPosition)1 NBTTagCompound (net.minecraft.server.v1_15_R1.NBTTagCompound)1 PacketPlayOutMultiBlockChange (net.minecraft.server.v1_15_R1.PacketPlayOutMultiBlockChange)1 ChunkCoordIntPair (net.minecraft.server.v1_16_R1.ChunkCoordIntPair)1 NBTTagCompound (net.minecraft.server.v1_16_R1.NBTTagCompound)1 BlockData (org.bukkit.block.data.BlockData)1 CraftWorld (org.bukkit.craftbukkit.v1_14_R1.CraftWorld)1 CraftWorld (org.bukkit.craftbukkit.v1_15_R1.CraftWorld)1 CraftBlockData (org.bukkit.craftbukkit.v1_15_R1.block.data.CraftBlockData)1 CraftWorld (org.bukkit.craftbukkit.v1_16_R1.CraftWorld)1 ParallelChunk (thpmc.engine.api.world.parallel.ParallelChunk)1 ParallelUniverse (thpmc.engine.api.world.parallel.ParallelUniverse)1