mirror of
https://github.com/NoCheatPlus/NoCheatPlus.git
synced 2024-11-15 23:05:12 +01:00
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()) {
|
||||
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)) {
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user