Improvements

* Use new ZYX Loops order in LevelRenderer::allChanged
* Revert xt, yt, zt change in PathFinder
* Fix return in PathFinder
This commit is contained in:
GabsPuNs
2026-05-17 14:48:58 -04:00
parent 83c7d9dfd9
commit 5696074313
2 changed files with 28 additions and 31 deletions

View File

@@ -211,10 +211,6 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo
{
bool walkable = false;
int xt = Mth::floor(entity->x);
int yt = Mth::floor(entity->y);
int zt = Mth::floor(entity->z);
//Use 4J XZY Loops order instead of Mojang XYZ Loops orders
for (int xx = x; xx < x + size->x; xx++)
{
@@ -246,6 +242,10 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo
// 4J Stu - Use new getTileRenderShape passing in the tileId we have already got
if (entity->level->getTileRenderShape(tileId) == Tile::SHAPE_RAIL)
{
int xt = Mth::floor(entity->x);
int yt = Mth::floor(entity->y);
int zt = Mth::floor(entity->z);
if (entity->level->getTileRenderShape(xt, yt, zt) == Tile::SHAPE_RAIL
|| entity->level->getTileRenderShape(xt, yt - 1, zt) == Tile::SHAPE_RAIL)
{
@@ -279,9 +279,9 @@ int PathFinder::isFree(Entity *entity, int x, int y, int z, Node *size, bool avo
return TYPE_BLOCKED;
}
}
return walkable ? TYPE_WALKABLE : TYPE_OPEN;
}
return walkable ? TYPE_WALKABLE : TYPE_OPEN;
}
// function reconstruct_path(came_from,current_node)