Put Material.isTransparent into a method for later distinction.
This commit is contained in:
parent
56dbc7f21d
commit
82f50dda71
|
@ -47,10 +47,10 @@ public class MCAccessBukkit extends MCAccessBukkitBase implements BlockPropertie
|
||||||
if (!mat.isBlock()) {
|
if (!mat.isBlock()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (fullBlocks.contains(mat)) {
|
else if (fullBlocks.contains(mat)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!mat.isOccluding() || !mat.isSolid() || mat.isTransparent()) {
|
else if (guessItchyBlock(mat)) {
|
||||||
// Uncertain bounding-box, allow passing through.
|
// Uncertain bounding-box, allow passing through.
|
||||||
long flags = BlockProperties.F_IGN_PASSABLE;
|
long flags = BlockProperties.F_IGN_PASSABLE;
|
||||||
if ((BlockProperties.isSolid(mat) || BlockProperties.isGround(mat)) && !BlockProperties.isLiquid(mat)) {
|
if ((BlockProperties.isSolid(mat) || BlockProperties.isGround(mat)) && !BlockProperties.isLiquid(mat)) {
|
||||||
|
|
|
@ -40,14 +40,26 @@ public class MCAccessBukkitBase implements MCAccess {
|
||||||
// private AlmostBoolean entityPlayerAvailable = AlmostBoolean.MAYBE;
|
// private AlmostBoolean entityPlayerAvailable = AlmostBoolean.MAYBE;
|
||||||
protected final boolean bukkitHasGetHeightAndGetWidth;
|
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.
|
* Constructor to let it fail.
|
||||||
*/
|
*/
|
||||||
public MCAccessBukkitBase() {
|
public MCAccessBukkitBase() {
|
||||||
// TODO: Add more that might fail if not supported ?
|
// TODO: Add more that might fail if not supported ?
|
||||||
Material.AIR.isSolid();
|
testItchyBlock();
|
||||||
Material.AIR.isOccluding();
|
|
||||||
Material.AIR.isTransparent();
|
|
||||||
// TODO: Deactivate checks that might not work. => MCAccess should have availability method, NCP deactivates check on base of that.
|
// 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.
|
// TODO: Move getHeight and the like to EntityAccessXY.
|
||||||
bukkitHasGetHeightAndGetWidth = ReflectionUtil.getMethodNoArgs(Entity.class, "getHeight", double.class) != null
|
bukkitHasGetHeightAndGetWidth = ReflectionUtil.getMethodNoArgs(Entity.class, "getHeight", double.class) != null
|
||||||
|
|
Loading…
Reference in New Issue