use of net.minecraft.server.v1_16_R1.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;
}
use of net.minecraft.server.v1_16_R1.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;
}
use of net.minecraft.server.v1_16_R1.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;
}
use of net.minecraft.server.v1_16_R1.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;
}
use of net.minecraft.server.v1_16_R1.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;
}
Aggregations