9
0
mirror of https://github.com/BX-Team/DivineMC.git synced 2025-12-21 15:59:23 +00:00

update culling worker

This commit is contained in:
NONPLAYT
2025-07-13 01:26:03 +03:00
parent 650d06ae5c
commit 6e46113429
2 changed files with 12 additions and 16 deletions

View File

@@ -10,7 +10,7 @@ import net.minecraft.world.entity.player.Player;
import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.AABB;
import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.Vec3;
import org.bxteam.divinemc.config.DivineConfig; import org.bxteam.divinemc.config.DivineConfig;
import org.bxteam.divinemc.spark.ThreadDumperRegistry; import org.bxteam.divinemc.util.NamedAgnosticThreadFactory;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Executor; import java.util.concurrent.Executor;
@@ -33,19 +33,7 @@ public class CullTask implements Runnable {
private final Vec3d aabbMin = new Vec3d(0, 0, 0); private final Vec3d aabbMin = new Vec3d(0, 0, 0);
private final Vec3d aabbMax = new Vec3d(0, 0, 0); private final Vec3d aabbMax = new Vec3d(0, 0, 0);
private static final Executor backgroundWorker = Executors.newCachedThreadPool(task -> { private static final Executor backgroundWorker = Executors.newFixedThreadPool(DivineConfig.MiscCategory.retThreads, new NamedAgnosticThreadFactory<>("Raytrace Entity Tracker Thread", TickThread::new, DivineConfig.MiscCategory.retThreadsPriority));
final TickThread worker = new TickThread("Raytrace Entity Tracker Thread") {
@Override
public void run() {
task.run();
}
};
worker.setDaemon(true);
ThreadDumperRegistry.REGISTRY.add(worker.getName());
return worker;
});
private final Executor worker; private final Executor worker;

View File

@@ -612,6 +612,8 @@ public class DivineConfig {
// Raytrace Entity Tracker // Raytrace Entity Tracker
@Experimental("Raytrace Entity Tracker") @Experimental("Raytrace Entity Tracker")
public static boolean retEnabled = false; public static boolean retEnabled = false;
public static int retThreads = 2;
public static int retThreadsPriority = Thread.NORM_PRIORITY + 2;
public static boolean retSkipMarkerArmorStands = true; public static boolean retSkipMarkerArmorStands = true;
public static int retCheckIntervalMs = 10; public static int retCheckIntervalMs = 10;
public static int retTracingDistance = 48; public static int retTracingDistance = 48;
@@ -702,6 +704,12 @@ public class DivineConfig {
private static void ret() { private static void ret() {
retEnabled = getBoolean(ConfigCategory.MISC.key("raytrace-entity-tracker.enabled"), retEnabled, retEnabled = getBoolean(ConfigCategory.MISC.key("raytrace-entity-tracker.enabled"), retEnabled,
"Raytrace Entity Tracker uses async ray-tracing to untrack entities players cannot see. Implementation of EntityCulling mod by tr7zw."); "Raytrace Entity Tracker uses async ray-tracing to untrack entities players cannot see. Implementation of EntityCulling mod by tr7zw.");
retThreads = getInt(ConfigCategory.MISC.key("raytrace-entity-tracker.threads"), retThreads,
"The number of threads to use for raytrace entity tracker.");
retThreadsPriority = getInt(ConfigCategory.MISC.key("raytrace-entity-tracker.threads-priority"), retThreadsPriority,
"The priority of the threads used for raytrace entity tracker.",
"0 - lowest, 10 - highest, 5 - normal");
retSkipMarkerArmorStands = getBoolean(ConfigCategory.MISC.key("raytrace-entity-tracker.skip-marker-armor-stands"), retSkipMarkerArmorStands, retSkipMarkerArmorStands = getBoolean(ConfigCategory.MISC.key("raytrace-entity-tracker.skip-marker-armor-stands"), retSkipMarkerArmorStands,
"Whether to skip tracing entities with marker armor stand"); "Whether to skip tracing entities with marker armor stand");
retCheckIntervalMs = getInt(ConfigCategory.MISC.key("raytrace-entity-tracker.check-interval-ms"), retCheckIntervalMs, retCheckIntervalMs = getInt(ConfigCategory.MISC.key("raytrace-entity-tracker.check-interval-ms"), retCheckIntervalMs,
@@ -755,8 +763,8 @@ public class DivineConfig {
private static void networkSettings() { private static void networkSettings() {
optimizeNonFlushPacketSending = getBoolean(ConfigCategory.NETWORK.key("general.optimize-non-flush-packet-sending"), optimizeNonFlushPacketSending, optimizeNonFlushPacketSending = getBoolean(ConfigCategory.NETWORK.key("general.optimize-non-flush-packet-sending"), optimizeNonFlushPacketSending,
"Optimizes non-flush packet sending by using Netty's lazyExecute method to avoid expensive thread wakeup calls when scheduling packet operations.", "Optimizes non-flush packet sending by using Netty's lazyExecute method to avoid expensive thread wakeup calls when scheduling packet operations.",
"", "",
"NOTE: This option is NOT compatible with ProtocolLib and may cause issues with other plugins that modify packet handling!"); "NOTE: This option is NOT compatible with ProtocolLib and may cause issues with other plugins that modify packet handling!");
disableDisconnectSpam = getBoolean(ConfigCategory.NETWORK.key("general.disable-disconnect-spam"), disableDisconnectSpam, disableDisconnectSpam = getBoolean(ConfigCategory.NETWORK.key("general.disable-disconnect-spam"), disableDisconnectSpam,
"Prevents players being disconnected by 'disconnect.spam' when sending too many chat packets"); "Prevents players being disconnected by 'disconnect.spam' when sending too many chat packets");
dontRespondPingBeforeStart = getBoolean(ConfigCategory.NETWORK.key("general.dont-respond-ping-before-start"), dontRespondPingBeforeStart, dontRespondPingBeforeStart = getBoolean(ConfigCategory.NETWORK.key("general.dont-respond-ping-before-start"), dontRespondPingBeforeStart,