use of net.minecraft.server.v1_13_R1.World in project SSB-OneBlock by BG-Software-LLC.
the class NMSAdapter_v1_16_R3 method setChestName.
@Override
public void setChestName(Location chest, String name) {
assert chest.getWorld() != null;
World world = ((CraftWorld) chest.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(chest.getBlockX(), chest.getBlockY(), chest.getBlockZ());
TileEntityChest tileEntityChest = (TileEntityChest) world.getTileEntity(blockPosition);
assert tileEntityChest != null;
tileEntityChest.setCustomName(CraftChatMessage.fromString(name)[0]);
}
use of net.minecraft.server.v1_13_R1.World 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_13_R1.World in project Atlas by funkemunky.
the class BlockBox1_13_R1 method getCollisionBox.
@Override
public CollisionBox getCollisionBox(Block block) {
final net.minecraft.server.v1_13_R1.World world = ((org.bukkit.craftbukkit.v1_13_R1.CraftWorld) block.getWorld()).getHandle();
final int x = block.getX(), y = block.getY(), z = block.getZ();
net.minecraft.server.v1_13_R1.IBlockData iblockData = ((CraftBlock) block).getNMS();
net.minecraft.server.v1_13_R1.Block vblock = iblockData.getBlock();
BlockPosition blockPos = new BlockPosition(x, y, z);
VoxelShape shape = vblock.a(iblockData, (IBlockAccess) world, blockPos);
List<AxisAlignedBB> boxes = shape.d();
if (boxes.size() == 0) {
return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
} else if (boxes.size() == 1) {
AxisAlignedBB box = boxes.get(0);
return new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f);
} else {
ComplexCollisionBox complexBox = new ComplexCollisionBox();
for (AxisAlignedBB box : boxes) {
complexBox.add(new SimpleCollisionBox(box.a, box.b, box.c, box.d, box.e, box.f));
}
return complexBox;
}
}
use of net.minecraft.server.v1_13_R1.World in project Atlas by funkemunky.
the class BlockBox1_16_R3 method getCollisionBox.
@Override
public CollisionBox getCollisionBox(org.bukkit.block.Block block) {
final net.minecraft.server.v1_16_R3.World world = ((org.bukkit.craftbukkit.v1_16_R3.CraftWorld) block.getWorld()).getHandle();
final int x = block.getX(), y = block.getY(), z = block.getZ();
net.minecraft.server.v1_16_R3.IBlockData iblockData = ((CraftBlock) block).getNMS();
net.minecraft.server.v1_16_R3.Block vblock = iblockData.getBlock();
BlockPosition blockPos = new BlockPosition(x, y, z);
VoxelShape shape = vblock.a(iblockData, world, blockPos, VoxelShapeCollision.a());
List<AxisAlignedBB> boxes = shape.d();
if (boxes.size() == 0) {
return BlockData.getData(block.getType()).getBox(block, ProtocolVersion.getGameVersion());
} else if (boxes.size() == 1) {
AxisAlignedBB box = boxes.get(0);
return new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ);
} else {
ComplexCollisionBox complexBox = new ComplexCollisionBox();
for (AxisAlignedBB box : boxes) {
complexBox.add(new SimpleCollisionBox(box.minX, box.minY, box.minZ, box.maxX, box.maxY, box.maxZ));
}
return complexBox;
}
}
use of net.minecraft.server.v1_13_R1.World in project UltraCosmetics by iSach.
the class MorphElderGuardian method onEquip.
@Override
protected void onEquip() {
super.onEquip();
World world = ((CraftWorld) getPlayer().getWorld()).getHandle();
customGuardian = new CustomGuardian(EntityTypes.ELDER_GUARDIAN, world);
customEntities.add(customGuardian);
customGuardian.check();
Location location = getPlayer().getLocation();
double x = location.getX();
double y = location.getY();
double z = location.getZ();
customGuardian.setLocation(x, y, z, 0, 0);
EntitySpawningManager.setBypass(true);
world.addEntity(customGuardian);
EntitySpawningManager.setBypass(false);
getPlayer().setPassenger(customGuardian.getBukkitEntity());
customGuardian.setInvisible(true);
}
Aggregations