mirror of
https://github.com/smartcmd/MinecraftConsoles.git
synced 2026-08-20 09:57:09 +00:00
Moved updateShape before the checks
The same result but neglecting the update tick could make weird effects.
This commit is contained in:
parent
af7fe090f2
commit
687c9624fe
|
|
@ -50,6 +50,7 @@ AABB *TrapDoorTile::getTileAABB(Level *level, int x, int y, int z)
|
|||
|
||||
AABB *TrapDoorTile::getAABB(Level *level, int x, int y, int z)
|
||||
{
|
||||
updateShape(level, x, y, z);
|
||||
int data = level->getData(x, y, z);
|
||||
if (isOpen(data))
|
||||
{
|
||||
|
|
@ -63,17 +64,18 @@ AABB *TrapDoorTile::getAABB(Level *level, int x, int y, int z)
|
|||
|
||||
if (level->getTile(x, y - 1, z) == Tile::ladder_Id && attachesTo(level->getTile(xt, y, zt)))
|
||||
{
|
||||
float r = 2 / 16.0f; // From LadderTile
|
||||
float r = 2 / 16.0f;
|
||||
|
||||
// Using only newTemp from AABB to just manipulate collision to our liking
|
||||
// I tried looking at AABB.cpp more but couldn't find any helper methods to make this more readable.
|
||||
// Though, I can just make new helpers but kinda scared because its not within the contributing scope.
|
||||
// SO IF ITS NOT ALLOWED, GOODLUCK UNDERSTANDING.
|
||||
if (dir == 0) return AABB::newTemp(x, y, z + 1 - r, x + 1, y + 1, z + 1);
|
||||
if (dir == 1) return AABB::newTemp(x, y, z, x + 1, y + 1, z + r);
|
||||
if (dir == 2) return AABB::newTemp(x + 1 - r, y, z, x + 1, y + 1, z + 1);
|
||||
if (dir == 3) return AABB::newTemp(x, y, z, x + r, y + 1, z + 1);
|
||||
}
|
||||
}
|
||||
// Default behaviour
|
||||
updateShape(level, x, y, z);
|
||||
return Tile::getAABB(level, x, y, z);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue