Added a check above the trapdoor.

Made so that it avoids alternating use of ladders (or vines) and trapdoors.
This commit is contained in:
disintegrate 2026-03-18 11:45:44 +08:00
parent 9125d3f06d
commit 9983a74198

View file

@ -998,10 +998,15 @@ bool LivingEntity::onLadder()
bool isOpen = (data & 0x4) != 0;
if (isOpen)
{
int aboveTile = level->getTile(xt, yt + 1, zt);
int belowTile = level->getTile(xt, yt - 1, zt);
if (belowTile == Tile::ladder_Id)
switch (aboveTile)
{
return true;
case Tile::ladder_Id:
case Tile::vine_Id:
return false; // Opened trapdoor should only be climbable when it's only at the top.
default:
return belowTile == Tile::ladder_Id;
}
}
break;