Skip to content

Commit

Permalink
Null check 1.8.8 getCollisionBox
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Dec 19, 2021
1 parent 13f7961 commit da71b8d
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
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());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}

private float getDragonYaw(Entity handle, double tX, double tZ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
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());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}

private float getDragonYaw(Entity handle, double tX, double tZ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
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());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.getBoundingBox());
}

private float getDragonYaw(Entity handle, double tX, double tZ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
ServerLevel 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.bounds());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.bounds());
}

private float getDragonYaw(Entity handle, double tX, double tZ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public BoundingBox getBoundingBox(org.bukkit.entity.Entity handle) {
public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
ServerLevel 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.bounds());
return shape.isEmpty() ? BoundingBox.EMPTY : NMSBoundingBox.wrap(shape.bounds());
}

private float getDragonYaw(Entity handle, double tX, double tZ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public BoundingBox getCollisionBox(org.bukkit.block.Block block) {
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 new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
return aabb == null ? BoundingBox.EMPTY : new BoundingBox(aabb.a, aabb.b, aabb.c, aabb.d, aabb.e, aabb.f);
}

private float getDragonYaw(Entity handle, double tX, double tZ) {
Expand Down

0 comments on commit da71b8d

Please sign in to comment.