Put Material.isTransparent into a method for later distinction.

This commit is contained in:
asofold 2018-08-13 09:23:51 +02:00
parent 56dbc7f21d
commit 82f50dda71
2 changed files with 17 additions and 5 deletions

View File

@ -47,10 +47,10 @@ public class MCAccessBukkit extends MCAccessBukkitBase implements BlockPropertie
if (!mat.isBlock()) {
continue;
}
if (fullBlocks.contains(mat)) {
else if (fullBlocks.contains(mat)) {
continue;
}
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()) {
else if (guessItchyBlock(mat)) {
// Uncertain bounding-box, allow passing through.
long flags = BlockProperties.F_IGN_PASSABLE;
if ((BlockProperties.isSolid(mat) || BlockProperties.isGround(mat)) && !BlockProperties.isLiquid(mat)) {

View File

@ -40,14 +40,26 @@ public class MCAccessBukkitBase implements MCAccess {
// private AlmostBoolean entityPlayerAvailable = AlmostBoolean.MAYBE;
protected final boolean bukkitHasGetHeightAndGetWidth;
private boolean guessItchyBlockPre1_13(final Material mat) {
return !mat.isOccluding() || !mat.isSolid() || mat.isTransparent();
}
protected boolean guessItchyBlock(final Material mat) {
// TODO: Use working route.
return guessItchyBlockPre1_13(mat);
}
private void testItchyBlock() {
// TODO: Route to what works.
guessItchyBlockPre1_13(Material.AIR);
}
/**
* Constructor to let it fail.
*/
public MCAccessBukkitBase() {
// TODO: Add more that might fail if not supported ?
Material.AIR.isSolid();
Material.AIR.isOccluding();
Material.AIR.isTransparent();
testItchyBlock();
// TODO: Deactivate checks that might not work. => MCAccess should have availability method, NCP deactivates check on base of that.
// TODO: Move getHeight and the like to EntityAccessXY.
bukkitHasGetHeightAndGetWidth = ReflectionUtil.getMethodNoArgs(Entity.class, "getHeight", double.class) != null