trapdoors cant be passed vertically in either state, thanks plutie

This commit is contained in:
Leijurv 2019-03-18 22:38:06 -07:00
parent bcd097c6cb
commit 49658078b9
No known key found for this signature in database
GPG Key ID: 44A3EA646EADAC6A

View File

@ -72,7 +72,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block == Blocks.AIR) { // early return for most common case
return true;
}
if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof BlockSkull) {
if (block == Blocks.FIRE || block == Blocks.TRIPWIRE || block == Blocks.WEB || block == Blocks.END_PORTAL || block == Blocks.COCOA || block instanceof BlockSkull || block instanceof BlockTrapDoor) {
return false;
}
if (block instanceof BlockDoor || block instanceof BlockFenceGate) {
@ -84,9 +84,7 @@ public interface MovementHelper extends ActionCosts, Helper {
if (block == Blocks.CARPET) {
return canWalkOn(bsi, x, y - 1, z);
}
boolean snow = block instanceof BlockSnow;
boolean trapdoor = block instanceof BlockTrapDoor;
if (snow || trapdoor) {
if (block instanceof BlockSnow) {
// we've already checked doors and fence gates
// so the only remaining dynamic isPassables are snow and trapdoor
// if they're cached as a top block, we don't know their metadata
@ -94,7 +92,6 @@ public interface MovementHelper extends ActionCosts, Helper {
if (!bsi.worldContainsLoadedChunk(x, z)) {
return true;
}
if (snow) {
// the check in BlockSnow.isPassable is layers < 5
// while actually, we want < 3 because 3 or greater makes it impassable in a 2 high ceiling
if (state.getValue(BlockSnow.LAYERS) >= 3) {
@ -103,11 +100,6 @@ public interface MovementHelper extends ActionCosts, Helper {
// ok, it's low enough we could walk through it, but is it supported?
return canWalkOn(bsi, x, y - 1, z);
}
if (trapdoor) {
return !state.getValue(BlockTrapDoor.OPEN); // see BlockTrapDoor.isPassable
}
throw new IllegalStateException();
}
if (isFlowing(x, y, z, state, bsi)) {
return false; // Don't walk through flowing liquids
}