geforkt von Mirrors/Paper
Move TickThread changes from Moonrise patch to MCUtils
The common changes from Moonrise should be entirely in MCUtils
Dieser Commit ist enthalten in:
Ursprung
c58d918886
Commit
5bb7bd0f66
@ -3730,9 +3730,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+package ca.spottedleaf.moonrise.common.util;
|
||||
+
|
||||
+import net.minecraft.core.BlockPos;
|
||||
+import net.minecraft.server.level.ServerLevel;
|
||||
+import net.minecraft.world.entity.Entity;
|
||||
+import net.minecraft.world.level.ChunkPos;
|
||||
+import net.minecraft.world.level.Level;
|
||||
+import net.minecraft.world.phys.AABB;
|
||||
+import net.minecraft.world.phys.Vec3;
|
||||
+import org.slf4j.Logger;
|
||||
@ -3755,21 +3755,21 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void ensureTickThread(final ServerLevel world, final BlockPos pos, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final BlockPos pos, final String reason) {
|
||||
+ if (!isTickThreadFor(world, pos)) {
|
||||
+ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
+ throw new IllegalStateException(reason);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void ensureTickThread(final ServerLevel world, final ChunkPos pos, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final ChunkPos pos, final String reason) {
|
||||
+ if (!isTickThreadFor(world, pos)) {
|
||||
+ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
+ throw new IllegalStateException(reason);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void ensureTickThread(final ServerLevel world, final int chunkX, final int chunkZ, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final int chunkX, final int chunkZ, final String reason) {
|
||||
+ if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
||||
+ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
+ throw new IllegalStateException(reason);
|
||||
@ -3783,14 +3783,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void ensureTickThread(final ServerLevel world, final AABB aabb, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final AABB aabb, final String reason) {
|
||||
+ if (!isTickThreadFor(world, aabb)) {
|
||||
+ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
+ throw new IllegalStateException(reason);
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void ensureTickThread(final ServerLevel world, final double blockX, final double blockZ, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final double blockX, final double blockZ, final String reason) {
|
||||
+ if (!isTickThreadFor(world, blockX, blockZ)) {
|
||||
+ LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
+ throw new IllegalStateException(reason);
|
||||
@ -3819,46 +3819,46 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThread() {
|
||||
+ return org.bukkit.Bukkit.isPrimaryThread(); // Paper
|
||||
+ return Thread.currentThread() instanceof TickThread;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isShutdownThread() {
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final BlockPos pos) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final BlockPos pos) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final ChunkPos pos) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final ChunkPos pos) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final Vec3 pos) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final Vec3 pos) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final int chunkX, final int chunkZ) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final int chunkX, final int chunkZ) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final AABB aabb) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final AABB aabb) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final double blockX, final double blockZ) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final double blockX, final double blockZ) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final Vec3 position, final Vec3 deltaMovement, final int buffer) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final Vec3 position, final Vec3 deltaMovement, final int buffer) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final int fromChunkX, final int fromChunkZ, final int toChunkX, final int toChunkZ) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final int fromChunkX, final int fromChunkZ, final int toChunkX, final int toChunkZ) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
+ public static boolean isTickThreadFor(final ServerLevel world, final int chunkX, final int chunkZ, final int radius) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final int chunkX, final int chunkZ, final int radius) {
|
||||
+ return isTickThread();
|
||||
+ }
|
||||
+
|
||||
|
@ -342,120 +342,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
}
|
||||
|
||||
private ChunkSystem() {}
|
||||
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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
+++ b/src/main/java/ca/spottedleaf/moonrise/common/util/TickThread.java
|
||||
@@ -0,0 +0,0 @@
|
||||
package ca.spottedleaf.moonrise.common.util;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
-import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
+import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import org.slf4j.Logger;
|
||||
@@ -0,0 +0,0 @@ public class TickThread extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
- public static void ensureTickThread(final ServerLevel world, final BlockPos pos, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final BlockPos pos, final String reason) {
|
||||
if (!isTickThreadFor(world, pos)) {
|
||||
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
}
|
||||
}
|
||||
|
||||
- public static void ensureTickThread(final ServerLevel world, final ChunkPos pos, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final ChunkPos pos, final String reason) {
|
||||
if (!isTickThreadFor(world, pos)) {
|
||||
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
}
|
||||
}
|
||||
|
||||
- public static void ensureTickThread(final ServerLevel world, final int chunkX, final int chunkZ, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final int chunkX, final int chunkZ, final String reason) {
|
||||
if (!isTickThreadFor(world, chunkX, chunkZ)) {
|
||||
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -0,0 +0,0 @@ public class TickThread extends Thread {
|
||||
}
|
||||
}
|
||||
|
||||
- public static void ensureTickThread(final ServerLevel world, final AABB aabb, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final AABB aabb, final String reason) {
|
||||
if (!isTickThreadFor(world, aabb)) {
|
||||
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
}
|
||||
}
|
||||
|
||||
- public static void ensureTickThread(final ServerLevel world, final double blockX, final double blockZ, final String reason) {
|
||||
+ public static void ensureTickThread(final Level world, final double blockX, final double blockZ, final String reason) {
|
||||
if (!isTickThreadFor(world, blockX, blockZ)) {
|
||||
LOGGER.error("Thread " + Thread.currentThread().getName() + " failed main thread check: " + reason, new Throwable());
|
||||
throw new IllegalStateException(reason);
|
||||
@@ -0,0 +0,0 @@ public class TickThread extends Thread {
|
||||
}
|
||||
|
||||
public static boolean isTickThread() {
|
||||
- return org.bukkit.Bukkit.isPrimaryThread(); // Paper
|
||||
+ return Thread.currentThread() instanceof TickThread;
|
||||
}
|
||||
|
||||
public static boolean isShutdownThread() {
|
||||
return false;
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final BlockPos pos) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final BlockPos pos) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final ChunkPos pos) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final ChunkPos pos) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final Vec3 pos) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final Vec3 pos) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final int chunkX, final int chunkZ) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final int chunkX, final int chunkZ) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final AABB aabb) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final AABB aabb) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final double blockX, final double blockZ) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final double blockX, final double blockZ) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final Vec3 position, final Vec3 deltaMovement, final int buffer) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final Vec3 position, final Vec3 deltaMovement, final int buffer) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final int fromChunkX, final int fromChunkZ, final int toChunkX, final int toChunkZ) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final int fromChunkX, final int fromChunkZ, final int toChunkX, final int toChunkZ) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
- public static boolean isTickThreadFor(final ServerLevel world, final int chunkX, final int chunkZ, final int radius) {
|
||||
+ public static boolean isTickThreadFor(final Level world, final int chunkX, final int chunkZ, final int radius) {
|
||||
return isTickThread();
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingBitStorage.java b/src/main/java/ca/spottedleaf/moonrise/patches/block_counting/BlockCountingBitStorage.java
|
||||
new file mode 100644
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren