mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-25 21:34:29 +00:00
Various Fixes
This commit is contained in:
1 parent
2e5c4c3bf4
commit
af02b0ab1d
20 files changed
+599
-163
No files matched your search
@@ -169,6 +169,9 @@ public class AbilityPreviewExecutor implements PreviewEntityHandler {
|
||||
public void pause() {
|
||||
paused = true;
|
||||
|
||||
// Immediately sync prevPos to pos for NPC and all entities to prevent interpolation jitter
|
||||
syncPrevPositions();
|
||||
|
||||
if (previewNpc != null) {
|
||||
AnimationData data = previewNpc.display.animationData;
|
||||
if (data.animation != null) {
|
||||
@@ -177,6 +180,25 @@ public class AbilityPreviewExecutor implements PreviewEntityHandler {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sync prevPos to pos for the NPC and all preview entities.
|
||||
* Prevents rendering interpolation jitter when standing still or paused.
|
||||
*/
|
||||
private void syncPrevPositions() {
|
||||
if (previewNpc != null) {
|
||||
previewNpc.prevPosX = previewNpc.posX;
|
||||
previewNpc.prevPosY = previewNpc.posY;
|
||||
previewNpc.prevPosZ = previewNpc.posZ;
|
||||
}
|
||||
for (Entity entity : previewEntities) {
|
||||
if (entity != null && !entity.isDead) {
|
||||
entity.prevPosX = entity.posX;
|
||||
entity.prevPosY = entity.posY;
|
||||
entity.prevPosZ = entity.posZ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
// Clean up the ability
|
||||
if (previewAbility != null) {
|
||||
@@ -228,10 +250,21 @@ public class AbilityPreviewExecutor implements PreviewEntityHandler {
|
||||
* Tick the preview forward. Calls real ability methods.
|
||||
*/
|
||||
public void tick() {
|
||||
if (!playing || paused || previewAbility == null || previewNpc == null) {
|
||||
if (!playing || previewAbility == null || previewNpc == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (paused) {
|
||||
// Sync prevPos to pos for NPC and all entities to prevent interpolation jitter while paused
|
||||
syncPrevPositions();
|
||||
return;
|
||||
}
|
||||
|
||||
// Sync NPC's prevPos to current pos BEFORE any updates to prevent jitter when standing still
|
||||
previewNpc.prevPosX = previewNpc.posX;
|
||||
previewNpc.prevPosY = previewNpc.posY;
|
||||
previewNpc.prevPosZ = previewNpc.posZ;
|
||||
|
||||
currentTick++;
|
||||
|
||||
if (previewTelegraph != null) {
|
||||
|
||||
Reference in new issue
Block a user