mirror of
https://github.com/BX-Team/DivineMC.git
synced 2025-12-19 14:59:25 +00:00
98 lines
4.4 KiB
Diff
98 lines
4.4 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: foss-mc <69294560+foss-mc@users.noreply.github.com>
|
|
Date: Thu, 1 Jul 2021 11:59:11 +0000
|
|
Subject: [PATCH] Remove TickTask
|
|
|
|
Original code by PatinaMC, licensed under GNU General Public License v3.0
|
|
You can find the original code on https://github.com/PatinaMC/Patina
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
index 60ce593f25bdd90d53407c1281f580ef5429c9ee..91c1a7010bc46c5b515207b053caf356ae833079 100644
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
@@ -194,7 +194,7 @@ import org.bukkit.event.server.ServerLoadEvent;
|
|
|
|
import co.aikar.timings.MinecraftTimings; // Paper
|
|
|
|
-public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTask> implements CommandSource, AutoCloseable {
|
|
+public abstract class MinecraftServer extends ReentrantBlockableEventLoop<Runnable> implements CommandSource, AutoCloseable { // Patina
|
|
|
|
private static MinecraftServer SERVER; // Paper
|
|
public static final Logger LOGGER = LogUtils.getLogger();
|
|
@@ -1297,19 +1297,21 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
|
|
@Override
|
|
- public TickTask wrapRunnable(Runnable runnable) {
|
|
+ public Runnable wrapRunnable(Runnable runnable) { // Patina
|
|
// Paper start - anything that does try to post to main during watchdog crash, run on watchdog
|
|
if (this.hasStopped && Thread.currentThread().equals(shutdownThread)) {
|
|
runnable.run();
|
|
runnable = () -> {};
|
|
}
|
|
// Paper end
|
|
- return new TickTask(this.tickCount, runnable);
|
|
+ return runnable; // Patina
|
|
}
|
|
|
|
+ /* // Patina
|
|
protected boolean shouldRun(TickTask ticktask) {
|
|
return ticktask.getTick() + 3 < this.tickCount || this.haveTime();
|
|
}
|
|
+ */
|
|
|
|
@Override
|
|
public boolean pollTask() {
|
|
@@ -1341,10 +1343,12 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa
|
|
}
|
|
}
|
|
|
|
+ /* // Patina
|
|
public void doRunTask(TickTask ticktask) { // CraftBukkit - decompile error
|
|
this.getProfiler().incrementCounter("runTask");
|
|
super.doRunTask(ticktask);
|
|
}
|
|
+ */
|
|
|
|
private void updateStatusIcon(ServerStatus metadata) {
|
|
Optional<File> optional = Optional.of(this.getFile("server-icon.png")).filter(File::isFile);
|
|
diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
index c6f5d6756fa0e068a462d9c0ded12e0771abba37..6b8b99f32629c0b4a6db3f7c808430dd88249f8e 100644
|
|
--- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
+++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java
|
|
@@ -1012,10 +1012,12 @@ public class ServerChunkCache extends ChunkSource {
|
|
return runnable;
|
|
}
|
|
|
|
+ /* // Patina
|
|
@Override
|
|
protected boolean shouldRun(Runnable task) {
|
|
return true;
|
|
}
|
|
+ */
|
|
|
|
@Override
|
|
protected boolean scheduleExecutables() {
|
|
diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
|
index 83701fbfaa56a232593ee8f11a3afb8941238bfa..9b71f38bf10b63c0a4304a053540c9c00099bf47 100644
|
|
--- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
|
+++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java
|
|
@@ -29,7 +29,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
|
|
|
protected abstract R wrapRunnable(Runnable runnable);
|
|
|
|
- protected abstract boolean shouldRun(R task);
|
|
+ //protected abstract boolean shouldRun(R task); // Patina
|
|
|
|
public boolean isSameThread() {
|
|
return Thread.currentThread() == this.getRunningThread();
|
|
@@ -120,7 +120,7 @@ public abstract class BlockableEventLoop<R extends Runnable> implements Profiler
|
|
R runnable = this.pendingRunnables.peek();
|
|
if (runnable == null) {
|
|
return false;
|
|
- } else if (this.blockingCount == 0 && !this.shouldRun(runnable)) {
|
|
+ } else if (this.blockingCount == 0 && !true/*this.shouldRun(runnable)*/) { // Patina
|
|
return false;
|
|
} else {
|
|
this.doRunTask(this.pendingRunnables.remove());
|