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

@ -37,7 +37,7 @@ public abstract class BlockBag {
public void storeDroppedBlock(BlockState blockState) throws BlockBagException {
BlockState dropped = blockState; // TODO BlockType.getBlockBagItem(id, data);
if (dropped == null) return;
if (dropped.getBlockType() == BlockTypes.AIR) return;
if (dropped.getBlockType().getMaterial().isAir()) return;
storeBlock(dropped);
}
@ -57,7 +57,7 @@ public abstract class BlockBag {
fetchBlock(blockState);
} catch (OutOfBlocksException e) {
BlockState placed = blockState;// TODO BlockType.getBlockBagItem(id, data);
if (placed == null || placed.getBlockType() == BlockTypes.AIR) throw e; // TODO: check
if (placed == null || placed.getBlockType().getMaterial().isAir()) throw e; // TODO: check
fetchBlock(placed);
}

View File

@ -87,7 +87,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
if (blockBag != null) {
BlockState existing = getExtent().getBlock(position);
if (block.getBlockType() != BlockTypes.AIR) {
if (!block.getBlockType().getMaterial().isAir()) {
try {
blockBag.fetchPlacedBlock(block.toImmutableState());
} catch (UnplaceableBlockException e) {
@ -102,7 +102,7 @@ public class BlockBagExtent extends AbstractDelegateExtent {
}
}
if (existing.getBlockType() != BlockTypes.AIR) {
if (!existing.getBlockType().getMaterial().isAir()) {
try {
blockBag.storeDroppedBlock(existing);
} catch (BlockBagException ignored) {

View File

@ -81,7 +81,7 @@ public class SurvivalModeExtent extends AbstractDelegateExtent {
@Override
public boolean setBlock(Vector location, BlockStateHolder block) throws WorldEditException {
if (toolUse && block.getBlockType() == BlockTypes.AIR) {
if (toolUse && block.getBlockType().getMaterial().isAir()) {
world.simulateBlockMine(location);
return true;
} else {