use of net.minecraft.server.v1_16_R3.ArgumentBlock in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_15_R1 method setBlock.
@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
assert location.getWorld() != null;
WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
worldServer.removeTileEntity(blockPosition);
location.getBlock().setType(type);
if (nbt != null) {
try {
ArgumentBlock argumentBlock = new ArgumentBlock(new StringReader(nbt), false).a(true);
ArgumentTileLocation tileLocation = new ArgumentTileLocation(argumentBlock.getBlockData(), argumentBlock.getStateMap().keySet(), argumentBlock.c());
tileLocation.a(worldServer, blockPosition, 2);
worldServer.update(blockPosition, tileLocation.a().getBlock());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
use of net.minecraft.server.v1_16_R3.ArgumentBlock in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method setBlock.
@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
assert location.getWorld() != null;
WorldServer worldServer = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
worldServer.removeTileEntity(blockPosition);
location.getBlock().setType(type);
if (nbt != null) {
try {
ArgumentBlock argumentBlock = new ArgumentBlock(new StringReader(nbt), false).a(true);
ArgumentTileLocation tileLocation = new ArgumentTileLocation(argumentBlock.getBlockData(), argumentBlock.getStateMap().keySet(), argumentBlock.c());
tileLocation.a(worldServer, blockPosition, 2);
worldServer.update(blockPosition, tileLocation.a().getBlock());
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Aggregations