81 lines
4.8 KiB
Diff
81 lines
4.8 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Xymb <xymb@endcrystal.me>
|
|
Date: Thu, 22 Jun 2023 00:55:17 +0200
|
|
Subject: [PATCH] Option to disable ensure tick thread checks
|
|
|
|
|
|
diff --git a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
|
index 8232ff317f44c698cac94656e4a910d75b73f402..12738605442b9cdd086b2b29ff372d12552993b8 100644
|
|
--- a/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
|
+++ b/src/main/java/dev/kaiijumc/kaiiju/KaiijuConfig.java
|
|
@@ -230,6 +230,9 @@ public class KaiijuConfig {
|
|
sharedRandomForPlayers = getBoolean("gameplay.shared-random-for-players", sharedRandomForPlayers);
|
|
}
|
|
|
|
+ public static boolean disableEnsureTickThreadChecks = false;
|
|
+
|
|
private static void unsupportedSettings() {
|
|
+ disableEnsureTickThreadChecks = getBoolean("unsupported.disable-ensure-tick-thread-checks", disableEnsureTickThreadChecks);
|
|
}
|
|
}
|
|
diff --git a/src/main/java/io/papermc/paper/util/TickThread.java b/src/main/java/io/papermc/paper/util/TickThread.java
|
|
index cb453dd110fc37fae75257a4576512126207763e..492e6a512343001d3d772d2d8b427d2d84e89da5 100644
|
|
--- a/src/main/java/io/papermc/paper/util/TickThread.java
|
|
+++ b/src/main/java/io/papermc/paper/util/TickThread.java
|
|
@@ -46,6 +46,7 @@ public class TickThread extends Thread {
|
|
*/
|
|
@Deprecated
|
|
public static void ensureTickThread(final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThread()) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
@@ -53,6 +54,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final ServerLevel world, final BlockPos pos, final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThreadFor(world, pos)) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
@@ -60,6 +62,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final ServerLevel world, final ChunkPos pos, final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThreadFor(world, pos)) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
@@ -67,6 +70,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final ServerLevel world, final int chunkX, final int chunkZ, final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
@@ -74,6 +78,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final Entity entity, final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThreadFor(entity)) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
@@ -81,6 +86,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final ServerLevel world, final AABB aabb, final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThreadFor(world, aabb)) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|
|
@@ -88,6 +94,7 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static void ensureTickThread(final ServerLevel world, final double blockX, final double blockZ, final String reason) {
|
|
+ if (dev.kaiijumc.kaiiju.KaiijuConfig.disableEnsureTickThreadChecks) return; // Kaiiju
|
|
if (!isTickThreadFor(world, blockX, blockZ)) {
|
|
MinecraftServer.LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
|
throw new IllegalStateException(reason);
|