mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
1. Wet the drys 2. Dry the wets 3. Wet the drys 4. Dry the wets 5. Wet the drys 6. Now dust the wets
43 lines
2.1 KiB
Diff
43 lines
2.1 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 361f4de9cdf0f7505628a2fed2a3f5366031e04b..548fcd9646dee0c40b6ba9b3dafb9ca157dfe324 100644
|
|
--- a/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
|
+++ b/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java
|
|
@@ -48,6 +48,12 @@ class PaperEventManager {
|
|
return;
|
|
}
|
|
// Leaf end - Multithreaded tracker
|
|
+ // 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
|