Skip to content

Commit a22472f

Browse files
committed
Added config to disable async catchers
1 parent d15f277 commit a22472f

File tree

42 files changed

+106
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+106
-0
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2+
From: MrHua269 <wangxyper@163.com>
3+
Date: Wed, 7 Aug 2024 14:34:15 +0800
4+
Subject: [PATCH] Add config to disable async catchers
5+
6+
7+
diff --git a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
8+
index 7d626bec6f0a4497026de6c0311e27cf95cfd757..2760e66046a37327d279a5bcdfb56a5b073b82a5 100644
9+
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
10+
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
11+
@@ -26,49 +26,49 @@ public class TickThread extends Thread {
12+
*/
13+
@Deprecated
14+
public static void ensureTickThread(final String reason) {
15+
- if (!isTickThread()) {
16+
+ if (!isTickThread() && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
17+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
18+
throw new IllegalStateException(reason);
19+
}
20+
}
21+
22+
public static void ensureTickThread(final Level world, final BlockPos pos, final String reason) {
23+
- if (!isTickThreadFor(world, pos)) {
24+
+ if (!isTickThreadFor(world, pos) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
25+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
26+
throw new IllegalStateException(reason);
27+
}
28+
}
29+
30+
public static void ensureTickThread(final Level world, final ChunkPos pos, final String reason) {
31+
- if (!isTickThreadFor(world, pos)) {
32+
+ if (!isTickThreadFor(world, pos) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
33+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
34+
throw new IllegalStateException(reason);
35+
}
36+
}
37+
38+
public static void ensureTickThread(final Level world, final int chunkX, final int chunkZ, final String reason) {
39+
- if (!isTickThreadFor(world, chunkX, chunkZ)) {
40+
+ if (!isTickThreadFor(world, chunkX, chunkZ) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
41+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
42+
throw new IllegalStateException(reason);
43+
}
44+
}
45+
46+
public static void ensureTickThread(final Entity entity, final String reason) {
47+
- if (!isTickThreadFor(entity)) {
48+
+ if (!isTickThreadFor(entity) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
49+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
50+
throw new IllegalStateException(reason);
51+
}
52+
}
53+
54+
public static void ensureTickThread(final Level world, final AABB aabb, final String reason) {
55+
- if (!isTickThreadFor(world, aabb)) {
56+
+ if (!isTickThreadFor(world, aabb) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
57+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
58+
throw new IllegalStateException(reason);
59+
}
60+
}
61+
62+
public static void ensureTickThread(final Level world, final double blockX, final double blockZ, final String reason) {
63+
- if (!isTickThreadFor(world, blockX, blockZ)) {
64+
+ if (!isTickThreadFor(world, blockX, blockZ) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
65+
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
66+
throw new IllegalStateException(reason);
67+
}
68+
diff --git a/src/main/java/me/earthme/luminol/config/modules/experiment/DisableAsyncCatcherConfig.java b/src/main/java/me/earthme/luminol/config/modules/experiment/DisableAsyncCatcherConfig.java
69+
new file mode 100644
70+
index 0000000000000000000000000000000000000000..61f653eeca366672ded88c491cf5c59e546e7301
71+
--- /dev/null
72+
+++ b/src/main/java/me/earthme/luminol/config/modules/experiment/DisableAsyncCatcherConfig.java
73+
@@ -0,0 +1,20 @@
74+
+package me.earthme.luminol.config.modules.experiment;
75+
+
76+
+import me.earthme.luminol.config.ConfigInfo;
77+
+import me.earthme.luminol.config.EnumConfigCategory;
78+
+import me.earthme.luminol.config.IConfigModule;
79+
+
80+
+public class DisableAsyncCatcherConfig implements IConfigModule {
81+
+ @ConfigInfo(baseName = "enabled")
82+
+ public static boolean enabled = false;
83+
+
84+
+ @Override
85+
+ public EnumConfigCategory getCategory() {
86+
+ return EnumConfigCategory.EXPERIMENT;
87+
+ }
88+
+
89+
+ @Override
90+
+ public String getBaseName() {
91+
+ return "disable_async_catchers";
92+
+ }
93+
+}
94+
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
95+
index 1f23e775eba1c34e01145bd91b0ce26fed6ca9de..3e0dbf379fc1b5baa27936cb902b3c54f9b0f4c9 100644
96+
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
97+
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
98+
@@ -9,7 +9,7 @@ public class AsyncCatcher
99+
100+
public static void catchOp(String reason)
101+
{
102+
- if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThread()) // Paper // Paper - rewrite chunk system
103+
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) // Paper // Paper - rewrite chunk system // Luminol
104+
{
105+
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable()); // Paper
106+
throw new IllegalStateException( "Asynchronous " + reason + "!" );

0 commit comments

Comments
 (0)