ignore saving npc location for closest player look type, used packet instead

This commit is contained in:
D3v1s0m 2023-09-17 22:08:33 +05:30
parent d48e4bc2b2
commit 28ed99a3b7
No known key found for this signature in database
GPG Key ID: FA1F770C7B1D40C1
2 changed files with 7 additions and 1 deletions

@ -87,6 +87,12 @@ public class NpcImpl extends Viewable implements Npc {
entity.setHeadRotation(player, yaw, pitch);
}
public void setHeadRotation(float yaw, float pitch) {
for (Player player : getViewers()) {
entity.setHeadRotation(player, yaw, pitch);
}
}
public HologramImpl getHologram() {
return hologram;
}

@ -72,7 +72,7 @@ public class NpcProcessorTask extends BukkitRunnable {
if (lookType.equals(LookType.CLOSEST_PLAYER)) {
if (closest != null && lookPropertyDistSq >= closestDist) {
NpcLocation expected = npc.getLocation().lookingAt(closest.getLocation().add(0, -npc.getType().getHologramOffset(), 0));
if (!expected.equals(npc.getLocation())) npc.setLocation(expected);
if (!expected.equals(npc.getLocation())) npc.setHeadRotation(expected.getYaw(), expected.getPitch());
}
}
}