9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-28 03:19:21 +00:00

Temporary disable async target finding when PWT enabled

This commit is contained in:
hayanesuru
2025-04-26 00:42:37 +08:00
parent 1fa4df017f
commit 08ca77097c

View File

@@ -25,7 +25,7 @@ index 24926aa7ed5c78b235659daf18b224b14beb744c..2603f5ca5e5f3fd86af76aec7e16039b
public String getLocalIp() {
diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java
index 90bdcd168ad5b1a940f81b191bd59a34d3a33070..252591f0192f8cb5b2bdbb51625e50ae631301ad 100644
index 90bdcd168ad5b1a940f81b191bd59a34d3a33070..051bf2ec9c312460b1379cea0f8a2a3adffcd254 100644
--- a/net/minecraft/server/level/ServerLevel.java
+++ b/net/minecraft/server/level/ServerLevel.java
@@ -177,7 +177,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -54,11 +54,18 @@ index 90bdcd168ad5b1a940f81b191bd59a34d3a33070..252591f0192f8cb5b2bdbb51625e50ae
public LevelChunk getChunkIfLoaded(int x, int z) {
return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately
@@ -861,6 +871,14 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
@@ -861,6 +871,21 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe
}
);
this.tickBlockEntities();
+ // Leaf start - Async target finding
+ if (org.dreeam.leaf.config.modules.async.AsyncTargetFinding.enabled
+ && org.dreeam.leaf.config.modules.async.SparklyPaperParallelWorldTicking.enabled
+ ) {
+ final var tasks = this.asyncAITasks;
+ this.asyncAITasks = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();
+ org.dreeam.leaf.async.ai.AsyncGoalExecutor.runTasks(tasks);
+ } else
+ if (org.dreeam.leaf.config.modules.async.AsyncTargetFinding.enabled) {
+ final var tasks = this.asyncAITasks;
+ this.asyncAITasks = new it.unimi.dsi.fastutil.objects.ObjectArrayList<>();