mirror of
https://github.com/PaperMC/Paper.git
synced 2025-07-31 20:22:05 -07:00
Fix Chest open/close animations
This commit is contained in:
@@ -180,7 +180,7 @@ index a540167d6..add618866 100644
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
new file mode 100644
|
||||
index 000000000..edaa7713d
|
||||
index 000000000..70cdc3f10
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/net/minecraft/server/MCUtil.java
|
||||
@@ -0,0 +0,0 @@
|
||||
@@ -212,6 +212,32 @@ index 000000000..edaa7713d
|
||||
+ return MinecraftServer.getServer().isMainThread();
|
||||
+ }
|
||||
+
|
||||
+ private static class DelayedRunnable implements Runnable {
|
||||
+
|
||||
+ private final int ticks;
|
||||
+ private final Runnable run;
|
||||
+
|
||||
+ private DelayedRunnable(int ticks, Runnable run) {
|
||||
+ this.ticks = ticks;
|
||||
+ this.run = run;
|
||||
+ }
|
||||
+
|
||||
+ @Override
|
||||
+ public void run() {
|
||||
+ if (ticks <= 0) {
|
||||
+ run.run();
|
||||
+ } else {
|
||||
+ scheduleTask(ticks-1, run);
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ public static void scheduleTask(int ticks, Runnable runnable) {
|
||||
+ // We use post to main instead of process queue as we don't want to process these mid tick if
|
||||
+ // Someone uses processQueueWhileWaiting
|
||||
+ MinecraftServer.getServer().postToMainThread(new DelayedRunnable(ticks, runnable));
|
||||
+ }
|
||||
+
|
||||
+ public static void processQueue() {
|
||||
+ Runnable runnable;
|
||||
+ Queue<Runnable> processQueue = getProcessQueue();
|
||||
|
Reference in New Issue
Block a user