Clamp controller look yaw for entityinsentients as well

This commit is contained in:
fullwall 2016-11-26 23:25:59 +08:00
parent 974cb61a43
commit d968384d58
3 changed files with 15 additions and 1 deletions

View File

@ -612,6 +612,12 @@ public class NMSImpl implements NMSBridge {
if (handle instanceof EntityInsentient) { if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(to.getX(), to.getY(), to.getZ(), to.getYaw(), ((EntityInsentient) handle).getControllerLook().a(to.getX(), to.getY(), to.getZ(), to.getYaw(),
to.getPitch()); to.getPitch());
while (((EntityInsentient) handle).aO >= 180F) {
((EntityInsentient) handle).aO -= 360F;
}
while (((EntityInsentient) handle).aO < -180F) {
((EntityInsentient) handle).aO += 360F;
}
} else if (handle instanceof EntityHumanNPC) { } else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setTargetLook(to); ((EntityHumanNPC) handle).setTargetLook(to);
} }

View File

@ -108,11 +108,12 @@ public class EntityHumanNPC extends EntityPlayer implements NPCHolder, Skinnable
@Override @Override
public void A_() { public void A_() {
livingEntityBaseTick();
super.A_(); super.A_();
if (npc == null) if (npc == null)
return; return;
livingEntityBaseTick();
if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) { if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
updateEffects = true; updateEffects = true;
} }

View File

@ -644,6 +644,13 @@ public class NMSImpl implements NMSBridge {
if (handle instanceof EntityInsentient) { if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(to.getX(), to.getY(), to.getZ(), to.getYaw(), ((EntityInsentient) handle).getControllerLook().a(to.getX(), to.getY(), to.getZ(), to.getYaw(),
to.getPitch()); to.getPitch());
while (((EntityInsentient) handle).aP >= 180F) {
((EntityInsentient) handle).aP -= 360F;
}
while (((EntityInsentient) handle).aP < -180F) {
((EntityInsentient) handle).aP += 360F;
}
} else if (handle instanceof EntityHumanNPC) { } else if (handle instanceof EntityHumanNPC) {
((EntityHumanNPC) handle).setTargetLook(to); ((EntityHumanNPC) handle).setTargetLook(to);
} }