use of net.minecraft.server.v1_13_R1.VoxelShape in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public static double a(IBlockAccess var0, BlockPosition var1) {
BlockPosition var2 = var1.down();
VoxelShape var3 = var0.getType(var2).getCollisionShape(var0, var2);
return var2.getY() + (var3.isEmpty() ? 0.0D : var3.c(EnumAxis.Y));
}
use of net.minecraft.server.v1_13_R1.VoxelShape in project Atlas by funkemunky.
the class BlockBox1_13_R2 method getCollisionBox.
@Override
public CollisionBox getCollisionBox(Block block) {
final net.minecraft.server.v1_13_R2.World world = ((org.bukkit.craftbukkit.v1_13_R2.CraftWorld) block.getWorld()).getHandle();
final int x = block.getX(), y = block.getY(), z = block.getZ();
net.minecraft.server.v1_13_R2.IBlockData iblockData = ((CraftBlock) block).getNMS();
net.minecraft.server.v1_13_R2.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.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.VoxelShape in project Citizens2 by CitizensDev.
the class NMSImpl method getCollisionBox.
@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
VoxelShape shape = ((CraftBlock) block).getNMS().getCollisionShape(world, ((CraftBlock) block).getPosition());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}
use of net.minecraft.server.v1_13_R1.VoxelShape in project Citizens2 by CitizensDev.
the class PlayerPathfinderNormal method a.
public static double a(IBlockAccess var0, BlockPosition var1) {
BlockPosition var2 = var1.down();
VoxelShape var3 = var0.getType(var2).getCollisionShape(var0, var2);
return var2.getY() + (var3.isEmpty() ? 0.0D : var3.c(EnumAxis.Y));
}
use of net.minecraft.server.v1_13_R1.VoxelShape in project Citizens2 by CitizensDev.
the class NMSImpl method getCollisionBox.
@Override
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
WorldServer world = ((CraftWorld) block.getWorld()).getHandle();
VoxelShape shape = ((CraftBlock) block).getNMS().getCollisionShape(world, ((CraftBlock) block).getPosition());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}
Aggregations