use of net.minecraft.server.v1_9_R2.Block in project MechanicsMain by WeaponMechanics.
the class v1_11_R1 method getHitBox.
@Override
public HitBox getHitBox(org.bukkit.block.Block block) {
if (block.isEmpty() || block.isLiquid())
return null;
WorldServer worldServer = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(block.getX(), block.getY(), block.getZ());
IBlockData blockData = worldServer.getType(blockPosition);
Block nmsBlock = blockData.getBlock();
// Passable block check -> false means passable (thats why !)
if (!(blockData.d(worldServer, blockPosition) != Block.k && nmsBlock.a(blockData, false)))
return null;
AxisAlignedBB aabb = blockData.d(worldServer, blockPosition);
// 1.12 -> e
// 1.11 -> d
// 1.9 - 1.10 -> c
int x = blockPosition.getX(), y = blockPosition.getY(), z = blockPosition.getZ();
HitBox hitBox = new HitBox(x + aabb.a, y + aabb.b, z + aabb.c, x + aabb.d, y + aabb.e, z + aabb.f);
hitBox.setBlockHitBox(block);
return hitBox;
}
use of net.minecraft.server.v1_9_R2.Block in project MechanicsMain by WeaponMechanics.
the class v1_12_R1 method getHitBox.
@Override
public HitBox getHitBox(org.bukkit.block.Block block) {
if (block.isEmpty() || block.isLiquid())
return null;
WorldServer worldServer = ((CraftWorld) block.getWorld()).getHandle();
BlockPosition blockPosition = new BlockPosition(block.getX(), block.getY(), block.getZ());
IBlockData blockData = worldServer.getType(blockPosition);
Block nmsBlock = blockData.getBlock();
// Passable block check -> false means passable (thats why !)
if (!(blockData.d(worldServer, blockPosition) != Block.k && nmsBlock.a(blockData, false)))
return null;
AxisAlignedBB aabb = blockData.e(worldServer, blockPosition);
// 1.12 -> e
// 1.11 -> d
// 1.9 - 1.10 -> c
int x = blockPosition.getX(), y = blockPosition.getY(), z = blockPosition.getZ();
HitBox hitBox = new HitBox(x + aabb.a, y + aabb.b, z + aabb.c, x + aabb.d, y + aabb.e, z + aabb.f);
hitBox.setBlockHitBox(block);
return hitBox;
}
Aggregations