use of net.minecraft.world.level.chunk.Chunk in project dynmap by webbukkit.
the class MapChunkCache118_2 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z);
if ((c != null) && c.o) {
// c.loaded
nbt = ChunkRegionLoader.a(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
use of net.minecraft.world.level.chunk.Chunk in project dynmap by webbukkit.
the class MapChunkCache118 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkIfLoaded(chunk.x, chunk.z);
if ((c != null) && c.o) {
// c.loaded
nbt = ChunkRegionLoader.a(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
use of net.minecraft.world.level.chunk.Chunk in project dynmap by webbukkit.
the class MapChunkCache117 method getLoadedChunk.
// Load generic chunk from existing and already loaded chunk
protected GenericChunk getLoadedChunk(DynmapChunk chunk) {
CraftWorld cw = (CraftWorld) w;
NBTTagCompound nbt = null;
GenericChunk gc = null;
if (cw.isChunkLoaded(chunk.x, chunk.z)) {
Chunk c = cw.getHandle().getChunkAt(chunk.x, chunk.z);
if ((c != null) && c.h) {
// c.loaded
nbt = ChunkRegionLoader.saveChunk(cw.getHandle(), c);
}
if (nbt != null) {
gc = parseChunkFromNBT(new NBT.NBTCompound(nbt));
}
}
return gc;
}
use of net.minecraft.world.level.chunk.Chunk in project WildChests by BG-Software-LLC.
the class NMSInventory_v1_17_R1 method updateTileEntity.
@Override
public void updateTileEntity(Chest chest) {
Location loc = chest.getLocation();
World world = ((CraftWorld) loc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ());
TileEntity tileEntity = world.getTileEntity(blockPosition);
TileEntityWildChest tileEntityWildChest;
if (tileEntity instanceof TileEntityWildChest) {
tileEntityWildChest = (TileEntityWildChest) tileEntity;
((WChest) chest).setTileEntityContainer(tileEntityWildChest);
} else {
tileEntityWildChest = new TileEntityWildChest(chest, world, blockPosition);
world.removeTileEntity(blockPosition);
world.setTileEntity(tileEntityWildChest);
Chunk chunk = world.getChunkAtWorldCoords(blockPosition);
world.a(CREATE_TICKING_BLOCK.invoke(chunk, tileEntityWildChest, tileEntityWildChest));
}
}
Aggregations