95 lines
6.3 KiB
Diff
95 lines
6.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: MrHua269 <wangxyper@163.com>
|
|
Date: Tue, 11 Feb 2025 12:00:30 +0800
|
|
Subject: [PATCH] Add config to disable async catchers
|
|
|
|
|
|
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 c95769a4e64fabd7acdff6c5f6f349107e1cf5c0..4efa1c057ae6cfdea7889c372bd62dc14637daa0 100644
|
|
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
|
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
|
@@ -48,14 +48,14 @@ public class TickThread extends Thread {
|
|
*/
|
|
@Deprecated
|
|
public static void ensureTickThread(final String reason) {
|
|
- if (!isTickThread()) {
|
|
+ if (!isTickThread() && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
LOGGER.error("Thread failed main thread check: " + reason + ", context=" + getThreadContext(), new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
}
|
|
}
|
|
|
|
public static void ensureTickThread(final Level world, final BlockPos pos, final String reason) {
|
|
- if (!isTickThreadFor(world, pos)) {
|
|
+ if (!isTickThreadFor(world, pos) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", block_pos=" + pos;
|
|
LOGGER.error(ex, new Throwable());
|
|
@@ -64,7 +64,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Level world, final BlockPos pos, final int blockRadius, final String reason) {
|
|
- if (!isTickThreadFor(world, pos, blockRadius)) {
|
|
+ if (!isTickThreadFor(world, pos, blockRadius) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", block_pos=" + pos + ", block_radius=" + blockRadius;
|
|
LOGGER.error(ex, new Throwable());
|
|
@@ -73,7 +73,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Level world, final ChunkPos pos, final String reason) {
|
|
- if (!isTickThreadFor(world, pos)) {
|
|
+ if (!isTickThreadFor(world, pos) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", chunk_pos=" + pos;
|
|
LOGGER.error(ex, new Throwable());
|
|
@@ -82,7 +82,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Level world, final int chunkX, final int chunkZ, final String reason) {
|
|
- if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
|
+ if (!isTickThreadFor(world, chunkX, chunkZ) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", chunk_pos=" + new ChunkPos(chunkX, chunkZ);
|
|
LOGGER.error(ex, new Throwable());
|
|
@@ -91,7 +91,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Entity entity, final String reason) {
|
|
- if (!isTickThreadFor(entity)) {
|
|
+ if (!isTickThreadFor(entity) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", entity=" + EntityUtil.dumpEntity(entity);
|
|
LOGGER.error(ex, new Throwable());
|
|
@@ -100,7 +100,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Level world, final AABB aabb, final String reason) {
|
|
- if (!isTickThreadFor(world, aabb)) {
|
|
+ if (!isTickThreadFor(world, aabb) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", aabb=" + aabb;
|
|
LOGGER.error(ex, new Throwable());
|
|
@@ -109,7 +109,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Level world, final double blockX, final double blockZ, final String reason) {
|
|
- if (!isTickThreadFor(world, blockX, blockZ)) {
|
|
+ if (!isTickThreadFor(world, blockX, blockZ) && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Luminol
|
|
final String ex = "Thread failed main thread check: " +
|
|
reason + ", context=" + getThreadContext() + ", world=" + WorldUtil.getWorldName(world) + ", block_pos=" + new Vec3(blockX, 0.0, blockZ);
|
|
LOGGER.error(ex, new Throwable());
|
|
diff --git a/src/main/java/org/spigotmc/AsyncCatcher.java b/src/main/java/org/spigotmc/AsyncCatcher.java
|
|
index 7e7a0ed944961af5ab7a49bc659da2862d2e2c82..f2867e3758ebfc5ea1066b0d5d2fe6f2dfab8248 100644
|
|
--- a/src/main/java/org/spigotmc/AsyncCatcher.java
|
|
+++ b/src/main/java/org/spigotmc/AsyncCatcher.java
|
|
@@ -5,7 +5,7 @@ import net.minecraft.server.MinecraftServer;
|
|
public class AsyncCatcher {
|
|
|
|
public static void catchOp(String reason) {
|
|
- if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThread()) { // Paper - chunk system
|
|
+ if (!ca.spottedleaf.moonrise.common.util.TickThread.isTickThread() && !me.earthme.luminol.config.modules.experiment.DisableAsyncCatcherConfig.enabled) { // Paper - chunk system // Luminol
|
|
MinecraftServer.LOGGER.error("Thread {} failed main thread check: {}", Thread.currentThread().getName(), reason, new Throwable()); // Paper
|
|
throw new IllegalStateException("Asynchronous " + reason + "!");
|
|
}
|