Fix Rotation Locking

This commit is contained in:
Kam committed 2026-02-06 03:34:45 -05:00
1 parent 4f7773eb3f
commit 55cd8cc5b3
2 files changed
+31 -1

No files matched your search

+24 -1
View File
@@ -117,10 +117,33 @@ public class DataAbilities {
* Should be called every tick from onLivingUpdate().
*/
public void tick() {
if (!enabled || npc.worldObj.isRemote || npc.isKilled()) {
if (npc.worldObj.isRemote) {
return;
}
// Force-stop any running ability when NPC is killed or abilities are disabled
if (!enabled || npc.isKilled()) {
if (currentAbility != null) {
removeTelegraph(currentAbility);
stopAbilityAnimation();
releaseLockedRotation();
releaseLockedPosition();
currentAbility = null;
lastTarget = null;
} else {
// No ability but locks could be orphaned
if (rotationLocked) releaseLockedRotation();
if (positionLocked) releaseLockedPosition();
}
return;
}
// Safety: release orphaned locks if no ability is actively executing
if (currentAbility == null || !currentAbility.isExecuting()) {
if (rotationLocked) releaseLockedRotation();
if (positionLocked) releaseLockedPosition();
}
// Tick current ability if executing
if (currentAbility != null && currentAbility.isExecuting()) {
tickCurrentAbility();
@@ -308,6 +308,13 @@ public abstract class EntityNPCInterface extends EntityCreature implements IEnti
@Override
public void onUpdate() {
super.onUpdate();
// Re-apply locks after super.onUpdate() to override body rotation smoothing
// in EntityLivingBase.onUpdate() (func_110146_f) which runs AFTER onLivingUpdate()
// and overwrites renderYawOffset, causing a visible twitch each frame.
abilities.applyLockedRotation();
abilities.applyLockedPosition();
if (!isRemote()) {
if (this.ticksExisted % 10 == 0) {
EventHooks.onNPCUpdate(this);