From f7a4e78a8c731a8d5c27502cc86f1154ea7c2200 Mon Sep 17 00:00:00 2001 From: fullwall Date: Sat, 24 Dec 2016 21:22:11 +0800 Subject: [PATCH] Don't update controller look during navigation --- .../main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java | 2 +- .../citizensnpcs/nms/v1_10_R1/util/PlayerControllerLook.java | 2 ++ .../citizensnpcs/nms/v1_11_R1/util/PlayerControllerLook.java | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java b/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java index bf3067d3b..5d3db414d 100644 --- a/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java +++ b/main/src/main/java/net/citizensnpcs/npc/ai/CitizensNavigator.java @@ -162,7 +162,7 @@ public class CitizensNavigator implements Navigator, Runnable { updatePathfindingRange(); boolean finished = executing.update(); if (localParams.lookAtFunction() != null) { - Util.faceLocation(npc.getEntity(), localParams.lookAtFunction().apply(this), true); + Util.faceLocation(npc.getEntity(), localParams.lookAtFunction().apply(this), true, false); Entity entity = npc.getEntity().getPassenger(); Location npcLoc = npc.getEntity().getLocation(); while (entity != null) { diff --git a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerLook.java b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerLook.java index b5377f298..7fde61fb8 100644 --- a/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerLook.java +++ b/v1_10_R1/src/main/java/net/citizensnpcs/nms/v1_10_R1/util/PlayerControllerLook.java @@ -19,6 +19,8 @@ public class PlayerControllerLook { } public void a() { + if (!NMSImpl.isNavigationFinished(this.a.getNavigation())) + return; this.a.pitch = 0.0F; if (this.d) { this.d = false; diff --git a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerLook.java b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerLook.java index 21c02aea3..11abb9280 100644 --- a/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerLook.java +++ b/v1_11_R1/src/main/java/net/citizensnpcs/nms/v1_11_R1/util/PlayerControllerLook.java @@ -19,6 +19,8 @@ public class PlayerControllerLook { } public void a() { + if (!NMSImpl.isNavigationFinished(this.a.getNavigation())) + return; this.a.pitch = 0.0F; if (this.d) { this.d = false;