9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-25 09:59:15 +00:00

perf: Async Target Finding

This commit is contained in:
Taiyou06
2025-03-29 14:19:14 +01:00
parent a34c396a15
commit e797ead637
2 changed files with 293 additions and 0 deletions

View File

@@ -0,0 +1,32 @@
package org.dreeam.leaf.config.modules.async;
import org.dreeam.leaf.config.ConfigModules;
import org.dreeam.leaf.config.EnumConfigCategory;
import org.dreeam.leaf.config.annotations.Experimental;
public class AsyncTargetFinding extends ConfigModules {
public String getBasePath() {
return EnumConfigCategory.ASYNC.getBaseKeyName() + ".async-target-finding";
}
@Experimental
public static boolean enabled = false;
public static boolean asyncTargetFindingInitialized;
@Override
public void onLoaded() {
config.addCommentRegionBased(getBasePath(), """
**Experimental feature**
This moves the expensive entity target search calculations to a background thread while
keeping the actual entity validation on the main thread.""",
"""
这会将昂贵的实体目标搜索计算移至后台线程, 同时在主线程上保持实际的实体验证.""");
if (!asyncTargetFindingInitialized) {
asyncTargetFindingInitialized = true;
enabled = config.getBoolean(getBasePath() + ".enabled", enabled);
}
}
}