More fixes to flight pathing:

PathNavigateFlying:
Flight pathing checks if it's stuck every 10 ticks now, and clears the path to be able to path again if so.

FlyPathFinder:
If a point on the path is air, the path finder checks if the NPC will run into any blocks above that point due to its height.
This commit is contained in:
Luis C.M committed 2022-05-14 01:52:20 -05:00
1 parent f9f73a75d2
commit 44459a23a7
2 files changed
+12 -2

No files matched your search

@@ -323,7 +323,17 @@ public class FlyPathFinder extends PathFinder
if(block == Blocks.air)
{
return 2;
boolean heightClear = true;
for (int currentY = blockY; currentY < Math.ceil(blockY + entity.height); ++currentY) {
Block b = entity.worldObj.getBlock(l, currentY, j1);
if (b != Blocks.air) {
heightClear = false;
break;
}
}
if (heightClear) {
return 2;
}
}
if (block == Blocks.trapdoor)
@@ -261,7 +261,7 @@ public class PathNavigateFlying extends PathNavigate {
}
}
if (this.totalTicks - this.ticksAtLastPos > 50)
if (this.totalTicks - this.ticksAtLastPos > 10)
{
if (vec3.squareDistanceTo(this.lastPosCheck) < 2.25D)
{