Skip to content

Commit

Permalink
Clamp controller look yaw for entityinsentients as well
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Nov 26, 2016
1 parent 974cb61 commit d968384
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
Expand Up @@ -612,6 +612,12 @@ public void look(org.bukkit.entity.Entity entity, Location to, boolean headOnly)
if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(to.getX(), to.getY(), to.getZ(), to.getYaw(),
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) {
((EntityHumanNPC) handle).setTargetLook(to);
}
Expand Down
Expand Up @@ -108,11 +108,12 @@ public void a(PathType pathtype, float f) {

@Override
public void A_() {
livingEntityBaseTick();
super.A_();
if (npc == null)
return;

livingEntityBaseTick();

if (updateCounter + 1 > Setting.PACKET_UPDATE_DELAY.asInt()) {
updateEffects = true;
}
Expand Down
Expand Up @@ -644,6 +644,13 @@ public void look(org.bukkit.entity.Entity entity, Location to, boolean headOnly)
if (handle instanceof EntityInsentient) {
((EntityInsentient) handle).getControllerLook().a(to.getX(), to.getY(), to.getZ(), to.getYaw(),
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) {
((EntityHumanNPC) handle).setTargetLook(to);
}
Expand Down

0 comments on commit d968384

Please sign in to comment.