use of net.citizensnpcs.api.util.BoundingBox 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();
Block type = CraftMagicNumbers.getBlock(block);
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
AxisAlignedBB aabb = type.a(world, pos, world.getType(pos));
return aabb == null ? BoundingBox.EMPTY : new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
}
use of net.citizensnpcs.api.util.BoundingBox in project Citizens2 by CitizensDev.
the class BoundingBoxExaminer method isPassable.
@Override
public PassableState isPassable(BlockSource source, PathPoint point) {
Vector pos = point.getVector();
Material up = source.getMaterialAt(pos.getBlockX(), pos.getBlockY() + 2, pos.getBlockZ());
Material down = source.getMaterialAt(pos.getBlockX(), pos.getBlockY() - 1, pos.getBlockZ());
if (!MinecraftBlockExaminer.canStandIn(up) && MinecraftBlockExaminer.canStandOn(down)) {
BoundingBox above = source.getCollisionBox(pos.getBlockX(), pos.getBlockY() + 2, pos.getBlockZ());
BoundingBox below = source.getCollisionBox(pos.getBlockX(), pos.getBlockY() - 1, pos.getBlockZ());
float height = (float) (above.minY - below.maxY);
if (height < this.height) {
return PassableState.UNPASSABLE;
}
}
return PassableState.IGNORE;
}
use of net.citizensnpcs.api.util.BoundingBox 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() ? new BoundingBox(0, 0, 0, 0, 0, 0) : NMSBoundingBox.wrap(shape.getBoundingBox());
}
use of net.citizensnpcs.api.util.BoundingBox 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();
BlockPosition pos = new BlockPosition(block.getX(), block.getY(), block.getZ());
AxisAlignedBB aabb = world.getType(pos).c(world, pos);
if (aabb == null) {
aabb = world.getType(pos).d(world, pos);
}
return new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
}
use of net.citizensnpcs.api.util.BoundingBox in project Citizens2 by CitizensDev.
the class NMSImpl method setSize.
public static void setSize(Entity entity, float f, float f1, boolean justCreated) {
if ((f != entity.width) || (f1 != entity.length)) {
float f2 = entity.width;
entity.width = f;
entity.length = f1;
BoundingBox bb = NMSBoundingBox.wrap(entity.getBoundingBox());
entity.a(new AxisAlignedBB(bb.minX, bb.minY, bb.minZ, bb.minX + entity.width, bb.minY + entity.length, bb.minZ + entity.width));
if ((entity.width > f2) && (!justCreated) && (!entity.world.isClientSide))
entity.move(EnumMoveType.SELF, (f2 - entity.width) / 2, 0.0D, (f2 - entity.width) / 2);
}
}
Aggregations