mirror of
https://github.com/Samsuik/Sakura.git
synced 2025-12-29 19:59:08 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@ae5e78a [ci skip] Clarify the functionality of AbstractVillager#resetOffers (#13260) PaperMC/Paper@ea9cd17 Use version fetcher from unsafe values in new version command (#13246) PaperMC/Paper@c68a55c Optimise CraftWorld#spawnParticle (#13250) PaperMC/Paper@6794db4 Make spawning more accurately track vanilla (#12627) PaperMC/Paper@f55a34f Properly handle provider plugins in load order (#13242) PaperMC/Paper@e74d702 Fix HelpMap topic creation for bootstrap commands (#13231) PaperMC/Paper@fcb2956 Add debug logging for entities with invalid ids (#13229) PaperMC/Paper@5fd3c95 Add Entity#teleportAsync(Location, TeleportFlag...) (#13208) PaperMC/Paper@e8c6ba5 Expose JukeboxSong variables (#13214) PaperMC/Paper@893ea74 Make stage 2 chunk unload utilise I/O future write PaperMC/Paper@a41043f Add back command source for command blocks with output disabled and fix bukkit->minecraft not respecting output disabled for minecart command blocks (#13271) PaperMC/Paper@1f31ee5 Do not record task execution time as TickTime individually
60 lines
3.4 KiB
Diff
60 lines
3.4 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
|
|
@@ -393,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;
|
|
@@ -559,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) {
|
|
@@ -1320,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, this.tickRateManager.nanosecondsPerTick()));
|
|
+ }
|
|
+ // Sakura end - track tick information
|
|
// Paper end - improve tick loop
|
|
|
|
boolean flag = l == 0L;
|
|
@@ -1346,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();
|