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

Paper Changes:
PaperMC/Paper@38fe16b Fix missing reason in disconnectAsync (#13001)
PaperMC/Paper@b0da38c Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939)
PaperMC/Paper@1922be9 Update custom tags (#12183)
PaperMC/Paper@79cf135 Ignore HopperInventorySearchEvent when it has no listeners (#13009)
PaperMC/Paper@ea014f7 feat: add stuckEntityPoiRetryDelay config (#12949)
PaperMC/Paper@a9e7674 Support for showNotification in PlayerRecipeDiscoverEvent (#12992)
PaperMC/Paper@5622c9d Expose attribute sentiment (#12974)
PaperMC/Paper@42b653b Expose more argument types (#12665)
PaperMC/Paper@52d9a22 [ci skip] Fix typo in Display javadoc (#13010)
PaperMC/Paper@614e9ac Improve APIs around riptide tridents (#12996)
PaperMC/Paper@51706e5 Fixed DyeItem sheep dye hunk
PaperMC/Paper@b6168b7 Get console Brig suggestions from main thread fixes #13027 (#13028)
PaperMC/Paper@9d1d0ef Add and call RegionizedServerInitEvent from Folia (#13034)
PaperMC/Paper@704107c Resend frozen ticks when cancelling EntityInsideBlockEvent for powder snow fixes #13033 (#13035)
PaperMC/Paper@63cd4af Fix createProfile not always returning a new profile (#13036)
PaperMC/Paper@49ca2d2 chore: remove experimental status from Damageable#damage (#13021)
PaperMC/Paper@65641d1 Only log name instead of full profile for configuration phase disconnects (#13038)
PaperMC/Paper@78aecfe Do not remove plugin chunk tickets on shutdown
PaperMC/Paper@9aaaadf Backport DFU changes from snapshots
PaperMC/Paper@19156cd Give the right amount of experience after mending (#13047)
PaperMC/Paper@29c8822 Remove no longer needed MC-210802 fix (#13059)
2025-09-18 23:30:45 +01:00

56 lines
3.3 KiB
Diff

--- a/net/minecraft/server/MinecraftServer.java
+++ b/net/minecraft/server/MinecraftServer.java
@@ -300,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
@@ -319,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(long from, long to) {
+ return this.tickInformationCollector.collect(from, to);
+ }
+ // Sakura end - track tick information
// Paper start - rewrite chunk system
private volatile Throwable chunkSystemCrash;
@@ -471,6 +_,10 @@
Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this));
// CraftBukkit end
this.paperConfigurations = services.paperConfigurations(); // Paper - add paper configuration files
+ // Sakura start
+ 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
}
private void readScoreboard(DimensionDataStorage dataStorage) {
@@ -1223,6 +_,7 @@
if (++MinecraftServer.currentTick % MinecraftServer.SAMPLE_INTERVAL == 0) {
final long diff = currentTime - tickSection;
final java.math.BigDecimal currentTps = TPS_BASE.divide(new java.math.BigDecimal(diff), 30, java.math.RoundingMode.HALF_UP);
+ this.tickInformationCollector.levelData(this.levels.values(), currentTps.doubleValue()); // Sakura - track tick information
tps1.add(currentTps, diff);
tps5.add(currentTps, diff);
tps15.add(currentTps, diff);
@@ -1260,6 +_,7 @@
// Paper end - rewrite chunk system
this.tickFrame.end();
profilerFiller.popPush("nextTickWait");
+ this.tickInformationCollector.tickDuration((System.nanoTime() - currentTime) / 1_000_000L); // Sakura - track tick information
this.mayHaveDelayedTasks = true;
this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos);
this.startMeasuringTaskExecutionTime();