diff --git a/gradle.properties b/gradle.properties index d6ed1e6..12f5aa8 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.samsuik.sakura version=1.21.9-R0.1-SNAPSHOT mcVersion=1.21.9 -paperRef=a3f247c258c4ade42011cbc6f4e2024298e673cf +paperRef=8483163895efbe6d71812c1e2e456330c1aa7859 org.gradle.jvmargs=-Xmx2G org.gradle.vfs.watch=false diff --git a/sakura-server/build.gradle.kts.patch b/sakura-server/build.gradle.kts.patch index 448a00e..e22f982 100644 --- a/sakura-server/build.gradle.kts.patch +++ b/sakura-server/build.gradle.kts.patch @@ -24,8 +24,8 @@ + activeFork = fork + spigot { - enabled = false - buildDataRef = "436eac9815c211be1a2a6ca0702615f995e81c44" + enabled = true + buildDataRef = "42d18d4c4653ffc549778dbe223f6994a031d69e" @@ -107,7 +_,20 @@ } } diff --git a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch b/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch index a2a5c0d..279f852 100644 --- a/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch +++ b/sakura-server/minecraft-patches/features/0001-Track-block-changes-and-level-tick-scheduler.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Track block changes and level tick scheduler diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index a90e5cb4d989f38f7011a6ddd8c539a67e51494c..b2b8c9a651bab91491b4306dbb9d5a818e06869d 100644 +index 9d5d30f70fc348ca31ca88e7d8650ea5e338732d..bb53b16be00c0cbb2f16f749d41aad28b70da872 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1687,6 +1687,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop implements ca.spottedleaf.moonrise.patches.chun - public static final TicketType PLUGIN_TICKET = register("plugin_ticket", NO_TIMEOUT, FLAG_LOADING | FLAG_SIMULATION); // Paper + public static final TicketType PLUGIN_TICKET = register("plugin_ticket", NO_TIMEOUT, FLAG_LOADING | FLAG_SIMULATION); static { ((TicketType)PLUGIN_TICKET).moonrise$setIdentifierComparator((org.bukkit.plugin.Plugin p1, org.bukkit.plugin.Plugin p2) -> p1.getName().compareTo(p2.getName())); } // Paper // Paper - rewrite chunk system public static final TicketType FUTURE_AWAIT = register("future_await", NO_TIMEOUT, FLAG_LOADING | FLAG_SIMULATION); // Paper public static final TicketType CHUNK_LOAD = register("chunk_load", NO_TIMEOUT, FLAG_LOADING); // Paper - moonrise + public static final TicketType ENTITY_MOVEMENT = register("entity_movement", 200L, FLAG_LOADING | FLAG_SIMULATION); // Sakura - load chunks on movement diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch index 1f9c01c..141d486 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/server/MinecraftServer.java.patch @@ -1,6 +1,6 @@ --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -307,6 +_,7 @@ +@@ -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 @@ -8,7 +8,7 @@ public boolean isIteratingOverLevels = false; // Paper - Throw exception on world create while being ticked private final Set pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping public static final long SERVER_INIT = System.nanoTime(); // Paper - Lag compensation -@@ -326,6 +_,17 @@ +@@ -362,6 +_,17 @@ thread.start(); return minecraftServer; } @@ -26,7 +26,7 @@ // Paper start - rewrite chunk system private volatile Throwable chunkSystemCrash; -@@ -476,6 +_,10 @@ +@@ -512,6 +_,10 @@ Runtime.getRuntime().addShutdownHook(new org.bukkit.craftbukkit.util.ServerShutdownThread(this)); // CraftBukkit end this.paperConfigurations = services.paper().configurations(); // Paper - add paper configuration files @@ -37,19 +37,23 @@ } private void readScoreboard(DimensionDataStorage dataStorage) { -@@ -1155,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); -@@ -1192,6 +_,7 @@ - // Paper end - rewrite chunk system +@@ -1277,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; +@@ -1303,6 +_,7 @@ this.tickFrame.end(); + this.recordEndOfTick(); // Paper - improve tick loop profilerFiller.popPush("nextTickWait"); -+ this.tickInformationCollector.tickDuration((System.nanoTime() - currentTime) / 1_000_000L); // Sakura - track tick information ++ 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(); diff --git a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch index 7cfdb21..bfd950e 100644 --- a/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch +++ b/sakura-server/minecraft-patches/sources/net/minecraft/world/level/material/FlowingFluid.java.patch @@ -135,7 +135,7 @@ } // Paper start - fluid method optimisations -@@ -417,7 +_,7 @@ +@@ -415,7 +_,7 @@ if (blockState == null) continue; // Paper - Prevent chunk loading from fluid flowing FluidState fluidState = blockState.getFluidState(); if (this.canMaybePassThrough(level, pos, state, direction, blockPos, blockState, fluidState)) { @@ -144,7 +144,7 @@ if (canHoldSpecificFluid(level, blockPos, blockState, newLiquid.getType())) { if (spreadContext == null) { spreadContext = new FlowingFluid.SpreadContext(level, pos); -@@ -468,6 +_,11 @@ +@@ -466,6 +_,11 @@ } private static boolean canHoldSpecificFluid(BlockGetter level, BlockPos pos, BlockState state, Fluid fluid) { @@ -156,7 +156,7 @@ return !(state.getBlock() instanceof LiquidBlockContainer liquidBlockContainer) || liquidBlockContainer.canPlaceLiquid(null, level, pos, state, fluid); } -@@ -480,7 +_,7 @@ +@@ -478,7 +_,7 @@ @Override public void tick(ServerLevel level, BlockPos pos, BlockState blockState, FluidState fluidState) { if (!fluidState.isSource()) { diff --git a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch index c04d860..488c72c 100644 --- a/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch +++ b/sakura-server/paper-patches/files/src/main/java/org/bukkit/craftbukkit/CraftServer.java.patch @@ -1,6 +1,6 @@ --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -992,6 +_,7 @@ +@@ -993,6 +_,7 @@ org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot this.console.paperConfigurations.reloadConfigs(this.console); @@ -8,7 +8,7 @@ for (ServerLevel world : this.console.getAllLevels()) { // world.serverLevelData.setDifficulty(config.difficulty); // Paper - per level difficulty world.setSpawnSettings(world.serverLevelData.getDifficulty() != Difficulty.PEACEFUL && world.getGameRules().getBoolean(GameRules.RULE_SPAWN_MONSTERS)); // Paper - per level difficulty (from MinecraftServer#setDifficulty(ServerLevel, Difficulty, boolean)) -@@ -1023,6 +_,7 @@ +@@ -1024,6 +_,7 @@ this.reloadData(); org.spigotmc.SpigotConfig.registerCommands(); // Spigot io.papermc.paper.command.PaperCommands.registerCommands(this.console); // Paper