From 5712541caefa16cb69ae9fdacba0b7212a7fca79 Mon Sep 17 00:00:00 2001 From: KAMKEEL <28842281+KAMKEEL@users.noreply.github.com> Date: Thu, 1 Oct 2026 03:03:19 -0400 Subject: [PATCH] Stop the mount reset clearing a flying npc's flying flag every tick --- .../java/noppes/npcs/util/NPCMountUtil.java | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/main/java/noppes/npcs/util/NPCMountUtil.java b/src/main/java/noppes/npcs/util/NPCMountUtil.java index 9c3cce57f..250dc8e6a 100644 --- a/src/main/java/noppes/npcs/util/NPCMountUtil.java +++ b/src/main/java/noppes/npcs/util/NPCMountUtil.java @@ -26,7 +26,7 @@ public final class NPCMountUtil { public static boolean handleMountedMovement(EntityNPCInterface npc, MountState state, float strafe, float forward) { if (npc.advanced.role != EnumRoleType.Mount || !(npc.roleInterface instanceof RoleMount)) { - resetMountedFlightState(npc, state); + resetWithoutRider(npc, state); return false; } if (npc.riddenByEntity != null && !(npc.riddenByEntity instanceof EntityPlayer)) { @@ -34,7 +34,7 @@ public final class NPCMountUtil { return false; } if (!(npc.riddenByEntity instanceof EntityPlayer)) { - resetMountedFlightState(npc, state); + resetWithoutRider(npc, state); return false; } @@ -233,14 +233,15 @@ public final class NPCMountUtil { } public static void applyUnriddenFlightDescent(EntityNPCInterface npc, MountState state, RoleMount mount) { + // A flying npc's own movement sets its flying flag. + if (npc.canFly()) { + return; + } if (mount == null || !mount.isFlyingMountEnabled()) { npc.setNpcFlyingState(false); npc.setNpcJumpingState(false); return; } - if (npc.canFly()) { - return; - } if (npc.onGround) { npc.motionY = 0.0D; npc.setNpcFlyingState(false); @@ -314,6 +315,21 @@ public final class NPCMountUtil { return state.flightMode; } + /** + * Reset for an npc with no player on it. A flying npc sets its flying flag right after this, + * so clearing it here would flip it every tick and resend the npc's data every tick. + */ + private static void resetWithoutRider(EntityNPCInterface npc, MountState state) { + if (!npc.canFly()) { + resetMountedFlightState(npc, state); + return; + } + state.flightMode = false; + state.jumpPressed = false; + state.flightToggleTimer = 0; + npc.setNpcJumpingState(false); + } + public static void resetMountedFlightState(EntityNPCInterface npc, MountState state) { state.flightMode = false; state.jumpPressed = false;