Fixed updateEveryXTicks being inconsistent due to using entity's ticksExisted. IAction instances now track their own tick

This commit is contained in:
bigguy345 committed 2025-07-03 18:29:53 +03:00
1 parent 7e1374d96a
commit e0c9bfffa5
8 files changed
+31 -34

No files matched your search

@@ -92,6 +92,10 @@ public class ActionThread {
}
}
public boolean isTaskRunning(String taskKey) {
return runningTasks.contains(taskKey);
}
public boolean inActionThread() {
return Thread.currentThread() == thread;
}
@@ -108,13 +112,12 @@ public class ActionThread {
if (threadPaused && pauseUntil != null && pauseUntil.apply(action))
resume();
if (runningKeys.contains(taskKey))
if (!runningKeys.add(taskKey))
return;
final AtomicReference<Future<?>> taskRef = new AtomicReference<>();
taskRef.set(executor.submit(() -> {
runningTasks.add(taskRef.get());
runningKeys.add(taskKey);
try {
task.run();
} finally {