mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Climbable trapdoors if connected to a ladder.
### Previous Behavior Trapdoors still has collision even if opened, making it difficult to climb with. ### New Behavior - Added a new condition in `LivingEntity::onLadder()` in case it's a trapdoor, then return as true (as if its a ladder). - If there's a ladder under the (opened) trapdoor, then its collision box returns as a nullptr. **Files:** - `LivingEntity.cpp` - `TrapDoorTile.cpp` **Methods:** - `LivingEntity::onLadder()` - `TrapDoorTile::getAABB(Level *level, int x, int y, int z)`
This commit is contained in:
parent
a94ee1ca22
commit
9125d3f06d
|
|
@ -986,9 +986,30 @@ 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
|
||||
{
|
||||
int data = level->getData(xt, yt, zt);
|
||||
bool isOpen = (data & 0x4) != 0;
|
||||
if (isOpen)
|
||||
{
|
||||
int belowTile = level->getTile(xt, yt - 1, zt);
|
||||
if (belowTile == Tile::ladder_Id)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool LivingEntity::isShootable()
|
||||
|
|
|
|||
|
|
@ -50,6 +50,18 @@ 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);
|
||||
bool isOpen = (data & 0x4) != 0;
|
||||
|
||||
if (isOpen)
|
||||
{
|
||||
int belowTile = level->getTile(x, y - 1, z);
|
||||
if (belowTile == Tile::ladder_Id)
|
||||
{
|
||||
return nullptr; // No collision when open above ladder
|
||||
}
|
||||
}
|
||||
// Default behaviour
|
||||
updateShape(level, x, y, z);
|
||||
return Tile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue