diff --git a/Minecraft.World/LivingEntity.cpp b/Minecraft.World/LivingEntity.cpp index 3af9efe962..7876e88c40 100644 --- a/Minecraft.World/LivingEntity.cpp +++ b/Minecraft.World/LivingEntity.cpp @@ -986,9 +986,31 @@ bool LivingEntity::onLadder() int yt = Mth::floor(bb->y0); int zt = Mth::floor(z); - // 4J-PB - TU9 - add climbable vines int iTile = level->getTile(xt, yt, zt); - return (iTile== Tile::ladder_Id) || (iTile== Tile::vine_Id); + switch (iTile) + { + case Tile::ladder_Id: + case Tile::vine_Id: // 4J-PB - TU9 - add climbable vines + return true; + case Tile::trapdoor_Id: // hexagonny - add climbable (opened) trapdoors + { + if ((level->getData(xt, yt, zt) & 0x4) != 0) + { + switch (level->getTile(xt, yt + 1, zt)) + { + 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 level->getTile(xt, yt - 1, zt) == Tile::ladder_Id; + } + } + break; + } + default: + break; + } + return false; } bool LivingEntity::isShootable() diff --git a/Minecraft.World/TrapDoorTile.cpp b/Minecraft.World/TrapDoorTile.cpp index 6ea64172ee..173435b84c 100644 --- a/Minecraft.World/TrapDoorTile.cpp +++ b/Minecraft.World/TrapDoorTile.cpp @@ -50,6 +50,21 @@ AABB *TrapDoorTile::getTileAABB(Level *level, int x, int y, int z) AABB *TrapDoorTile::getAABB(Level *level, int x, int y, int z) { + int data = level->getData(x, y, z); + if (isOpen(data)) + { + int xt = x, zt = z; + if ((data & 3) == 0) zt++; + if ((data & 3) == 1) zt--; + if ((data & 3) == 2) xt++; + if ((data & 3) == 3) xt--; + + if (level->getTile(x, y - 1, z) == Tile::ladder_Id && attachesTo(level->getTile(xt, y, zt))) + { + return nullptr; // No collision when open above ladder (add is attached to a block) + } + } + // Default behaviour updateShape(level, x, y, z); return Tile::getAABB(level, x, y, z); }