Fixed strange flight behavior in flying NPCs with sizes below 5.

This commit is contained in:
Luis C.M committed 2022-11-07 13:32:31 -06:00
1 parent a1eb8ff91b
commit 219d0f1802
2 files changed
+3 -3

No files matched your search

@@ -305,8 +305,8 @@ public class PathNavigateFlying extends PathNavigate {
}
}
k = MathHelper.ceiling_float_int(this.theEntity.width);
int l = (int)this.theEntity.height + 1;
k = MathHelper.floor_double(this.theEntity.width + 1.0F);
int l = MathHelper.floor_double(this.theEntity.height + 1.0F);
int i1 = k;
for (int j1 = i - 1; j1 >= this.currentPath.getCurrentPathIndex(); --j1)
@@ -41,7 +41,7 @@ public abstract class EntityNPCFlying extends EntityNPCInterface {
}
double heightOffGround = this.posY - this.worldObj.getTopSolidOrLiquidBlock((int) this.posX, (int) this.posZ);
if (heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit || (heightOffGround < this.height && this.motionY == 0)) {
if (heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit || (heightOffGround < Math.ceil(this.height) && this.motionY == 0)) {
this.flyLimitAllow = false;
if (!this.getNavigator().noPath() && this.motionY > 0) {
this.motionY = 0;