mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 10:36:10 +01:00
Clamp yaw and update some yaw-related variables
This commit is contained in:
parent
002d7b71d2
commit
974cb61a43
@ -275,6 +275,20 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
return npc.getNavigator().isNavigating();
|
||||
}
|
||||
|
||||
public void livingEntityBaseTick() {
|
||||
this.aD = this.aE;
|
||||
this.aK = this.aL;
|
||||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.ba = this.aZ;
|
||||
this.aP = this.aO;
|
||||
this.aR = this.aQ;
|
||||
this.lastYaw = this.yaw;
|
||||
this.lastPitch = this.pitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void m() {
|
||||
super.m();
|
||||
@ -283,7 +297,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
|
||||
updateEffects = true;
|
||||
}
|
||||
tickPotionEffects();
|
||||
livingEntityBaseTick();
|
||||
|
||||
boolean navigating = npc.getNavigator().isNavigating();
|
||||
updatePackets(navigating);
|
||||
|
@ -32,6 +32,13 @@ public class PlayerControllerLook {
|
||||
float f2 = (float) -(MathHelper.b(d2, d4) * 57.2957763671875D);
|
||||
this.a.pitch = a(this.a.pitch, f2, this.c);
|
||||
this.a.aO = a(this.a.aO, f1, this.b);
|
||||
this.a.yaw = this.a.aO;
|
||||
while (this.a.aO >= 180F) {
|
||||
this.a.aO -= 360F;
|
||||
}
|
||||
while (this.a.aO < -180F) {
|
||||
this.a.aO += 360F;
|
||||
}
|
||||
} else {
|
||||
this.a.aO = a(this.a.aO, this.a.aM, 10.0F);
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
|
||||
@Override
|
||||
public void A_() {
|
||||
livingEntityBaseTick();
|
||||
super.A_();
|
||||
if (npc == null)
|
||||
return;
|
||||
@ -115,7 +116,6 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
|
||||
updateEffects = true;
|
||||
}
|
||||
tickPotionEffects();
|
||||
|
||||
boolean navigating = npc.getNavigator().isNavigating();
|
||||
updatePackets(navigating);
|
||||
@ -321,6 +321,20 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
|
||||
return npc.getNavigator().isNavigating();
|
||||
}
|
||||
|
||||
public void livingEntityBaseTick() {
|
||||
this.aC = this.aD;
|
||||
this.aJ = this.aK;
|
||||
if (this.hurtTicks > 0) {
|
||||
this.hurtTicks -= 1;
|
||||
}
|
||||
tickPotionEffects();
|
||||
this.aZ = this.aY;
|
||||
this.aO = this.aN;
|
||||
this.aQ = this.aP;
|
||||
this.lastYaw = this.yaw;
|
||||
this.lastPitch = this.pitch;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean m_() {
|
||||
if (npc == null || !npc.isFlyable()) {
|
||||
|
@ -33,10 +33,16 @@ public class PlayerControllerLook {
|
||||
this.a.pitch = a(this.a.pitch, f2, this.c);
|
||||
this.a.aP = a(this.a.aP, f1, this.b);
|
||||
this.a.yaw = this.a.aP;
|
||||
while (this.a.aP >= 180F) {
|
||||
this.a.aP -= 360F;
|
||||
}
|
||||
while (this.a.aP < -180F) {
|
||||
this.a.aP += 360F;
|
||||
}
|
||||
} else {
|
||||
this.a.aP = a(this.a.aP, this.a.aN, 10.0F);
|
||||
}
|
||||
float f3 = MathHelper.g(this.a.aO - this.a.aM);
|
||||
float f3 = MathHelper.g(this.a.aP - this.a.aN);
|
||||
if (!this.a.getNavigation().n()) {
|
||||
if (f3 < -75.0F) {
|
||||
this.a.aP = (this.a.aN - 75.0F);
|
||||
|
Loading…
Reference in New Issue
Block a user