use of net.minecraft.server.v1_9_R2.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB3026 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R2.Block block = net.minecraft.server.v1_7_R2.Block.e(id);
if (block == null)
return null;
// getData from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
use of net.minecraft.server.v1_9_R2.Block in project NoCheatPlus by NoCheatPlus.
the class BlockCacheCB3043 method fetchBounds.
@Override
public double[] fetchBounds(final int x, final int y, final int z) {
// TODO: change api for this / use nodes (!)
@SuppressWarnings("deprecation") final int id = getType(x, y, z).getId();
final net.minecraft.server.v1_7_R3.Block block = net.minecraft.server.v1_7_R3.Block.e(id);
if (block == null)
return null;
// getData from cache.
block.updateShape(iBlockAccess, x, y, z);
// minX, minY, minZ, maxX, maxY, maxZ
return new double[] { block.x(), block.z(), block.B(), block.y(), block.A(), block.C() };
}
use of net.minecraft.server.v1_9_R2.Block in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_12_R1 method setBlock.
@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
assert location.getWorld() != null;
World worldServer = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
worldServer.s(blockPosition);
org.bukkit.block.Block bukkitBlock = location.getBlock();
bukkitBlock.setType(type);
if (data > 0)
// noinspection deprecation
bukkitBlock.setData(data);
if (nbt != null) {
try {
Block block = worldServer.getType(blockPosition).getBlock();
IBlockData blockData = CommandAbstract.a(block, nbt);
worldServer.setTypeAndData(blockPosition, blockData, 2);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
use of net.minecraft.server.v1_9_R2.Block in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_8_R3 method setBlock.
@Override
public void setBlock(Location location, Material type, byte data, String nbt) {
assert location.getWorld() != null;
World worldServer = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
worldServer.t(blockPosition);
org.bukkit.block.Block bukkitBlock = location.getBlock();
bukkitBlock.setType(type);
if (data > 0)
// noinspection deprecation
bukkitBlock.setData(data);
if (nbt != null) {
try {
Block block = worldServer.getType(blockPosition).getBlock();
IBlockData blockData = block.fromLegacyData(CommandAbstract.a(nbt, 0, 15));
worldServer.setTypeAndData(blockPosition, blockData, 2);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
use of net.minecraft.server.v1_9_R2.Block in project Citizens2 by CitizensDev.
the class FallingBlockController method createEntity.
@Override
protected Entity createEntity(Location at, NPC npc) {
WorldServer ws = ((CraftWorld) at.getWorld()).getHandle();
Block id = Blocks.STONE;
int data = npc.data().get(NPC.ITEM_DATA_METADATA, npc.data().get("falling-block-data", 0));
if (npc.data().has("falling-block-id") || npc.data().has(NPC.ITEM_ID_METADATA)) {
id = CraftMagicNumbers.getBlock(Material.getMaterial(npc.data().<String>get(NPC.ITEM_ID_METADATA, npc.data().<String>get("falling-block-id"))));
}
final EntityFallingBlockNPC handle = new EntityFallingBlockNPC(ws, npc, at.getX(), at.getY(), at.getZ(), id.fromLegacyData(data));
return handle.getBukkitEntity();
}
Aggregations