mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
* prevents async entity tracker update equipment * fix seenBy updated check * skip submit empty * fix invertedVisibilityEntities data race * strict thread check * set max-threads to 1 by default * use fixed thread count * increase thread priority * Revert "use fixed thread count" This reverts commit6746bc25a8. * Revert "set max-threads to 1 by default" This reverts commit5295b6d3e1. * update entity tracker * cleanup * [ci skip] fix phrasing * cleanup * cleanup * support Citizens * optimize update if chunk player no change * configurable threads * configurable no blocking * fix pos y and z * optimize no blocking * cleanup * cleanup * add handle during waitUntilNextTick * fix entity disappear * cleanup * disable nonblocking by default * [ci skip] add entity slice * impl fork-join * fix async locator diff * optimize queue * inline iterator * [ci skip] Update patch header * cleanup * improve compatibility * add license header * optimize spin wait * remove queue-size option * dynamic adjust subtasks --------- Co-authored-by: Taiyou06 <kaandindar21@gmail.com> Co-authored-by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
43 lines
2.3 KiB
Diff
43 lines
2.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
|
Date: Wed, 23 Oct 2024 23:54:00 +0800
|
|
Subject: [PATCH] Asynchronous locator
|
|
|
|
Original license: MIT
|
|
Original project: https://github.com/thebrightspark/AsyncLocator
|
|
|
|
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
|
index 69cdd304d255d52c9b7dc9b6a33ffdb630b79abe..a4aa2615823d77920ff55b8aa0bcc27a54b8c3e1 100644
|
|
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
|
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
|
@@ -105,6 +105,12 @@ public class TickThread extends Thread {
|
|
this(null, run, name);
|
|
}
|
|
|
|
+ // Leaf start - Asynchronous locator
|
|
+ public TickThread(final Runnable run, final String name, final int id) {
|
|
+ this(null, run, name, id);
|
|
+ }
|
|
+ // Leaf end - Asynchronous locator
|
|
+
|
|
public TickThread(final ThreadGroup group, final Runnable run, final String name) {
|
|
this(group, run, name, ID_GENERATOR.incrementAndGet());
|
|
}
|
|
diff --git a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
|
index 379c2dc1853e45a96dda9b13bf28b7e08f65658a..b9c159537c7db0ff85ebb0ff6b510e5b5061f5f9 100644
|
|
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
|
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
|
@@ -42,6 +42,12 @@ class PaperEventManager {
|
|
if (event.isAsynchronous() && this.server.isPrimaryThread()) {
|
|
throw new IllegalStateException(event.getEventName() + " may only be triggered asynchronously.");
|
|
} else if (!event.isAsynchronous() && !this.server.isPrimaryThread() && !this.server.isStopping()) {
|
|
+ // Leaf start - Asynchronous locator
|
|
+ if (org.dreeam.leaf.config.modules.async.AsyncLocator.enabled) {
|
|
+ net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(event::callEvent);
|
|
+ return;
|
|
+ }
|
|
+ // Leaf end - Asynchronous locator
|
|
throw new IllegalStateException(event.getEventName() + " may only be triggered synchronously.");
|
|
}
|
|
// Leaves start - skip photographer
|