use of net.minecraft.server.v1_15_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.
the class BlockData_v1_11_R1 method setBlock.
public void setBlock(Block block) {
block.setTypeIdAndData(material.getId(), (byte) data, false);
if (ctag != null) {
CompoundTagBuilder builder = ctag.createBuilder();
builder.putInt("x", block.getX());
builder.putInt("y", block.getY());
builder.putInt("z", block.getZ());
ctag = (CompoundTag_v1_11_R1) builder.build();
// TODO: make this work!
BlockPosition blockPos = new BlockPosition(block.getX(), block.getY(), block.getZ());
TileEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(blockPos);
te.a(ctag.toNMSTag());
}
}
use of net.minecraft.server.v1_15_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelper_v1_8_R3 method setNbtData.
@Override
public void setNbtData(Block block, CompoundTag compoundTag) {
TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
if (tileEntity == null) {
return;
}
tileEntity.a(((CompoundTag_v1_8_R3) compoundTag).toNMSTag());
tileEntity.update();
}
use of net.minecraft.server.v1_15_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.
the class BlockHelper_v1_9_R2 method setNbtData.
@Override
public void setNbtData(Block block, CompoundTag compoundTag) {
TileEntity tileEntity = ((CraftBlockState) block.getState()).getTileEntity();
if (tileEntity == null) {
return;
}
tileEntity.a(((CompoundTag_v1_9_R2) compoundTag).toNMSTag());
tileEntity.update();
}
use of net.minecraft.server.v1_15_R1.TileEntity in project Denizen-For-Bukkit by DenizenScript.
the class BlockData_v1_8_R3 method setBlock.
public void setBlock(Block block) {
block.setTypeIdAndData(material.getId(), (byte) data, false);
if (ctag != null) {
CompoundTagBuilder builder = ctag.createBuilder();
builder.putInt("x", block.getX());
builder.putInt("y", block.getY());
builder.putInt("z", block.getZ());
ctag = (CompoundTag_v1_8_R3) builder.build();
// TODO: make this work!
BlockPosition blockPos = new BlockPosition(block.getX(), block.getY(), block.getZ());
TileEntity te = ((CraftWorld) block.getWorld()).getHandle().getTileEntity(blockPos);
te.a(ctag.toNMSTag());
}
}
use of net.minecraft.server.v1_15_R1.TileEntity in project WildLoaders by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method removeLoader.
@Override
public void removeLoader(ChunkLoader chunkLoader, boolean spawnParticle) {
Location loaderLoc = chunkLoader.getLocation();
assert loaderLoc.getWorld() != null;
WorldServer world = ((CraftWorld) loaderLoc.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(loaderLoc.getX(), loaderLoc.getY(), loaderLoc.getZ());
long tileEntityLong = ChunkCoordIntPair.pair(blockPosition.getX() >> 4, blockPosition.getZ() >> 4);
TileEntityChunkLoader tileEntityChunkLoader = TileEntityChunkLoader.tileEntityChunkLoaderMap.remove(tileEntityLong);
if (tileEntityChunkLoader != null) {
tileEntityChunkLoader.holograms.forEach(EntityHolograms_v1_16_R3::removeHologram);
tileEntityChunkLoader.removed = true;
world.tileEntityListTick.remove(tileEntityChunkLoader);
}
if (spawnParticle)
world.a(null, 2001, blockPosition, Block.getCombinedId(world.getType(blockPosition)));
for (org.bukkit.Chunk bukkitChunk : chunkLoader.getLoadedChunks()) {
Chunk chunk = ((CraftChunk) bukkitChunk).getHandle();
chunk.tileEntities.values().stream().filter(tileEntity -> tileEntity instanceof TileEntityMobSpawner).forEach(tileEntity -> ((TileEntityMobSpawner) tileEntity).getSpawner().requiredPlayerRange = 16);
world.setForceLoaded(chunk.getPos().x, chunk.getPos().z, false);
}
}
Aggregations