9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-20 23:39:32 +00:00
Files
SakuraMC/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch
Samsuik 1530ca1264 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@914fb08 Fix Entity#updateFluidHeightAndDoFluidPushing inconsistency with Vanilla
PaperMC/Paper@e9fa3a7 Use correct queue when blocking on futures
PaperMC/Paper@0ff899d Prevent world mutation on copper golem spawn cancel (#13152)
PaperMC/Paper@bae47d3 Update to 1.21.10 (#13127)
PaperMC/Paper@8339bb3 Update DataConverter constants for 1.21.10
PaperMC/Paper@3982efa Sync Moonrise
PaperMC/Paper@fa57d4b Remove Vanilla packet processing at start of tick
PaperMC/Paper@fba780d Rebuild patches
2025-10-07 20:21:51 +01:00

60 lines
3.3 KiB
Diff

--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -299,6 +_,7 @@
public volatile boolean abnormalExit; // Paper - Improved watchdog support
public volatile Thread shutdownThread; // Paper - Improved watchdog support
public final io.papermc.paper.configuration.PaperConfigurations paperConfigurations; // Paper - add paper configuration files
+ public final me.samsuik.sakura.configuration.SakuraConfigurations sakuraConfigurations; // Sakura
public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked
private final Set<String> pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping
public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation
@@ -362,6 +_,17 @@
thread.start();
return minecraftServer;
}
+ // Sakura start - track tick information
+ private final me.samsuik.sakura.tps.TickInformationCollector tickInformationCollector = new me.samsuik.sakura.tps.TickInformationCollector();
+
+ public final me.samsuik.sakura.tps.ServerTickInformation latestTickInformation() {
+ return this.tickInformationCollector.latestTickInformation();
+ }
+
+ public final ImmutableList<me.samsuik.sakura.tps.ServerTickInformation> tickHistory(final long from, final long to) {
+ return this.tickInformationCollector.collect(from, to);
+ }
+ // Sakura end - track tick information
// Paper start - rewrite chunk system
private volatile Throwable chunkSystemCrash;
@@ -528,6 +_,10 @@
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end
this.paperConfigurations = services.paper().configurations(); // Paper - add paper configuration files
+ // Sakura start - sakura configuration files
+ final java.nio.file.Path sakuraConfigDirPath = ((java.io.File) options.valueOf("sakura-settings-directory")).toPath();
+ this.sakuraConfigurations = me.samsuik.sakura.configuration.SakuraConfigurations.setup(sakuraConfigDirPath);
+ // Sakura end - sakura configuration files
}
private void readScoreboard(DimensionDataStorage dataStorage) {
@@ -1293,6 +_,11 @@
this.currentTickStart = tickStart;
++MinecraftServer.currentTick;
+ // Sakura start - track tick information
+ if (MinecraftServer.currentTick % 20 == 0) {
+ this.tickInformationCollector.levelData(this.levels.values(), getTPS(this.tickTimes1s, tickStart, l));
+ }
+ // Sakura end - track tick information
// Paper end - improve tick loop
boolean flag = l == 0L;
@@ -1319,6 +_,7 @@
this.tickFrame.end();
this.recordEndOfTick(); // Paper - improve tick loop
profilerFiller.popPush("nextTickWait");
+ this.tickInformationCollector.tickDuration((System.nanoTime() - tickStart) / 1_000_000L); // Sakura - track tick information
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
this.startMeasuringTaskExecutionTime();