From 65ab37158ff2dc25dd94932b1511dd03cd2cf46a Mon Sep 17 00:00:00 2001 From: luisc Date: Sun, 27 Feb 2022 23:23:41 -0600 Subject: [PATCH] Fixed flying limits not working on flying NPCs with the new smoother flight --- .../noppes/npcs/entity/EntityNPCFlying.java | 23 ++++++++++--------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java index d57d89b4f..e588e2f93 100644 --- a/src/main/java/noppes/npcs/entity/EntityNPCFlying.java +++ b/src/main/java/noppes/npcs/entity/EntityNPCFlying.java @@ -48,18 +48,19 @@ public abstract class EntityNPCFlying extends EntityNPCInterface { } } + if(heightOffGround > this.ai.flyHeightLimit && this.ai.hasFlyLimit){ + super.moveEntityWithHeading(p_70612_1_,p_70612_2_); + return; + } + + double d3 = this.motionY; + super.moveEntityWithHeading(p_70612_1_, p_70612_2_); + this.motionY = d3; + + this.fallDistance = 0.0F; + this.velocityChanged = true; + if(this.getNavigator().noPath()) this.motionY = 0.0D; - - if(heightOffGround < this.ai.flyHeightLimit || !this.ai.hasFlyLimit) { - double d3 = this.motionY; - super.moveEntityWithHeading(p_70612_1_, p_70612_2_); - this.motionY = d3; - - this.fallDistance = 0.0F; - this.velocityChanged = true; - } else { - super.moveEntityWithHeading(p_70612_1_,p_70612_2_); - } } }