Add a material to check if air is air, because there are now 3 types of air.

This commit is contained in:
Matthew Miller
2018-08-16 15:42:11 +10:00
parent c31161d068
commit bc5609114b
22 changed files with 65 additions and 33 deletions

View File

@ -60,6 +60,11 @@ public class BukkitBlockRegistry extends BundledBlockRegistry {
this.material = bukkitMaterial;
}
@Override
public boolean isAir() {
return material == Material.AIR || material == Material.CAVE_AIR || material == Material.VOID_AIR;
}
@Override
public boolean isSolid() {
return material.isSolid();

View File

@ -64,7 +64,7 @@ public class BukkitPlayerBlockBag extends BlockBag {
@Override
public void fetchBlock(BlockState blockState) throws BlockBagException {
if (blockState.getBlockType() == BlockTypes.AIR) {
if (blockState.getBlockType().getMaterial().isAir()) {
throw new IllegalArgumentException("Can't fetch air block");
}
@ -108,7 +108,7 @@ public class BukkitPlayerBlockBag extends BlockBag {
@Override
public void storeBlock(BlockState blockState, int amount) throws BlockBagException {
if (blockState.getBlockType() == BlockTypes.AIR) {
if (blockState.getBlockType().getMaterial().isAir()) {
throw new IllegalArgumentException("Can't store air block");
}
if (!blockState.getBlockType().hasItemType()) {

View File

@ -59,7 +59,7 @@ public class EditSessionBlockChangeDelegate implements BlockChangeDelegate {
@Override
public boolean isEmpty(int x, int y, int z) {
return editSession.getBlock(new Vector(x, y, z)).getBlockType() == BlockTypes.AIR;
return editSession.getBlock(new Vector(x, y, z)).getBlockType().getMaterial().isAir();
}
}