mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-23 00:49:31 +00:00
38 lines
1.6 KiB
Diff
38 lines
1.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: wangxyper <wangxyper@163.com>
|
|
Date: Wed, 18 Jan 2023 21:17:41 +0800
|
|
Subject: [PATCH] Hearse: forkjoinworker can not skip the async check
|
|
|
|
Original license: MIT
|
|
Original project: https://github.com/Era4FunMC/Hearse
|
|
|
|
diff --git a/src/main/java/io/papermc/paper/util/TickThread.java b/src/main/java/io/papermc/paper/util/TickThread.java
|
|
index fc57850b80303fcade89ca95794f63910404a407..ea277170975f59561775ad9b63467a7c9abdbbe3 100644
|
|
--- a/src/main/java/io/papermc/paper/util/TickThread.java
|
|
+++ b/src/main/java/io/papermc/paper/util/TickThread.java
|
|
@@ -1,5 +1,6 @@
|
|
package io.papermc.paper.util;
|
|
|
|
+import co.earthme.hearse.concurrent.thread.Worker;
|
|
import net.minecraft.server.MinecraftServer;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.world.entity.Entity;
|
|
@@ -74,14 +75,14 @@ public class TickThread extends Thread {
|
|
}
|
|
|
|
public static boolean isTickThread() {
|
|
- return Thread.currentThread() instanceof TickThread;
|
|
+ return Thread.currentThread() instanceof TickThread || Thread.currentThread() instanceof Worker;
|
|
}
|
|
|
|
public static boolean isTickThreadFor(final ServerLevel world, final int chunkX, final int chunkZ) {
|
|
- return Thread.currentThread() instanceof TickThread;
|
|
+ return Thread.currentThread() instanceof TickThread || Thread.currentThread() instanceof Worker;
|
|
}
|
|
|
|
public static boolean isTickThreadFor(final Entity entity) {
|
|
- return Thread.currentThread() instanceof TickThread;
|
|
+ return Thread.currentThread() instanceof TickThread || Thread.currentThread() instanceof Worker;
|
|
}
|
|
}
|