From 219d0f180201675da3413f46cbfee232fe037024 Mon Sep 17 00:00:00 2001 From: "Luis C.M" <42545778+c0508383@users.noreply.github.com> Date: Mon, 7 Nov 2022 13:32:31 -0600 Subject: [PATCH] Fixed strange flight behavior in flying NPCs with sizes below 5. --- .../java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java | 4 ++-- src/main/java/noppes/npcs/entity/EntityNPCFlying.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java b/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java index d8e1c3a0a..9e2652bdb 100644 --- a/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java +++ b/src/main/java/noppes/npcs/ai/pathfinder/PathNavigateFlying.java @@ -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) diff --git a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java index dcadb4d1e..0d50392aa 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java @@ -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;