mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-25 01:49:16 +00:00
Revert "optimize GoalSelector update order"
This reverts commit 1c6aa60769.
This commit is contained in:
@@ -8,7 +8,6 @@ import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.dreeam.leaf.config.modules.async.AsyncTargetFinding;
|
||||
import org.dreeam.leaf.util.queue.SpscIntQueue;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.OptionalInt;
|
||||
import java.util.concurrent.locks.LockSupport;
|
||||
@@ -18,7 +17,7 @@ public class AsyncGoalExecutor {
|
||||
protected static final Logger LOGGER = LogManager.getLogger("Leaf Async Goal");
|
||||
protected final SpscIntQueue queue;
|
||||
protected final SpscIntQueue wake;
|
||||
private final IntArrayList submit;
|
||||
protected final IntArrayList submit;
|
||||
private final AsyncGoalThread thread;
|
||||
private final ServerLevel world;
|
||||
private long midTickCount = 0L;
|
||||
@@ -32,7 +31,7 @@ public class AsyncGoalExecutor {
|
||||
}
|
||||
|
||||
boolean wake(int id) {
|
||||
Entity entity = this.world.getEntity(id);
|
||||
Entity entity = this.world.getEntities().get(id);
|
||||
if (entity == null || entity.isRemoved() || !(entity instanceof Mob mob)) {
|
||||
return false;
|
||||
}
|
||||
@@ -41,12 +40,8 @@ public class AsyncGoalExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
public final void submit(@NotNull Mob mob) {
|
||||
this.submit.add(mob.getId());
|
||||
}
|
||||
|
||||
public final boolean hasTasks(@NotNull Mob mob) {
|
||||
return mob.targetSelector.ctxState >= 65536 || mob.goalSelector.ctxState >= 65536;
|
||||
public final void submit(int entityId) {
|
||||
this.submit.add(entityId);
|
||||
}
|
||||
|
||||
public final void tick() {
|
||||
@@ -92,7 +87,7 @@ public class AsyncGoalExecutor {
|
||||
}
|
||||
|
||||
private boolean poll(int id) {
|
||||
Entity entity = this.world.getEntity(id);
|
||||
Entity entity = this.world.getEntities().get(id);
|
||||
if (entity == null || entity.isRemoved() || !(entity instanceof Mob mob)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -11,9 +11,6 @@ public class Waker {
|
||||
public boolean state = true;
|
||||
|
||||
public final @Nullable Object result() {
|
||||
if (state) {
|
||||
return null;
|
||||
}
|
||||
Object result = this.result;
|
||||
this.result = null;
|
||||
return result;
|
||||
|
||||
Reference in New Issue
Block a user