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

@ -24,6 +24,13 @@ package com.sk89q.worldedit.world.registry;
*/
public interface BlockMaterial {
/**
* Gets if this block is a type of air.
*
* @return If it's air
*/
boolean isAir();
/**
* Get whether this block is a full sized cube.
*

View File

@ -29,6 +29,15 @@ public class PassthroughBlockMaterial implements BlockMaterial {
this.blockMaterial = material;
}
@Override
public boolean isAir() {
if (blockMaterial == null) {
return false;
} else {
return blockMaterial.isAir();
}
}
@Override
public boolean isFullCube() {
if (blockMaterial == null) {

View File

@ -21,6 +21,7 @@ package com.sk89q.worldedit.world.registry;
class SimpleBlockMaterial implements BlockMaterial {
private boolean isAir;
private boolean fullCube;
private boolean opaque;
private boolean powerSource;
@ -40,6 +41,15 @@ class SimpleBlockMaterial implements BlockMaterial {
private boolean isTranslucent;
private boolean hasContainer;
@Override
public boolean isAir() {
return this.isAir;
}
public void setIsAir(boolean isAir) {
this.isAir = isAir;
}
@Override
public boolean isFullCube() {
return fullCube;