From 275de5a367305fcf544b2d8c98ab640c62c87a74 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sat, 11 Oct 2025 00:28:45 +0300 Subject: [PATCH] apply a lot of patches --- ...03-Completely-remove-Mojang-profiler.patch | 711 +++++++++--------- ...lBottleEvents-for-player-and-dispens.patch | 10 +- ...er-PR-Throttle-failed-spawn-attempts.patch | 73 +- ...06-Raytrace-AntiXray-SDK-integration.patch | 8 +- ...ket-on-player-join-to-avoid-chunk-lo.patch | 36 +- .../features}/0008-Smooth-teleport-API.patch | 16 +- .../features}/0009-lithium-fast_util.patch | 8 +- .../0010-C2ME-Optimize-world-gen-math.patch | 31 +- .../features}/0011-Async-locate-command.patch | 4 +- ...-Carpet-Fixes-RecipeManager-Optimize.patch | 0 ...3-lithium-faster-chunk-serialization.patch | 65 +- .../0014-C2ME-optimize-noise-generation.patch | 0 .../0015-Use-Java-s-Math-functions.patch | 21 +- .../features}/0016-Disable-leaf-decay.patch | 0 .../features}/0017-Optimize-entities.patch | 40 +- ...p-distanceToSqr-call-in-ServerEntity.patch | 16 +- ...rpet-Fixes-Optimized-getBiome-method.patch | 0 ...0020-Carpet-Fixes-Sheep-Optimization.patch | 0 ...MS-Addition-Optimized-dragon-respawn.patch | 2 +- .../0022-ModernFix-compact_bit_storage.patch | 6 +- ...23-Option-to-disable-disconnect.spam.patch | 20 +- ...able-saving-of-snowball-and-firework.patch | 4 +- .../0025-Snowball-and-Egg-knockback.patch | 4 +- .../features}/0026-Optimize-suffocation.patch | 10 +- .../0027-Reduce-chunk-loading-lookups.patch | 4 +- ...igurable-movement-speed-for-entities.patch | 18 +- ...weird-movement-and-disable-teleporti.patch | 20 +- .../features}/0030-Optimize-Raids.patch | 14 +- ...-Small-optimization-to-LinearPalette.patch | 16 +- ...32-Optimize-VarInt-and-VarLong-write.patch | 2 +- .../features}/0033-Optimize-Fluids.patch | 16 +- .../0034-Optimize-Structure-Generation.patch | 10 +- .../0035-Implement-NoChatReports.patch | 48 +- .../features}/0036-Lag-compensation.patch | 58 +- .../features}/0037-Virtual-Threads.patch | 32 +- .../features}/0038-Async-Chunk-Sending.patch | 14 +- ...-Command-block-parse-results-caching.patch | 83 ++ .../0040-Player-ProfileResult-caching.patch | 15 +- .../features/0041-Clump-experience-orbs.patch | 2 +- .../0042-Dynamic-Activation-of-Brain.patch | 90 +-- .../features/0043-Implement-Secure-Seed.patch | 72 +- .../features/0044-C2ME-Limit-NBT-cache.patch | 0 .../0045-Petal-Async-Pathfinding.patch | 100 +-- ...046-Pufferfish-Optimize-mob-spawning.patch | 31 +- .../features/0047-Copper-Bulb-1gt-delay.patch | 4 +- .../0048-Petal-Multithreaded-Tracker.patch | 95 ++- .../features/0049-Crafter-1gt-delay.patch | 2 +- .../0050-Cleanup-dead-code-from-Paper.patch | 91 +-- ...er-ShapelessRecipes-comparison-for-V.patch | 0 .../0052-C2ME-The-End-Biome-Cache.patch | 0 ...53-Euclidean-distance-squared-option.patch | 2 +- ...-Do-not-send-spectator-change-packet.patch | 69 +- ...rverListPingEvent-for-secondary-motd.patch | 33 + ...igurable-player-spawn-tracking-range.patch | 6 +- .../features/0057-Optimize-collections.patch | 18 +- .../0058-Optimize-level-ticking.patch | 10 +- ...59-lithium-combined_heightmap_update.patch | 6 +- .../features}/0003-Delete-timings.patch | 0 .../features}/0004-Delete-ReloadCommand.patch | 4 +- ...lBottleEvents-for-player-and-dispens.patch | 8 +- ...r-PR-Player-standing-on-position-API.patch | 4 +- ...er-PR-Throttle-failed-spawn-attempts.patch | 2 +- ...-Optimize-default-values-for-configs.patch | 6 +- ...e-files-locations-and-plugin-loading.patch | 4 +- .../features}/0010-Smooth-teleport-API.patch | 4 +- ...-SparklyPaper-Optimize-canSee-checks.patch | 6 +- .../features}/0012-Virtual-Threads.patch | 8 +- .../0013-Implement-Secure-Seed.patch | 8 +- ...rverListPingEvent-for-secondary-motd.patch | 2 +- ...er-ShapelessRecipes-comparison-for-V.patch | 0 .../world/chunk/LithiumHashPalette.java | 48 +- .../bxteam/divinemc/config/DivineConfig.java | 21 - .../server}/0058-Async-Join-Thread.patch | 1 + ...-Command-block-parse-results-caching.patch | 83 -- ...rverListPingEvent-for-secondary-motd.patch | 32 - 75 files changed, 1093 insertions(+), 1214 deletions(-) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0003-Completely-remove-Mojang-profiler.patch (89%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch (96%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0005-Paper-PR-Throttle-failed-spawn-attempts.patch (83%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0006-Raytrace-AntiXray-SDK-integration.patch (87%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch (59%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0008-Smooth-teleport-API.patch (82%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0009-lithium-fast_util.patch (90%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0010-C2ME-Optimize-world-gen-math.patch (68%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0011-Async-locate-command.patch (97%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0012-Carpet-Fixes-RecipeManager-Optimize.patch (100%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0013-lithium-faster-chunk-serialization.patch (76%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0014-C2ME-optimize-noise-generation.patch (100%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0015-Use-Java-s-Math-functions.patch (72%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0016-Disable-leaf-decay.patch (100%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0017-Optimize-entities.patch (95%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch (83%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0019-Carpet-Fixes-Optimized-getBiome-method.patch (100%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0020-Carpet-Fixes-Sheep-Optimization.patch (100%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch (98%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0022-ModernFix-compact_bit_storage.patch (90%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0023-Option-to-disable-disconnect.spam.patch (77%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0024-Option-to-disable-saving-of-snowball-and-firework.patch (90%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0025-Snowball-and-Egg-knockback.patch (93%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0026-Optimize-suffocation.patch (84%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0027-Reduce-chunk-loading-lookups.patch (93%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0028-Configurable-movement-speed-for-entities.patch (86%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch (85%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0030-Optimize-Raids.patch (94%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0031-Small-optimization-to-LinearPalette.patch (77%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0032-Optimize-VarInt-and-VarLong-write.patch (98%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0033-Optimize-Fluids.patch (92%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0034-Optimize-Structure-Generation.patch (98%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0035-Implement-NoChatReports.patch (89%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0036-Lag-compensation.patch (87%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0037-Virtual-Threads.patch (74%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0038-Async-Chunk-Sending.patch (95%) create mode 100644 divinemc-server/minecraft-patches/features/0039-Command-block-parse-results-caching.patch rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0040-Player-ProfileResult-caching.patch (84%) rename patches/todo/minecraft-patches/0048-Clump-experience-orbs.patch => divinemc-server/minecraft-patches/features/0041-Clump-experience-orbs.patch (99%) rename {patches/todo/minecraft-patches => divinemc-server/minecraft-patches/features}/0042-Dynamic-Activation-of-Brain.patch (85%) rename patches/todo/minecraft-patches/0041-Implement-Secure-Seed.patch => divinemc-server/minecraft-patches/features/0043-Implement-Secure-Seed.patch (89%) rename patches/todo/minecraft-patches/0053-C2ME-Limit-NBT-cache.patch => divinemc-server/minecraft-patches/features/0044-C2ME-Limit-NBT-cache.patch (100%) rename patches/todo/minecraft-patches/0043-Petal-Async-Pathfinding.patch => divinemc-server/minecraft-patches/features/0045-Petal-Async-Pathfinding.patch (93%) rename patches/todo/minecraft-patches/0045-Pufferfish-Optimize-mob-spawning.patch => divinemc-server/minecraft-patches/features/0046-Pufferfish-Optimize-mob-spawning.patch (89%) rename patches/todo/minecraft-patches/0055-Copper-Bulb-1gt-delay.patch => divinemc-server/minecraft-patches/features/0047-Copper-Bulb-1gt-delay.patch (93%) rename patches/todo/minecraft-patches/0044-Petal-Multithreaded-Tracker.patch => divinemc-server/minecraft-patches/features/0048-Petal-Multithreaded-Tracker.patch (92%) rename patches/todo/minecraft-patches/0056-Crafter-1gt-delay.patch => divinemc-server/minecraft-patches/features/0049-Crafter-1gt-delay.patch (94%) rename patches/todo/minecraft-patches/0062-Cleanup-dead-code-from-Paper.patch => divinemc-server/minecraft-patches/features/0050-Cleanup-dead-code-from-Paper.patch (50%) rename patches/todo/minecraft-patches/0046-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch => divinemc-server/minecraft-patches/features/0051-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch (100%) rename patches/todo/minecraft-patches/0063-C2ME-The-End-Biome-Cache.patch => divinemc-server/minecraft-patches/features/0052-C2ME-The-End-Biome-Cache.patch (100%) rename patches/todo/minecraft-patches/0064-Euclidean-distance-squared-option.patch => divinemc-server/minecraft-patches/features/0053-Euclidean-distance-squared-option.patch (95%) rename patches/todo/minecraft-patches/0065-Do-not-send-spectator-change-packet.patch => divinemc-server/minecraft-patches/features/0054-Do-not-send-spectator-change-packet.patch (65%) create mode 100644 divinemc-server/minecraft-patches/features/0055-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch rename patches/todo/minecraft-patches/0067-Configurable-player-spawn-tracking-range.patch => divinemc-server/minecraft-patches/features/0056-Configurable-player-spawn-tracking-range.patch (92%) rename patches/todo/minecraft-patches/0068-Optimize-collections.patch => divinemc-server/minecraft-patches/features/0057-Optimize-collections.patch (85%) rename patches/todo/minecraft-patches/0069-Optimize-level-ticking.patch => divinemc-server/minecraft-patches/features/0058-Optimize-level-ticking.patch (96%) rename patches/todo/minecraft-patches/0071-lithium-combined_heightmap_update.patch => divinemc-server/minecraft-patches/features/0059-lithium-combined_heightmap_update.patch (90%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0003-Delete-timings.patch (100%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0004-Delete-ReloadCommand.patch (85%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch (89%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0006-Paper-PR-Player-standing-on-position-API.patch (89%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0007-Paper-PR-Throttle-failed-spawn-attempts.patch (95%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0008-Optimize-default-values-for-configs.patch (98%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0009-Configurable-files-locations-and-plugin-loading.patch (97%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0010-Smooth-teleport-API.patch (87%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0011-SparklyPaper-Optimize-canSee-checks.patch (93%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0012-Virtual-Threads.patch (90%) rename {patches/todo/paper-patches => divinemc-server/paper-patches/features}/0013-Implement-Secure-Seed.patch (89%) rename patches/todo/paper-patches/0019-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch => divinemc-server/paper-patches/features/0014-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch (96%) rename patches/todo/paper-patches/0016-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch => divinemc-server/paper-patches/features/0015-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch (100%) rename patches/{todo/minecraft-patches => removed/1.21.10/server}/0058-Async-Join-Thread.patch (98%) delete mode 100644 patches/todo/minecraft-patches/0039-Command-block-parse-results-caching.patch delete mode 100644 patches/todo/minecraft-patches/0066-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch diff --git a/patches/todo/minecraft-patches/0003-Completely-remove-Mojang-profiler.patch b/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch similarity index 89% rename from patches/todo/minecraft-patches/0003-Completely-remove-Mojang-profiler.patch rename to divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch index 394f967..6592e85 100644 --- a/patches/todo/minecraft-patches/0003-Completely-remove-Mojang-profiler.patch +++ b/divinemc-server/minecraft-patches/features/0003-Completely-remove-Mojang-profiler.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Completely remove Mojang profiler diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index e03e2b976870ecda1e5e3c53d47e7978fe5670ed..758ce439d2e10e6ef42a58d147a77093667e0acd 100644 +index 9aa09e11032f539952edeeed119f7705c330db0a..9a7a40c1dcea57ba674d8431077d2477104a456f 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -58,7 +58,6 @@ import net.minecraft.server.commands.CloneCommands; +@@ -59,7 +59,6 @@ import net.minecraft.server.commands.CloneCommands; import net.minecraft.server.commands.DamageCommand; import net.minecraft.server.commands.DataPackCommand; import net.minecraft.server.commands.DeOpCommands; @@ -16,7 +16,7 @@ index e03e2b976870ecda1e5e3c53d47e7978fe5670ed..758ce439d2e10e6ef42a58d147a77093 import net.minecraft.server.commands.DebugConfigCommand; import net.minecraft.server.commands.DebugMobSpawningCommand; import net.minecraft.server.commands.DebugPathCommand; -@@ -139,7 +138,6 @@ import net.minecraft.server.commands.WorldBorderCommand; +@@ -141,7 +140,6 @@ import net.minecraft.server.commands.WorldBorderCommand; import net.minecraft.server.commands.data.DataCommands; import net.minecraft.server.level.ServerPlayer; import net.minecraft.tags.TagKey; @@ -24,7 +24,7 @@ index e03e2b976870ecda1e5e3c53d47e7978fe5670ed..758ce439d2e10e6ef42a58d147a77093 import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.world.flag.FeatureFlagSet; import net.minecraft.world.flag.FeatureFlags; -@@ -191,7 +189,6 @@ public class Commands { +@@ -193,7 +191,6 @@ public class Commands { DamageCommand.register(this.dispatcher, context); DataCommands.register(this.dispatcher); DataPackCommand.register(this.dispatcher, context); @@ -32,7 +32,7 @@ index e03e2b976870ecda1e5e3c53d47e7978fe5670ed..758ce439d2e10e6ef42a58d147a77093 DefaultGameModeCommands.register(this.dispatcher); DialogCommand.register(this.dispatcher, context); DifficultyCommand.register(this.dispatcher); -@@ -363,7 +360,6 @@ public class Commands { +@@ -364,7 +361,6 @@ public class Commands { org.spigotmc.AsyncCatcher.catchOp("Cannot perform command async"); // Paper end CommandSourceStack commandSourceStack = parseResults.getContext().getSource(); @@ -40,7 +40,7 @@ index e03e2b976870ecda1e5e3c53d47e7978fe5670ed..758ce439d2e10e6ef42a58d147a77093 ContextChain contextChain = finishParsing(parseResults, command, commandSourceStack); try { -@@ -401,8 +397,6 @@ public class Commands { +@@ -402,8 +398,6 @@ public class Commands { commandSourceStack.sendFailure(Component.literal(Util.describeError(var12))); LOGGER.error("'/{}' threw an exception", command, var12); } @@ -49,7 +49,7 @@ index e03e2b976870ecda1e5e3c53d47e7978fe5670ed..758ce439d2e10e6ef42a58d147a77093 } } -@@ -459,7 +453,7 @@ public class Commands { +@@ -460,7 +454,7 @@ public class Commands { int max = Math.max(1, server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_CHAIN_LENGTH)); int _int = server.getGameRules().getInt(GameRules.RULE_MAX_COMMAND_FORK_COUNT); @@ -213,11 +213,11 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02 } } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450b461b341 100644 +index 42a8e32dbba4a369406b3cfe4bd64696c875693d..207726e54ccad6b41d5e6f509076903eab00e870 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -114,19 +114,8 @@ import net.minecraft.util.TimeUtil; - import net.minecraft.util.debugchart.RemoteDebugSampleType; +@@ -117,20 +117,8 @@ import net.minecraft.util.TimeUtil; + import net.minecraft.util.debug.ServerDebugSubscribers; import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.util.debugchart.TpsDebugDimensions; -import net.minecraft.util.profiling.EmptyProfileResults; @@ -226,6 +226,7 @@ index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450 -import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.profiling.ResultField; -import net.minecraft.util.profiling.SingleTickProfiler; +-import net.minecraft.util.profiling.jfr.Environment; import net.minecraft.util.profiling.jfr.JvmProfiler; import net.minecraft.util.profiling.jfr.callback.ProfiledDuration; -import net.minecraft.util.profiling.metrics.profiling.ActiveMetricsRecorder; @@ -236,7 +237,7 @@ index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450 import net.minecraft.util.thread.ReentrantBlockableEventLoop; import net.minecraft.world.Difficulty; import net.minecraft.world.RandomSequences; -@@ -199,13 +188,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); @@ -248,20 +249,68 @@ index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450 - private MinecraftServer.TimeProfiler debugCommandProfiler; - private boolean debugCommandProfilerDelayStart; private ServerConnectionListener connection; - public final ChunkProgressListenerFactory progressListenerFactory; + // Paper - per world load listener - moved LevelLoadListener to ServerLevel @Nullable -@@ -1000,9 +982,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop false : this::haveTime); - // Paper start - rewrite chunk system - final Throwable crash = this.chunkSystemCrash; @@ -286,17 +334,12 @@ index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450 - } - // Paper end - rewrite chunk system - this.tickFrame.end(); +- this.recordEndOfTick(); // Paper - improve tick loop - profilerFiller.popPush("nextTickWait"); - this.mayHaveDelayedTasks = true; - this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); -- // Purpur start - Configurable TPS Catchup -- if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup) { -- this.nextTickTimeNanos = currentTime + l; -- this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos; -- } -- // Purpur end - Configurable TPS Catchup - this.startMeasuringTaskExecutionTime(); -- this.waitUntilNextTick(); +- this.recordTaskExecutionTimeWhileWaiting(); // Paper - improve tick loop - record task execution here on MSPT - this.finishMeasuringTaskExecutionTime(); - if (flag) { - this.tickRateManager.endTickWork(); @@ -307,36 +350,39 @@ index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450 - } finally { - this.endMetricsRecordingTick(); + this.tickFrame.start(); ++ this.runAllTasksAtTickStart(); // Paper - improve tick loop + this.tickServer(flag ? () -> false : this::haveTime); + // Paper start - rewrite chunk system + final Throwable crash = this.chunkSystemCrash; + if (crash != null) { + this.chunkSystemCrash = null; + throw new RuntimeException("Chunk system crash propagated to tick()", crash); -+ } + } + // Paper end - rewrite chunk system + this.tickFrame.end(); ++ this.recordEndOfTick(); // Paper - improve tick loop + this.mayHaveDelayedTasks = true; + this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); -+ // Purpur start - Configurable TPS Catchup -+ if (!org.purpurmc.purpur.PurpurConfig.tpsCatchup) { -+ this.nextTickTimeNanos = currentTime + l; -+ this.delayedTasksMaxNextTickTimeNanos = nextTickTimeNanos; -+ } -+ // Purpur end - Configurable TPS Catchup + this.startMeasuringTaskExecutionTime(); -+ this.waitUntilNextTick(); ++ this.recordTaskExecutionTimeWhileWaiting(); // Paper - improve tick loop - record task execution here on MSPT + this.finishMeasuringTaskExecutionTime(); + if (flag) { + this.tickRateManager.endTickWork(); - } - -+ this.logFullTickTime(); ++ } + ++ this.logFullTickTime(); + this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); - } -@@ -1491,7 +1458,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; -@@ -1601,10 +1565,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit // Paper start - optimise Folia entity scheduler -@@ -1718,9 +1674,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur - Ridables @@ -429,7 +477,7 @@ index 5610ef19cf26f984c13f6bf784f36f0e11a56e96..221afb586fa0a0826809fb2c0c956450 try { serverLevel.tick(hasTimeLeft); } catch (Throwable var7) { -@@ -1775,34 +1724,24 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop filteredSpawningCategories; -@@ -586,14 +565,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -580,14 +560,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon List list = this.spawningChunks; try { -- profiler.push("filteringSpawningChunks"); +- profiler.popPush("filteringSpawningChunks"); this.chunkMap.collectSpawningChunks(list); - profiler.popPush("shuffleSpawningChunks"); // Paper start - chunk tick iteration optimisation @@ -1269,18 +1312,22 @@ index 2882cd829d4d8e1f8615f085f6908efcdf68ac62..25150731bb3f3d04b248ebc47fc9b453 for (LevelChunk levelChunk : list) { this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState); -@@ -602,10 +578,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -596,14 +573,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon list.clear(); } - profiler.popPush("tickTickingChunks"); this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations -- profiler.pop(); -- profiler.popPush("customSpawners"); if (_boolean) { - this.level.tickCustomSpawners(this.spawnEnemies, this.spawnFriendlies); +- profiler.popPush("customSpawners"); + this.level.tickCustomSpawners(this.spawnEnemies); } -@@ -817,7 +790,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +- +- profiler.pop(); + } + + private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List spawnCategories, NaturalSpawner.SpawnState spawnState) { +@@ -824,7 +797,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @Override protected void doRunTask(Runnable task) { @@ -1289,19 +1336,19 @@ index 2882cd829d4d8e1f8615f085f6908efcdf68ac62..25150731bb3f3d04b248ebc47fc9b453 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d9325ffd759b 100644 +index e4d9bf14564d5984da64b1ecefc589c740817c47..cea6213837b001d7a494d17aa7e6e326abd1b2fc 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -75,8 +75,6 @@ import net.minecraft.util.Mth; - import net.minecraft.util.ProgressListener; - import net.minecraft.util.RandomSource; +@@ -77,8 +77,6 @@ import net.minecraft.util.RandomSource; import net.minecraft.util.datafix.DataFixTypes; + import net.minecraft.util.debug.DebugSubscriptions; + import net.minecraft.util.debug.LevelDebugSynchronizers; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.random.WeightedList; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.util.valueproviders.UniformInt; - import net.minecraft.world.DifficultyInstance; -@@ -729,16 +727,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -753,16 +751,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void tick(BooleanSupplier hasTimeLeft) { @@ -1318,7 +1365,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 } int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); -@@ -772,41 +766,30 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -796,30 +790,22 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.tickTime(); } @@ -1346,12 +1393,13 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 this.handlingTick = false; - profilerFiller.pop(); - boolean flag = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || !this.players.isEmpty() || !this.getForceLoadedChunks().isEmpty(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this - if (flag) { + boolean hasActiveTickets = !paperConfig().unsupportedSettings.disableWorldTickingWhenEmpty || this.chunkSource.hasActiveTickets(); // CraftBukkit - this prevents entity cleanup, other issues on servers with no players // Paper - restore this + if (hasActiveTickets) { this.resetEmptyTime(); +@@ -830,11 +816,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } - if (flag || this.emptyTime++ < 300) { + if (this.emptyTime < 300) { - profilerFiller.push("entities"); if (this.dragonFight != null && runsNormally) { - profilerFiller.push("dragonFight"); @@ -1360,7 +1408,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 } io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR -@@ -815,9 +798,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -843,9 +826,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity -> { if (!entity.isRemoved()) { if (!tickRateManager.isEntityFrozen(entity)) { @@ -1370,7 +1418,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 if (true) { // Paper - rewrite chunk system Entity vehicle = entity.getVehicle(); if (vehicle != null) { -@@ -828,21 +809,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -856,23 +837,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.stopRiding(); } @@ -1382,17 +1430,27 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 } } ); -- profilerFiller.pop(); +- profilerFiller.popPush("blockEntities"); this.tickBlockEntities(); +- profilerFiller.pop(); } - profilerFiller.push("entityManagement"); // Paper - rewrite chunk system +- profilerFiller.pop(); +- profilerFiller.push("debugSynchronizers"); + if (this.debugSynchronizers.hasAnySubscriberFor(DebugSubscriptions.NEIGHBOR_UPDATES)) { + this.neighborUpdater + .setDebugListener(blockPos -> this.debugSynchronizers.broadcastEventToTracking(blockPos, DebugSubscriptions.NEIGHBOR_UPDATES, blockPos)); +@@ -881,7 +855,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + } + + this.debugSynchronizers.tick(this.server.debugSubscribers()); - profilerFiller.pop(); } @Override -@@ -857,9 +833,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -896,9 +869,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (this.tickTime) { long l = this.levelData.getGameTime() + 1L; this.serverLevelData.setGameTime(l); @@ -1402,7 +1460,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { // Purpur start - Configurable daylight cycle int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; -@@ -959,8 +933,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -998,8 +969,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ChunkPos pos = chunk.getPos(); int minBlockX = pos.getMinBlockX(); int minBlockZ = pos.getMinBlockZ(); @@ -1411,7 +1469,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int i = 0; i < randomTickSpeed; i++) { -@@ -970,12 +942,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1009,12 +978,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } // Paper - Option to disable ice and snow @@ -1424,7 +1482,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 } public void tickThunder(LevelChunk chunk) { -@@ -983,8 +952,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1022,8 +988,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe boolean isRaining = this.isRaining(); int minBlockX = pos.getMinBlockX(); int minBlockZ = pos.getMinBlockZ(); @@ -1433,7 +1491,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 if (!this.paperConfig().environment.disableThunder && isRaining && this.isThundering() && this.spigotConfig.thunderChance > 0 && this.random.nextInt(this.spigotConfig.thunderChance) == 0) { // Spigot // Paper - Option to disable thunder BlockPos blockPos = this.findLightningTargetAround(this.getBlockRandomPos(minBlockX, 0, minBlockZ, 15)); if (this.isRainingAt(blockPos)) { -@@ -1018,8 +985,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1057,8 +1021,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } } @@ -1442,7 +1500,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 } @VisibleForTesting -@@ -1363,17 +1328,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1402,17 +1364,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end - log detailed entity tick information entity.setOldPosAndRot(); @@ -1460,7 +1518,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 -@@ -1394,9 +1355,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1433,9 +1391,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe passengerEntity.setOldPosAndRot(); passengerEntity.tickCount++; passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities @@ -1470,7 +1528,7 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 // Paper start - EAR 2 if (isActive) { passengerEntity.rideTick(); -@@ -1408,7 +1366,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1447,7 +1402,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ridingEntity.positionRider(passengerEntity); } // Paper end - EAR 2 @@ -1479,19 +1537,19 @@ index 3c7159d0981c948e71a5612ba4083accb5849ed4..5f2c27800f047f128857044493a6d932 for (Entity entity : passengerEntity.getPassengers()) { this.tickPassenger(passengerEntity, entity, isActive); // Paper - EAR 2 diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index 10a749890b432688626811c55ee18eb35eaac1fb..f7b73c4c472e53ea5593d855e7194b4eb5e4d2f5 100644 +index 14bb0ae1e913adf25f86aa29487fa5f80d2c6c41..161dbd49495c33fb938a6312b6e24912474864c5 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -106,8 +106,6 @@ import net.minecraft.util.HashOps; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; +@@ -110,8 +110,6 @@ import net.minecraft.util.Mth; + import net.minecraft.util.ProblemReporter; import net.minecraft.util.Unit; + import net.minecraft.util.debug.DebugSubscription; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; -@@ -1450,14 +1448,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1560,14 +1558,10 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.unsetRemoved(); */ // CraftBukkit end @@ -1506,7 +1564,7 @@ index 10a749890b432688626811c55ee18eb35eaac1fb..f7b73c4c472e53ea5593d855e7194b4e // CraftBukkit start this.isChangingDimension = true; // CraftBukkit - Set teleport invulnerability only if player changing worlds LevelData worlddata = level.getLevelData(); -@@ -1475,7 +1469,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1585,7 +1579,6 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.connection.internalTeleport(PositionMoveRotation.of(teleportTransition), teleportTransition.relatives()); // CraftBukkit - use internal teleport without event this.connection.resetPosition(); level.addDuringTeleport(this); @@ -1515,18 +1573,18 @@ index 10a749890b432688626811c55ee18eb35eaac1fb..f7b73c4c472e53ea5593d855e7194b4e this.stopUsingItem(); this.connection.send(new ClientboundPlayerAbilitiesPacket(this.getAbilities())); diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 436f753d00f3854c481c95e4ddacfd9fac9932d4..1975aeecbfdebaacecae1c43005d4ff26fa6a263 100644 +index e98400719a4ab43dc0ce90cdca19ba86e4849720..4a333e87af17bd5b673b57c0fa0d3a239fb8db59 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -26,7 +26,6 @@ import net.minecraft.network.protocol.cookie.ServerboundCookieResponsePacket; - import net.minecraft.server.MinecraftServer; +@@ -27,7 +27,6 @@ import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ClientInformation; + import net.minecraft.server.players.NameAndId; import net.minecraft.util.VisibleForDebug; -import net.minecraft.util.profiling.Profiler; import org.slf4j.Logger; public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener { -@@ -283,7 +282,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -284,7 +283,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } protected void keepConnectionAlive() { @@ -1534,7 +1592,7 @@ index 436f753d00f3854c481c95e4ddacfd9fac9932d4..1975aeecbfdebaacecae1c43005d4ff2 long millis = Util.getMillis(); // Paper start - improve keepalives // Purpur start - Alternative Keepalive Handling -@@ -321,8 +319,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -322,8 +320,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack // Paper end - improve keepalives } } @@ -1544,7 +1602,7 @@ index 436f753d00f3854c481c95e4ddacfd9fac9932d4..1975aeecbfdebaacecae1c43005d4ff2 private boolean checkIfClosed(long time) { diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -index f0e2bca572c6f1790772980cd3ec651e9077382d..954e4103c9c359bc13c9a07bec885af90df14cb5 100644 +index 2a4acd6630d22c5004febcfb7e1298282523d1e1..06043c8fadeb6250a2950499ee67e8b677c39f4f 100644 --- a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java +++ b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java @@ -9,8 +9,6 @@ import java.util.concurrent.TimeUnit; @@ -1571,7 +1629,7 @@ index f0e2bca572c6f1790772980cd3ec651e9077382d..954e4103c9c359bc13c9a07bec885af9 } diff --git a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java -index 407bd4b8026869bc14ee5e79ff80e7bdd1a07bcb..a174e00278356193a2d19172902ac699f8dfb669 100644 +index 09d5e178614f73dfe332220f4f02b71183ee8df7..7e5bb7708e01d9206bb49bfbf195f9e656466cd1 100644 --- a/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java +++ b/net/minecraft/server/packs/resources/ResourceManagerReloadListener.java @@ -3,8 +3,6 @@ package net.minecraft.server.packs.resources; @@ -1583,15 +1641,15 @@ index 407bd4b8026869bc14ee5e79ff80e7bdd1a07bcb..a174e00278356193a2d19172902ac699 public interface ResourceManagerReloadListener extends PreparableReloadListener { @Override -@@ -12,10 +10,7 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener - PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor +@@ -13,10 +11,7 @@ public interface ResourceManagerReloadListener extends PreparableReloadListener ) { + ResourceManager resourceManager = sharedState.resourceManager(); return barrier.wait(Unit.INSTANCE).thenRunAsync(() -> { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("listener"); - this.onResourceManagerReload(manager); + this.onResourceManagerReload(resourceManager); - profilerFiller.pop(); - }, gameExecutor); + }, applyExectutor); } diff --git a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java @@ -1616,10 +1674,10 @@ index 16bab14884a5a7b8d7659379f5b7ea90aa9bd737..a2320c37e4ef495eae7a1978aa7c7dc6 scanDirectory(resourceManager, this.lister, this.ops, this.codec, map); return map; diff --git a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -index 64b0508ef21952c65b0b967b756b2a4c64d96899..9682d64983d43f3c0142565e0cbb06f9fffef271 100644 +index 11884fc390d73b476632c372eb2d3d7876cdb7fd..6a4a63de2da352094d58c3c80c54ec164e7c0b58 100644 --- a/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java +++ b/net/minecraft/server/packs/resources/SimplePreparableReloadListener.java -@@ -2,20 +2,18 @@ package net.minecraft.server.packs.resources; +@@ -2,8 +2,6 @@ package net.minecraft.server.packs.resources; import java.util.concurrent.CompletableFuture; import java.util.concurrent.Executor; @@ -1628,14 +1686,15 @@ index 64b0508ef21952c65b0b967b756b2a4c64d96899..9682d64983d43f3c0142565e0cbb06f9 public abstract class SimplePreparableReloadListener implements PreparableReloadListener { @Override - public final CompletableFuture reload( - PreparableReloadListener.PreparationBarrier barrier, ResourceManager manager, Executor backgroundExecutor, Executor gameExecutor +@@ -11,12 +9,12 @@ public abstract class SimplePreparableReloadListener implements PreparableRel + PreparableReloadListener.SharedState sharedState, Executor exectutor, PreparableReloadListener.PreparationBarrier barrier, Executor applyExectutor ) { -- return CompletableFuture.supplyAsync(() -> this.prepare(manager, Profiler.get()), backgroundExecutor) -+ return CompletableFuture.supplyAsync(() -> this.prepare(manager), backgroundExecutor) + ResourceManager resourceManager = sharedState.resourceManager(); +- return CompletableFuture.supplyAsync(() -> this.prepare(resourceManager, Profiler.get()), exectutor) ++ return CompletableFuture.supplyAsync(() -> this.prepare(resourceManager), exectutor) .thenCompose(barrier::wait) -- .thenAcceptAsync(object -> this.apply((T)object, manager, Profiler.get()), gameExecutor); -+ .thenAcceptAsync(object -> this.apply((T)object, manager), gameExecutor); +- .thenAcceptAsync(object -> this.apply((T)object, resourceManager, Profiler.get()), applyExectutor); ++ .thenAcceptAsync(object -> this.apply((T)object, resourceManager), applyExectutor); } - protected abstract T prepare(ResourceManager resourceManager, ProfilerFiller profiler); @@ -1646,7 +1705,7 @@ index 64b0508ef21952c65b0b967b756b2a4c64d96899..9682d64983d43f3c0142565e0cbb06f9 } diff --git a/net/minecraft/util/profiling/ActiveProfiler.java b/net/minecraft/util/profiling/ActiveProfiler.java deleted file mode 100644 -index 365995455c5e076f145063ab9415b89139f76393..0000000000000000000000000000000000000000 +index 4858d5fc2a577f612dcd82656d37be1f8a774aeb..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/ActiveProfiler.java +++ /dev/null @@ -1,207 +0,0 @@ @@ -1692,12 +1751,12 @@ index 365995455c5e076f145063ab9415b89139f76393..00000000000000000000000000000000 - private final BooleanSupplier suppressWarnings; - private final Set> chartedPaths = new ObjectArraySet<>(); - -- public ActiveProfiler(LongSupplier getRealTime, IntSupplier getTickTime, BooleanSupplier supressWarnings) { +- public ActiveProfiler(LongSupplier getRealTime, IntSupplier getTickTime, BooleanSupplier suppressWarnings) { - this.startTimeNano = getRealTime.getAsLong(); - this.getRealTime = getRealTime; - this.startTimeTicks = getTickTime.getAsInt(); - this.getTickTime = getTickTime; -- this.suppressWarnings = supressWarnings; +- this.suppressWarnings = suppressWarnings; - } - - @Override @@ -1763,7 +1822,7 @@ index 365995455c5e076f145063ab9415b89139f76393..00000000000000000000000000000000 - } else { - long nanos = Util.getNanos(); - long l = this.startTimes.removeLong(this.startTimes.size() - 1); -- this.paths.remove(this.paths.size() - 1); +- this.paths.removeLast(); - long l1 = nanos - l; - ActiveProfiler.PathEntry currentEntry = this.getCurrentEntry(); - currentEntry.accumulatedDuration += l1; @@ -1778,7 +1837,7 @@ index 365995455c5e076f145063ab9415b89139f76393..00000000000000000000000000000000 - ); - } - -- this.path = this.paths.isEmpty() ? "" : this.paths.get(this.paths.size() - 1); +- this.path = this.paths.isEmpty() ? "" : this.paths.getLast(); - this.currentEntry = null; - } - } @@ -1859,7 +1918,7 @@ index 365995455c5e076f145063ab9415b89139f76393..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/ContinuousProfiler.java b/net/minecraft/util/profiling/ContinuousProfiler.java deleted file mode 100644 -index 553638f3140f2e0f2892adbf082b3af415424550..0000000000000000000000000000000000000000 +index 1a05f7063ec4e1f5414a0a0c43c308a224a0f027..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/ContinuousProfiler.java +++ /dev/null @@ -1,38 +0,0 @@ @@ -1875,10 +1934,10 @@ index 553638f3140f2e0f2892adbf082b3af415424550..00000000000000000000000000000000 - private final BooleanSupplier suppressWarnings; - private ProfileCollector profiler = InactiveProfiler.INSTANCE; - -- public ContinuousProfiler(LongSupplier realTime, IntSupplier tickTime, BooleanSupplier supressWarnings) { +- public ContinuousProfiler(LongSupplier realTime, IntSupplier tickTime, BooleanSupplier suppressWarnings) { - this.realTime = realTime; - this.tickCount = tickTime; -- this.suppressWarnings = supressWarnings; +- this.suppressWarnings = suppressWarnings; - } - - public boolean isEnabled() { @@ -2697,16 +2756,17 @@ index cdb8132e70b7c6b43aaf67510fb9e509bc9de0c4..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/SingleTickProfiler.java b/net/minecraft/util/profiling/SingleTickProfiler.java deleted file mode 100644 -index 33b323b78b8210afeac1f592d36d03bf9c907a1d..0000000000000000000000000000000000000000 +index d6679254d3f2705ddf151bbb5695280d2be6ee59..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/SingleTickProfiler.java +++ /dev/null -@@ -1,50 +0,0 @@ +@@ -1,51 +0,0 @@ -package net.minecraft.util.profiling; - -import com.mojang.logging.LogUtils; -import java.io.File; -import java.util.function.LongSupplier; -import javax.annotation.Nullable; +-import net.minecraft.SharedConstants; -import net.minecraft.Util; -import org.slf4j.Logger; - @@ -2744,7 +2804,7 @@ index 33b323b78b8210afeac1f592d36d03bf9c907a1d..00000000000000000000000000000000 - - @Nullable - public static SingleTickProfiler createTickProfiler(String name) { -- return null; +- return SharedConstants.DEBUG_MONITOR_TICK_TIMES ? new SingleTickProfiler(Util.timeSource, name, SharedConstants.MAXIMUM_TICK_TIME_NANOS) : null; - } - - public static ProfilerFiller decorateFiller(ProfilerFiller profiler, @Nullable SingleTickProfiler singleTickProfiler) { @@ -2987,10 +3047,10 @@ index 6bf739dc8f427bd4368431aa060a06845141fedb..00000000000000000000000000000000 -} diff --git a/net/minecraft/util/profiling/metrics/MetricSampler.java b/net/minecraft/util/profiling/metrics/MetricSampler.java deleted file mode 100644 -index 5fa1d836bc9326a461331ff19e234e4dd3b15df5..0000000000000000000000000000000000000000 +index 8fd601585ed6a2548b82b1f35209a9dba1797b1b..0000000000000000000000000000000000000000 --- a/net/minecraft/util/profiling/metrics/MetricSampler.java +++ /dev/null -@@ -1,213 +0,0 @@ +@@ -1,217 +0,0 @@ -package net.minecraft.util.profiling.metrics; - -import io.netty.buffer.ByteBuf; @@ -3038,7 +3098,11 @@ index 5fa1d836bc9326a461331ff19e234e4dd3b15df5..00000000000000000000000000000000 - } - - public static MetricSampler.MetricSamplerBuilder builder(String name, MetricCategory category, ToDoubleFunction sampler, T context) { -- return new MetricSampler.MetricSamplerBuilder<>(name, category, sampler, context); +- if (sampler == null) { +- throw new IllegalStateException(); +- } else { +- return new MetricSampler.MetricSamplerBuilder<>(name, category, sampler, context); +- } - } - - public void onStartTick() { @@ -3950,7 +4014,7 @@ index f4aa10bbd98f514f27224346b3b9332f2218602d..ff319fa2ddea43d5b3c55897b1aaaf9f return this.status.compareAndSet(AbstractConsecutiveExecutor.Status.SLEEPING, AbstractConsecutiveExecutor.Status.RUNNING); } diff --git a/net/minecraft/util/thread/BlockableEventLoop.java b/net/minecraft/util/thread/BlockableEventLoop.java -index 186c1b2e3599770385150eb7acdcd890aa5835eb..e570740d3910573694c462b0a4894349940917a8 100644 +index ef29b33db3a665621f35a7480892c65fd9045a5a..e22b658f90d48ef59b5e7b4d0278f2ba7e05ee51 100644 --- a/net/minecraft/util/thread/BlockableEventLoop.java +++ b/net/minecraft/util/thread/BlockableEventLoop.java @@ -15,13 +15,9 @@ import java.util.function.Supplier; @@ -3975,8 +4039,8 @@ index 186c1b2e3599770385150eb7acdcd890aa5835eb..e570740d3910573694c462b0a4894349 - MetricsRegistry.INSTANCE.add(this); } - protected abstract boolean shouldRun(R runnable); -@@ -161,11 +156,6 @@ public abstract class BlockableEventLoop implements Profiler + // Paper start +@@ -182,11 +177,6 @@ public abstract class BlockableEventLoop implements Profiler } } @@ -4006,19 +4070,19 @@ index 39a604c9a53930b53d959b1d2eb504aa964e9a58..0d0380e3955836ce125f777841477503 @Override diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b8a750334 100644 +index 2c4ed31a6573248a6730933fe447dbaf1856ea6d..79d224baca372cb1b6b89f7fcb63c5fe3707adb5 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -80,8 +80,6 @@ import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.ProblemReporter; - import net.minecraft.util.RandomSource; +@@ -82,8 +82,6 @@ import net.minecraft.util.RandomSource; + import net.minecraft.util.debug.DebugEntityBlockIntersection; + import net.minecraft.util.debug.DebugSubscriptions; + import net.minecraft.util.debug.DebugValueSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; -@@ -874,8 +872,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -880,8 +878,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name // CraftBukkit end public void baseTick() { @@ -4027,7 +4091,7 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups this.inBlockState = null; if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -929,8 +925,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -935,8 +931,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) { Leashable.tickLeash(serverLevelx, (Entity & Leashable)this); } @@ -4036,16 +4100,16 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b } public void setSharedFlagOnFire(boolean isOnFire) { -@@ -1152,8 +1146,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1162,8 +1156,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } } - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("move"); if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) { - movement = movement.multiply(this.stuckSpeedMultiplier); - this.stuckSpeedMultiplier = Vec3.ZERO; -@@ -1162,7 +1154,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + if (type != MoverType.PISTON) { + movement = movement.multiply(this.stuckSpeedMultiplier); +@@ -1175,7 +1167,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name // Paper start - ignore movement changes while inactive. if (isTemporarilyActive && !(this instanceof ItemEntity) && movement == getDeltaMovement() && type == MoverType.SELF) { setDeltaMovement(Vec3.ZERO); @@ -4053,8 +4117,8 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b return; } // Paper end -@@ -1187,8 +1178,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - this.setPos(vec32); +@@ -1200,8 +1191,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name + this.setPos(vec33); } - profilerFiller.pop(); @@ -4062,16 +4126,15 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b boolean flag = !Mth.equal(movement.x, vec3.x); boolean flag1 = !Mth.equal(movement.z, vec3.z); this.horizontalCollision = flag || flag1; -@@ -1211,7 +1200,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1224,7 +1213,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } if (this.isRemoved()) { - profilerFiller.pop(); -+ // nothing } else { if (this.horizontalCollision) { Vec3 deltaMovement = this.getDeltaMovement(); -@@ -1255,7 +1244,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1268,7 +1256,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name float blockSpeedFactor = this.getBlockSpeedFactor(); this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); @@ -4079,7 +4142,7 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b } } // Paper start - detailed watchdog information -@@ -3470,8 +3458,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3541,8 +3528,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.processPortalCooldown(); if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { @@ -4088,7 +4151,7 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b this.setPortalCooldown(); TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this); if (portalDestination != null) { -@@ -3481,8 +3467,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3552,8 +3537,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.teleport(portalDestination); } } @@ -4097,7 +4160,7 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } -@@ -4049,15 +4033,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4120,15 +4103,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); } @@ -4113,7 +4176,7 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b return this; } -@@ -4073,11 +4054,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4145,11 +4125,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } } @@ -4125,7 +4188,7 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b return null; } else { // Paper start - Fix item duplication and teleport issues -@@ -4097,7 +4075,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4169,7 +4146,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name newLevel.resetEmptyTime(); teleportTransition.postTeleportTransition().onTransition(entityx); this.teleportSpectators(teleportTransition, oldLevel); @@ -4134,10 +4197,10 @@ index 8941f45781839de877cc742251d48cf24043966c..eb2f896a8f1b92ace8c7d48eecca386b } } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33647a378e 100644 +index 06ccbb08ddb0ed8c9f6e1be4d6306b79484c1467..4e8594985442fe4371504fca697569bd3c58339d 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -69,8 +69,6 @@ import net.minecraft.tags.FluidTags; +@@ -70,8 +70,6 @@ import net.minecraft.tags.FluidTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -4146,24 +4209,24 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 import net.minecraft.world.Difficulty; import net.minecraft.world.InteractionHand; import net.minecraft.world.damagesource.CombatRules; -@@ -434,8 +432,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -440,8 +438,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin } super.baseTick(); - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("livingEntityBaseTick"); - if (this.fireImmune() || this.level().isClientSide) { - this.clearFire(); - } -@@ -526,7 +522,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + if (this.isAlive() && this.level() instanceof ServerLevel serverLevel1) { + boolean flag = this instanceof Player; + if (this.isInWall()) { +@@ -528,7 +524,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin this.yBodyRotO = this.yBodyRot; this.yRotO = this.getYRot(); this.xRotO = this.getXRot(); - profilerFiller.pop(); } - @Override -@@ -3371,11 +3366,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + protected boolean shouldTakeDrowningDamage() { +@@ -3402,11 +3397,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin f1 = this.getYRot(); } @@ -4175,7 +4238,7 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 // Paper start - stop large pitch and yaw changes from crashing the server this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3387,7 +3378,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3418,7 +3409,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin this.yHeadRotO += Math.round((this.yHeadRot - this.yHeadRotO) / 360.0F) * 360.0F; // Paper end - stop large pitch and yaw changes from crashing the server @@ -4183,7 +4246,7 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 if (this.isFallFlying()) { this.fallFlyTicks++; } else { -@@ -3563,21 +3553,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3594,21 +3584,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin } this.setDeltaMovement(d, d1, d2); @@ -4194,7 +4257,7 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 this.jumping = false; this.xxa = 0.0F; this.zza = 0.0F; - } else if (this.isEffectiveAi() && !this.level().isClientSide) { + } else if (this.isEffectiveAi() && !this.level().isClientSide()) { - profilerFiller.push("newAi"); this.serverAiStep(); - profilerFiller.pop(); @@ -4205,7 +4268,7 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 if (this.jumping && this.isAffectedByFluids()) { double fluidHeight; if (this.isInLava()) { -@@ -3606,8 +3590,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3637,8 +3621,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin this.noJumpDelay = 0; } @@ -4214,7 +4277,7 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 if (this.isFallFlying()) { this.updateFallFlying(); } -@@ -3632,9 +3614,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3663,9 +3645,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin this.calculateEntityAnimation(this instanceof FlyingAnimal); } @@ -4224,7 +4287,7 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2)); } -@@ -3644,18 +3624,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3675,18 +3655,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin if (this.tickCount % 40 == 0 && this.isFullyFrozen() && this.canFreeze()) { this.hurtServer(serverLevel, this.damageSources().freeze(), 1.0F); } @@ -4244,19 +4307,19 @@ index 90000923ad33eb29c0e4c2fe9da19edd356bf23c..b35abb66ae175bca7bf339c9ad34cb33 // Purpur start - Ridables if (this.xo != this.getX() || this.yo != this.getY() || this.zo != this.getZ() || this.yRotO != this.getYRot() || this.xRotO != this.getXRot()) { diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index 18571a10159c5692a0c0fddb220ec95c798fe114..74bd00f5f8ab628d3f35d0f2e39fb1dbf7045c23 100644 +index 3f2e4b48b0ac7f2062c2cbeab36e14eb1c46e3f9..c3a7a41b399590e2c004fda4e97b1935575c4972 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -26,8 +26,6 @@ import net.minecraft.sounds.SoundEvent; - import net.minecraft.tags.TagKey; - import net.minecraft.util.Mth; - import net.minecraft.util.RandomSource; +@@ -31,8 +31,6 @@ import net.minecraft.util.debug.DebugGoalInfo; + import net.minecraft.util.debug.DebugPathInfo; + import net.minecraft.util.debug.DebugSubscriptions; + import net.minecraft.util.debug.DebugValueSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; -@@ -322,8 +320,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -332,8 +330,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void baseTick() { super.baseTick(); @@ -4265,7 +4328,7 @@ index 18571a10159c5692a0c0fddb220ec95c798fe114..74bd00f5f8ab628d3f35d0f2e39fb1db if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { this.resetAmbientSoundTime(); this.playAmbientSound(); -@@ -331,7 +327,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -341,7 +337,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (org.bxteam.divinemc.config.DivineConfig.FixesCategory.fixMc183990 && this.target != null && this.target.isDeadOrDying()) this.setTarget(null); // DivineMC - Fix MC-183990 @@ -4273,7 +4336,7 @@ index 18571a10159c5692a0c0fddb220ec95c798fe114..74bd00f5f8ab628d3f35d0f2e39fb1db incrementTicksSinceLastInteraction(); // Purpur - Entity lifespan } -@@ -535,8 +530,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -550,8 +545,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void aiStep() { super.aiStep(); @@ -4282,7 +4345,7 @@ index 18571a10159c5692a0c0fddb220ec95c798fe114..74bd00f5f8ab628d3f35d0f2e39fb1db if (this.level() instanceof ServerLevel serverLevel && this.canPickUpLoot() && this.isAlive() -@@ -559,8 +552,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -574,8 +567,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } } } @@ -4291,7 +4354,7 @@ index 18571a10159c5692a0c0fddb220ec95c798fe114..74bd00f5f8ab628d3f35d0f2e39fb1db } protected Vec3i getPickupReach() { -@@ -780,42 +771,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -791,42 +782,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return; } // Paper end - Allow nerfed mobs to jump and float @@ -4331,9 +4394,9 @@ index 18571a10159c5692a0c0fddb220ec95c798fe114..74bd00f5f8ab628d3f35d0f2e39fb1db this.jumpControl.tick(); - profilerFiller.pop(); - profilerFiller.pop(); - this.sendDebugPackets(); } + protected void customServerAiStep(ServerLevel level) { diff --git a/net/minecraft/world/entity/ai/goal/GoalSelector.java b/net/minecraft/world/entity/ai/goal/GoalSelector.java index 859b859d29b637200cf7c9a0bd52d9f712413e3d..653c58c7637c46c8b46a5082f671324a2221d431 100644 --- a/net/minecraft/world/entity/ai/goal/GoalSelector.java @@ -4389,19 +4452,19 @@ index 859b859d29b637200cf7c9a0bd52d9f712413e3d..653c58c7637c46c8b46a5082f671324a public Set getAvailableGoals() { diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index dd1a95111d965bcd7f53be9d4224dd213e4e0705..24dd92449f70144c79f25bf24942ebd666655ed2 100644 +index 3e427a7e8be0e15bf867948ee21e838a8a9c3408..1f45b389553cd5782972193537ce7adcd9c7c600 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -10,8 +10,6 @@ import net.minecraft.core.Vec3i; - import net.minecraft.network.protocol.game.DebugPackets; - import net.minecraft.tags.BlockTags; +@@ -12,8 +12,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; + import net.minecraft.util.debug.DebugSubscriptions; + import net.minecraft.util.debug.ServerDebugSubscribers; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.Attributes; -@@ -189,13 +187,10 @@ public abstract class PathNavigation { +@@ -195,13 +193,10 @@ public abstract class PathNavigation { } } // Paper end - EntityPathfindEvent @@ -4440,10 +4503,10 @@ index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f this.seen.add(id); } else { diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java -index fb37669b4d66bb853eabf2d15a369d7ad5a2dbb9..9763a5e24e0fed9b49b6ac59911f6c9f8e893db5 100644 +index 5b08703e27a9e92fb4bcd019661b1407078c24e1..7fae9853c117cda03c516afc1508493af460fa8a 100644 --- a/net/minecraft/world/entity/animal/HappyGhast.java +++ b/net/minecraft/world/entity/animal/HappyGhast.java -@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents; +@@ -13,8 +13,6 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; @@ -4452,7 +4515,7 @@ index fb37669b4d66bb853eabf2d15a369d7ad5a2dbb9..9763a5e24e0fed9b49b6ac59911f6c9f import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -426,13 +424,8 @@ public class HappyGhast extends Animal { +@@ -430,13 +428,8 @@ public class HappyGhast extends Animal { @Override protected void customServerAiStep(ServerLevel level) { if (this.isBaby()) { @@ -4467,10 +4530,10 @@ index fb37669b4d66bb853eabf2d15a369d7ad5a2dbb9..9763a5e24e0fed9b49b6ac59911f6c9f this.checkRestriction(); diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index f372d8b21282e8fdd00dd19eb14ce6ee45b358b0..dd10b0535baf48aea47020d890f102800b0af11a 100644 +index d2665a3bc4602ca8e9635bc9f8104c7ad8eacc5a..3a2451bfa5e59de51d703eac8a536284e1d3348b 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -25,8 +25,6 @@ import net.minecraft.tags.GameEventTags; +@@ -24,8 +24,6 @@ import net.minecraft.tags.GameEventTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -4479,13 +4542,13 @@ index f372d8b21282e8fdd00dd19eb14ce6ee45b358b0..dd10b0535baf48aea47020d890f10280 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.SimpleContainer; -@@ -269,14 +267,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -268,14 +266,9 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("allayBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); - profilerFiller.push("allayActivityUpdate"); @@ -4495,10 +4558,10 @@ index f372d8b21282e8fdd00dd19eb14ce6ee45b358b0..dd10b0535baf48aea47020d890f10280 } diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index e4578193f58417c7ef2776bb3d831ba55c553aec..2a7a078e05e16e73e43a24e108d207bce2e876bb 100644 +index e3fad2dbf9f8e0523082540ecbd46a0b13a36101..5448b010f98e5c0da6e62ef9f91652747eddd650 100644 --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -23,8 +23,6 @@ import net.minecraft.util.ByIdMap; +@@ -22,8 +22,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; import net.minecraft.util.TimeUtil; @@ -4507,7 +4570,7 @@ index e4578193f58417c7ef2776bb3d831ba55c553aec..2a7a078e05e16e73e43a24e108d207bc import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -167,13 +165,8 @@ public class Armadillo extends Animal { +@@ -161,13 +159,8 @@ public class Armadillo extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -4522,10 +4585,10 @@ index e4578193f58417c7ef2776bb3d831ba55c553aec..2a7a078e05e16e73e43a24e108d207bc this.forceDrops = true; // CraftBukkit if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 40e4cc14f10bd465ee7bee124e7e194c74c070b4..deb2fdea7be9dda1c4b267ac25326bb9b05ae739 100644 +index 08fb591e860b7b2b93b42bfc7a91d63999567dc6..1927f8be451258d9f0f8eec1617d103a4140e1e7 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -31,8 +31,6 @@ import net.minecraft.util.ByIdMap; +@@ -30,8 +30,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; @@ -4534,13 +4597,13 @@ index 40e4cc14f10bd465ee7bee124e7e194c74c070b4..deb2fdea7be9dda1c4b267ac25326bb9 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -375,14 +373,9 @@ public class Axolotl extends Animal implements Bucketable { +@@ -374,14 +372,9 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("axolotlBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); - profilerFiller.push("axolotlActivityUpdate"); @@ -4550,10 +4613,10 @@ index 40e4cc14f10bd465ee7bee124e7e194c74c070b4..deb2fdea7be9dda1c4b267ac25326bb9 Optional memory = this.getBrain().getMemory(MemoryModuleType.PLAY_DEAD_TICKS); this.setPlayingDead(memory.isPresent() && memory.get() > 0); diff --git a/net/minecraft/world/entity/animal/camel/Camel.java b/net/minecraft/world/entity/animal/camel/Camel.java -index 0c698241b10f84afb17ae10d3661a90bc62ec243..949b6c563658e6e46ac5842d6f088ecae6d4cd0c 100644 +index bb750bcc35a3dd75c112dea445595ab27cc15fd5..5a436ae8893cd91944e8269f11c29bc82217c755 100644 --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java -@@ -18,8 +18,6 @@ import net.minecraft.tags.BlockTags; +@@ -17,8 +17,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; @@ -4562,7 +4625,7 @@ index 0c698241b10f84afb17ae10d3661a90bc62ec243..949b6c563658e6e46ac5842d6f088eca import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -173,14 +171,9 @@ public class Camel extends AbstractHorse { +@@ -172,14 +170,9 @@ public class Camel extends AbstractHorse { @Override protected void customServerAiStep(ServerLevel level) { @@ -4578,10 +4641,10 @@ index 0c698241b10f84afb17ae10d3661a90bc62ec243..949b6c563658e6e46ac5842d6f088eca } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index 8d6da6ce15c266c7b4b9763a37516d2b160f1b85..f67d18f32f73e0e6be35939781bd0bd0188cdfbd 100644 +index e18364baff00dc08aad75e0d40e86ae14fec56ad..1a504e30602d7d8feaf7a9180adf6382596aae02 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -28,8 +28,6 @@ import net.minecraft.tags.ItemTags; +@@ -27,8 +27,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -4590,13 +4653,13 @@ index 8d6da6ce15c266c7b4b9763a37516d2b160f1b85..f67d18f32f73e0e6be35939781bd0bd0 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; -@@ -261,14 +259,9 @@ public class Frog extends Animal { +@@ -260,14 +258,9 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("frogBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); - profilerFiller.push("frogActivityUpdate"); @@ -4606,10 +4669,10 @@ index 8d6da6ce15c266c7b4b9763a37516d2b160f1b85..f67d18f32f73e0e6be35939781bd0bd0 } diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index d5336192b0f5e58627daa669e456b9d14487f5ec..c25cfd8f176819efd64e5ce45632b0cc1b69d420 100644 +index 4586969e406b24639893a393e2ebe19ec5b224ea..8312a0d5229043fd84125db809c4346bb80f2bc0 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -12,8 +12,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -11,8 +11,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.ItemTags; @@ -4618,13 +4681,13 @@ index d5336192b0f5e58627daa669e456b9d14487f5ec..c25cfd8f176819efd64e5ce45632b0cc import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -137,14 +135,9 @@ public class Tadpole extends AbstractFish { +@@ -136,14 +134,9 @@ public class Tadpole extends AbstractFish { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("tadpoleBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); - profilerFiller.push("tadpoleActivityUpdate"); @@ -4634,10 +4697,10 @@ index d5336192b0f5e58627daa669e456b9d14487f5ec..c25cfd8f176819efd64e5ce45632b0cc } diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 979befb6a51c855e439d7576db57abf1143731be..d8b726fb954a3b8ca20f3f500e4087d5936e7646 100644 +index 99980c9a69b51f81a9cd4429d59fab9497d79656..80714e2a6e74047af89680c261e2dbc097d86062 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -20,8 +20,6 @@ import net.minecraft.tags.ItemTags; +@@ -19,8 +19,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; @@ -4646,13 +4709,13 @@ index 979befb6a51c855e439d7576db57abf1143731be..d8b726fb954a3b8ca20f3f500e4087d5 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -228,14 +226,9 @@ public class Goat extends Animal { +@@ -227,14 +225,9 @@ public class Goat extends Animal { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("goatBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); - profilerFiller.push("goatActivityUpdate"); @@ -4662,10 +4725,10 @@ index 979befb6a51c855e439d7576db57abf1143731be..d8b726fb954a3b8ca20f3f500e4087d5 } diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 745c821facbbf0e9641e371bb26a8d6abde7a813..71e7931f7007f73b552bbc2cbc8e843e10b40b43 100644 +index 204a9ee08668d12368b5c0e9ed990d0a4624b925..b77b763a3eb58b3135ad9c9cbb8a39f67393397d 100644 --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -29,8 +29,6 @@ import net.minecraft.tags.BlockTags; +@@ -28,8 +28,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.ByIdMap; import net.minecraft.util.Mth; @@ -4674,13 +4737,13 @@ index 745c821facbbf0e9641e371bb26a8d6abde7a813..71e7931f7007f73b552bbc2cbc8e843e import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -497,13 +495,9 @@ public class Sniffer extends Animal { +@@ -496,13 +494,9 @@ public class Sniffer extends Animal { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("snifferBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.popPush("snifferActivityUpdate"); SnifferAi.updateActivity(this); @@ -4689,10 +4752,10 @@ index 745c821facbbf0e9641e371bb26a8d6abde7a813..71e7931f7007f73b552bbc2cbc8e843e } diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java -index e37c6dcbe62cba2cb7f33ac1792d539f9b07aa24..2a905e8cdf22f9d7f38cc41c1474e80f704d0cb1 100644 +index e0ee4f71786dce5690cf75bb55def05c8608c8d2..2eb7f602f452917b5d88fd8237898dff920cf0a9 100644 --- a/net/minecraft/world/entity/monster/Zoglin.java +++ b/net/minecraft/world/entity/monster/Zoglin.java -@@ -14,8 +14,6 @@ import net.minecraft.network.syncher.SynchedEntityData; +@@ -13,8 +13,6 @@ import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -4701,7 +4764,7 @@ index e37c6dcbe62cba2cb7f33ac1792d539f9b07aa24..2a905e8cdf22f9d7f38cc41c1474e80f import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; -@@ -289,11 +287,8 @@ public class Zoglin extends Monster implements HoglinBase { +@@ -288,11 +286,8 @@ public class Zoglin extends Monster implements HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -4714,25 +4777,25 @@ index e37c6dcbe62cba2cb7f33ac1792d539f9b07aa24..2a905e8cdf22f9d7f38cc41c1474e80f } diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java -index 4e47a1e6d1dcf15a316ff6bed6c03e9c42777853..793db0e9977fe64e7cdbe5b337deb6d8e32f0627 100644 +index 11408fd409eb00e6bf3289e6a5a35e98178fa6e2..44d638d5d96a58bcfd35cc8e2e0c08389717e48f 100644 --- a/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvent; - import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.EntityTypeTags; +@@ -14,8 +14,6 @@ import net.minecraft.tags.EntityTypeTags; + import net.minecraft.util.debug.DebugBreezeInfo; + import net.minecraft.util.debug.DebugSubscriptions; + import net.minecraft.util.debug.DebugValueSource; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; -@@ -232,13 +230,9 @@ public class Breeze extends Monster { +@@ -234,13 +232,9 @@ public class Breeze extends Monster { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("breezeBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.popPush("breezeActivityUpdate"); BreezeAi.updateActivity(this); @@ -4741,10 +4804,10 @@ index 4e47a1e6d1dcf15a316ff6bed6c03e9c42777853..793db0e9977fe64e7cdbe5b337deb6d8 } diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java -index 1b01d2b37dd221d5832cb68c072af9863aeb6868..775c11f658b81379784f7e5bdfdc8105b3410480 100644 +index c05d572fa2ab5a70c8825d2d2b6ffb36317e92fe..ffa881eb837aff53d50d0ffe8af44bbe2d0aeb6a 100644 --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -16,8 +16,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -15,8 +15,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; @@ -4753,7 +4816,7 @@ index 1b01d2b37dd221d5832cb68c072af9863aeb6868..775c11f658b81379784f7e5bdfdc8105 import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AnimationState; import net.minecraft.world.entity.Entity; -@@ -236,10 +234,7 @@ public class Creaking extends Monster { +@@ -235,10 +233,7 @@ public class Creaking extends Monster { @Override protected void customServerAiStep(ServerLevel level) { @@ -4765,10 +4828,10 @@ index 1b01d2b37dd221d5832cb68c072af9863aeb6868..775c11f658b81379784f7e5bdfdc8105 } diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 6062167a25d9d66c0264624f0761bcb9d47f0c77..952fba6d141576089e563e829cae4a177f19d639 100644 +index 08c3372555d098b62465437798bf6cbd08e73ec5..b22519a6d39bd52381fa6c17b9a415944374368b 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -15,8 +15,6 @@ import net.minecraft.sounds.SoundEvents; +@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; import net.minecraft.tags.ItemTags; import net.minecraft.util.RandomSource; @@ -4777,20 +4840,20 @@ index 6062167a25d9d66c0264624f0761bcb9d47f0c77..952fba6d141576089e563e829cae4a17 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -208,11 +206,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -207,11 +205,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("hoglinBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); HoglinAi.updateActivity(this); if (this.isConverting()) { this.timeInOverworld++; diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index b5ab1ea7ebf1e1a67f51f53f92fbc2a84506174a..03b6640c95c86ea9f6219d6e39feffa4643dd648 100644 +index 000391f95bf2881765c304aecb013eb313d55ba1..dea7c211a2d2ee8f1833eaad49513b3690b06c55 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java @@ -16,8 +16,6 @@ import net.minecraft.tags.ItemTags; @@ -4802,13 +4865,13 @@ index b5ab1ea7ebf1e1a67f51f53f92fbc2a84506174a..03b6640c95c86ea9f6219d6e39feffa4 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -359,11 +357,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -347,11 +345,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("piglinBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); PiglinAi.updateActivity(this); @@ -4840,10 +4903,10 @@ index 70ee15527fa6f30783d6a58bb767b18124f25c53..c4eb58d0b0c51e930f9cb72e1de01039 PiglinBruteAi.maybePlayActivitySound(this); super.customServerAiStep(level); diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index bc691e17a974a3b4175ceb34f7e40291f1f1f83c..091b9cc338e37efbecdd4187a9824dae7bff2af9 100644 +index 137510f81e6454f45010f8d96001ad1ebdddfde6..ac7691a2a3e4c9db040408d1ecba780a89dea50e 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -27,8 +27,6 @@ import net.minecraft.tags.TagKey; +@@ -26,8 +26,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -4852,20 +4915,20 @@ index bc691e17a974a3b4175ceb34f7e40291f1f1f83c..091b9cc338e37efbecdd4187a9824dae import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; -@@ -303,11 +301,8 @@ public class Warden extends Monster implements VibrationSystem { +@@ -302,11 +300,8 @@ public class Warden extends Monster implements VibrationSystem { @Override protected void customServerAiStep(ServerLevel level) { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("wardenBrain"); - if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider this.getBrain().tick(level, this); - profilerFiller.pop(); super.customServerAiStep(level); if ((this.tickCount + this.getId()) % 120 == 0) { applyDarknessAround(level, this.position(), this, 20); diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index cab85afb6a460297511b0d391364670124d5a3f3..db5c287161c50bafd672b9cb439b3a06b1ff16d7 100644 +index dda4563b0f0d6f0d1a0ccd64a4ec787bf27abf2d..3bcd3b7c9f7ad408d66fad5b1b70ebee96a61b43 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java @@ -35,8 +35,6 @@ import net.minecraft.stats.Stats; @@ -4887,9 +4950,9 @@ index cab85afb6a460297511b0d391364670124d5a3f3..db5c287161c50bafd672b9cb439b3a06 if (this.level().purpurConfig.villagerLobotomizeEnabled) { // treat as inactive if lobotomized @@ -407,7 +403,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler - this.getBrain().tick(level, this); // Paper - EAR 2 } - else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers + else if (this.isLobotomized && shouldRestock()) restock(); + // Purpur end - Lobotomize stuck villagers - profilerFiller.pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; @@ -4925,19 +4988,18 @@ index 07d7c4737635f671f33b8f73001d67928fc75782..f2c82217811712625df594667330a73f LOGGER.info("Loaded {} recipes", object.values().size()); } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index a649fe6db0ec875095393ea22a11ff8787f1b28c..0de51e0374bf798d6e138bac3b113db5d73192b9 100644 +index 0dc444a63224ef3409f4e7ac800213d5a794a810..5b50b86c735fa2ba1b5452aacda7db5e64012076 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -35,8 +35,6 @@ import net.minecraft.util.AbortableIterationConsumer; +@@ -36,7 +36,6 @@ import net.minecraft.util.AbortableIterationConsumer; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; -import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.util.random.WeightedList; import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; - import net.minecraft.world.damagesource.DamageSource; -@@ -254,7 +252,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -259,7 +258,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { @@ -4945,7 +5007,7 @@ index a649fe6db0ec875095393ea22a11ff8787f1b28c..0de51e0374bf798d6e138bac3b113db5 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); -@@ -264,7 +261,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -269,7 +267,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { @@ -4953,24 +5015,7 @@ index a649fe6db0ec875095393ea22a11ff8787f1b28c..0de51e0374bf798d6e138bac3b113db5 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); -@@ -1498,8 +1494,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl - } - - protected void tickBlockEntities() { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("blockEntities"); - this.tickingBlockEntities = true; - if (!this.pendingBlockEntityTickers.isEmpty()) { - this.blockEntityTickers.addAll(this.pendingBlockEntityTickers); -@@ -1527,7 +1521,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl - this.blockEntityTickers.removeMarkedEntries(); // DivineMC - optimize block entity removals - Fix MC-117075 - - this.tickingBlockEntities = false; -- profilerFiller.pop(); - this.spigotConfig.currentPrimedTnt = 0; // Spigot - } - -@@ -1779,7 +1772,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -1735,7 +1732,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -4978,7 +5023,7 @@ index a649fe6db0ec875095393ea22a11ff8787f1b28c..0de51e0374bf798d6e138bac3b113db5 List list = Lists.newArrayList(); // Paper start - rewrite chunk system -@@ -1808,8 +1800,6 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -1764,8 +1760,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public void getEntities(final EntityTypeTest entityTypeTest, final AABB boundingBox, final Predicate predicate, final List into, final int maxCount) { @@ -4987,11 +5032,19 @@ index a649fe6db0ec875095393ea22a11ff8787f1b28c..0de51e0374bf798d6e138bac3b113db5 if (entityTypeTest instanceof net.minecraft.world.entity.EntityType byType) { if (maxCount != Integer.MAX_VALUE) { ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(byType, boundingBox, into, predicate, maxCount); +@@ -1850,7 +1844,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + // Paper end - rewrite chunk system + + public boolean hasEntities(EntityTypeTest entityTypeTest, AABB bounds, Predicate predicate) { +- Profiler.get().incrementCounter("hasEntities"); + MutableBoolean mutableBoolean = new MutableBoolean(); + this.getEntities().get(entityTypeTest, bounds, value -> { + if (predicate.test(value)) { diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index f0f5aa48af099c8244cd59da2c1dac6744a41abe..102d88fc2989f80a39826e50ee706d853bfb2c5e 100644 +index c2e35467752c6cf5677fe8beee3145187a0090fc..b3649c97e5452d8cc6b7230891e827c6b460af44 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags; +@@ -24,8 +24,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.VisibleForDebug; @@ -5000,7 +5053,7 @@ index f0f5aa48af099c8244cd59da2c1dac6744a41abe..102d88fc2989f80a39826e50ee706d85 import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; -@@ -152,9 +150,6 @@ public final class NaturalSpawner { +@@ -154,9 +152,6 @@ public final class NaturalSpawner { } public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List categories) { @@ -5010,7 +5063,7 @@ index f0f5aa48af099c8244cd59da2c1dac6744a41abe..102d88fc2989f80a39826e50ee706d85 for (MobCategory mobCategory : categories) { // Paper start - Optional per player mob spawns final boolean canSpawn; -@@ -189,8 +184,6 @@ public final class NaturalSpawner { +@@ -191,8 +186,6 @@ public final class NaturalSpawner { // Paper end - Optional per player mob spawns } } @@ -5020,19 +5073,19 @@ index f0f5aa48af099c8244cd59da2c1dac6744a41abe..102d88fc2989f80a39826e50ee706d85 // Paper start - Add mobcaps commands diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index b80924fbe054b00fe5117df896358e330f41e993..1669c21534a453c9cf16b992df7a6bf276dea887 100644 +index c0c87b7c8e0b6b941fe8a63dc361504e94459d86..3c4de8b43a5658e02ddce7db9f453bfd344703e3 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -13,8 +13,6 @@ import net.minecraft.Util; - import net.minecraft.core.BlockPos; +@@ -14,8 +14,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.server.level.ServerLevel; + import net.minecraft.tags.EntityTypeTags; import net.minecraft.util.Mth; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntityType; -@@ -669,10 +667,7 @@ public class ServerExplosion implements Explosion { +@@ -657,10 +655,7 @@ public class ServerExplosion implements Explosion { List list = this.calculateExplodedPositions(); this.hurtEntities(); if (this.interactsWithBlocks()) { @@ -5043,55 +5096,11 @@ index b80924fbe054b00fe5117df896358e330f41e993..1669c21534a453c9cf16b992df7a6bf2 } if (this.fire) { -diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 8345405116202b59055f5343fc26b82f48008050..dbb4142ea38cdf484e74c81103cebb024ae8813d 100644 ---- a/net/minecraft/world/level/chunk/LevelChunk.java -+++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -24,8 +24,6 @@ import net.minecraft.network.protocol.game.ClientboundLevelChunkPacketData; - import net.minecraft.server.level.FullChunkStatus; - import net.minecraft.server.level.ServerLevel; - import net.minecraft.util.ProblemReporter; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.world.entity.Entity; - import net.minecraft.world.level.ChunkPos; - import net.minecraft.world.level.Level; -@@ -392,12 +390,8 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - } - - if (LightEngine.hasDifferentLightProperties(blockState, state)) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("updateSkyLightSources"); - // Paper - rewrite chunk system -- profilerFiller.popPush("queueCheckLight"); - this.level.getChunkSource().getLightEngine().checkBlock(pos); -- profilerFiller.pop(); - } - - boolean flag = !blockState.is(block); -@@ -929,8 +923,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - BlockPos blockPos = this.blockEntity.getBlockPos(); - if (LevelChunk.this.isTicking(blockPos)) { - try { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push(this::getType); - BlockState blockState = LevelChunk.this.getBlockState(blockPos); - if (this.blockEntity.getType().isValid(blockState)) { - this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); -@@ -944,8 +936,6 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - } - // Paper end - Remove the Block Entity if it's invalid - } -- -- profilerFiller.pop(); - } catch (Throwable var5) { - // Paper start - Prevent block entity and entity crashes - final String msg = String.format("BlockEntity threw exception at %s:%s,%s,%s", LevelChunk.this.getLevel().getWorld().getName(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ()); diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java -index 81de6c1bbef1cafd3036e736dd305fbedc8368c6..c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe 100644 +index b84c03cb0bddfc6fdc362a5e1432b25f67e7e23d..98abda72d88fb38a5427a15cc59094f3a7db30dc 100644 --- a/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -12,9 +12,6 @@ import java.util.function.Function; +@@ -13,9 +13,6 @@ import java.util.function.Function; import java.util.stream.Collectors; import javax.annotation.Nullable; import net.minecraft.core.BlockPos; @@ -5101,17 +5110,17 @@ index 81de6c1bbef1cafd3036e736dd305fbedc8368c6..c2baadcdceb1df6a881d6f73aa4eb4dd import net.minecraft.world.entity.Mob; import net.minecraft.world.level.PathNavigationRegion; -@@ -57,9 +54,6 @@ public class PathFinder { +@@ -62,9 +59,6 @@ public class PathFinder { @Nullable private Path findPath(Node node, List> positions, float maxRange, int accuracy, float searchDepthMultiplier) { // Paper - optimize collection - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("find_path"); - profilerFiller.markForCharting(MetricCategory.PATH_FINDING); - // Set set = targetPositions.keySet(); // Paper + // Set set = targetPositions.keySet(); // Paper - unused node.g = 0.0F; node.h = this.getBestH(node, positions); // Paper - optimize collection -@@ -129,7 +123,6 @@ public class PathFinder { +@@ -136,7 +130,6 @@ public class PathFinder { best = path; } } diff --git a/patches/todo/minecraft-patches/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch b/divinemc-server/minecraft-patches/features/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch similarity index 96% rename from patches/todo/minecraft-patches/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch rename to divinemc-server/minecraft-patches/features/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch index dec3fd2..3951dc3 100644 --- a/patches/todo/minecraft-patches/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch +++ b/divinemc-server/minecraft-patches/features/0004-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Paper PR: Add FillBottleEvents for player and dispenser diff --git a/net/minecraft/core/cauldron/CauldronInteraction.java b/net/minecraft/core/cauldron/CauldronInteraction.java -index a1ce1548bb008f1854baa4c5d6cd963c3a3f7a36..12f3875ed5638ca25787d5307de0b22cf0b63b64 100644 +index c58b4a5426dc2e502e240e9b9270ead2ef65ecbd..1618e1d985ea798c1d7485b30fad5b45a285a4b5 100644 --- a/net/minecraft/core/cauldron/CauldronInteraction.java +++ b/net/minecraft/core/cauldron/CauldronInteraction.java @@ -63,7 +63,12 @@ public interface CauldronInteraction { @@ -23,10 +23,10 @@ index a1ce1548bb008f1854baa4c5d6cd963c3a3f7a36..12f3875ed5638ca25787d5307de0b22c player.awardStat(Stats.ITEM_USED.get(item)); // level.setBlockAndUpdate(pos, Blocks.WATER_CAULDRON.defaultBlockState()); // CraftBukkit diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 582e012222123e5001c34153f2ee1ab1d08935fd..ac27ff24f018d8798921c5152e679ceed1e88d8d 100644 +index 91a1ae527589ecab1322e97efd9e863a84fcb4fe..181fdb493f64442c659165c10e237ebc198fb6e2 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -569,13 +569,25 @@ public interface DispenseItemBehavior { +@@ -578,13 +578,25 @@ public interface DispenseItemBehavior { blockStateBase -> blockStateBase.hasProperty(BeehiveBlock.HONEY_LEVEL) && blockStateBase.getBlock() instanceof BeehiveBlock ) && blockState.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) { @@ -111,10 +111,10 @@ index 105f9166297de2bfa6bdcfa9f6a0ffb00c0242ac..111f43fc5c74577f8f3067a4f84be7a6 } diff --git a/net/minecraft/world/level/block/BeehiveBlock.java b/net/minecraft/world/level/block/BeehiveBlock.java -index 3cec4c5a40c569d848bbf503501d8c8d38ecf3ce..1e92dbb04445596e3adee0ef5f1db47b7cec908e 100644 +index 0768619454a88f555dd81a609a61f49dc2578f06..4eaec4533497ec354646b75c77f74170cac672bb 100644 --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java -@@ -155,12 +155,26 @@ public class BeehiveBlock extends BaseEntityBlock { +@@ -159,12 +159,26 @@ public class BeehiveBlock extends BaseEntityBlock { flag = true; level.gameEvent(player, GameEvent.SHEAR, pos); } else if (stack.is(Items.GLASS_BOTTLE)) { diff --git a/patches/todo/minecraft-patches/0005-Paper-PR-Throttle-failed-spawn-attempts.patch b/divinemc-server/minecraft-patches/features/0005-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 83% rename from patches/todo/minecraft-patches/0005-Paper-PR-Throttle-failed-spawn-attempts.patch rename to divinemc-server/minecraft-patches/features/0005-Paper-PR-Throttle-failed-spawn-attempts.patch index 3ee3718..6477f63 100644 --- a/patches/todo/minecraft-patches/0005-Paper-PR-Throttle-failed-spawn-attempts.patch +++ b/divinemc-server/minecraft-patches/features/0005-Paper-PR-Throttle-failed-spawn-attempts.patch @@ -22,10 +22,10 @@ Example config in paper-world-defaults.yml: ``` diff --git a/net/minecraft/world/level/NaturalSpawner.java b/net/minecraft/world/level/NaturalSpawner.java -index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5d8462080 100644 +index b3649c97e5452d8cc6b7230891e827c6b460af44..f233841c43a0b3f71ed5a90b4df7d8b4902a642d 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -158,29 +158,52 @@ public final class NaturalSpawner { +@@ -160,29 +160,52 @@ public final class NaturalSpawner { // Copied from getFilteredSpawningCategories int limit = mobCategory.getMaxInstancesPerChunk(); org.bukkit.entity.SpawnCategory spawnCategory = org.bukkit.craftbukkit.util.CraftSpawnCategory.toBukkit(mobCategory); @@ -78,10 +78,9 @@ index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5 } if (canSpawn) { - spawnCategoryForChunk(mobCategory, level, chunk, spawnState::canSpawn, spawnState::afterSpawn, -- maxSpawns, level.paperConfig().entities.spawning.perPlayerMobSpawns ? level.getChunkSource().chunkMap::updatePlayerMobTypeMap : null); + // Paper start - throttle failed spawn attempts + int spawnCount = spawnCategoryForChunk(mobCategory, level, chunk, spawnState::canSpawn, spawnState::afterSpawn, -+ maxSpawns, level.paperConfig().entities.spawning.perPlayerMobSpawns ? level.getChunkSource().chunkMap::updatePlayerMobTypeMap : null, false); + maxSpawns, level.paperConfig().entities.spawning.perPlayerMobSpawns ? level.getChunkSource().chunkMap::updatePlayerMobTypeMap : null); + if (spawnCount == 0) { + chunk.failedSpawnAttempts[mobCategory.ordinal()]++; + } else { @@ -91,40 +90,32 @@ index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5 // Paper end - Optional per player mob spawns } } -@@ -204,12 +227,21 @@ public final class NaturalSpawner { +@@ -204,14 +227,16 @@ public final class NaturalSpawner { + // Paper start - Optional per player mob spawns + spawnCategoryForChunk(category, level, chunk, filter, callback, Integer.MAX_VALUE, null); } - public static void spawnCategoryForChunk( +- public static void spawnCategoryForChunk( ++ public static int spawnCategoryForChunk( // Paper - throttle failed spawn attempts MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final Consumer trackEntity -+ // Paper start - throttle failed spawn attempts -+ ) { -+ spawnCategoryForChunk(category, level, chunk, filter, callback, maxSpawns, trackEntity, false); -+ } -+ public static int spawnCategoryForChunk( -+ MobCategory category, ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final Consumer trackEntity, final boolean nothing -+ // Paper end - throttle failed spawn attempts ) { // Paper end - Optional per player mob spawns BlockPos randomPosWithin = getRandomPosWithin(level, chunk); if (randomPosWithin.getY() >= level.getMinY() + 1) { - spawnCategoryForPosition(category, level, chunk, randomPosWithin, filter, callback, maxSpawns, trackEntity); // Paper - Optional per player mob spawns -+ return spawnCategoryForPosition(category, level, chunk, randomPosWithin, filter, callback, maxSpawns, trackEntity, false); // Paper - Optional per player mob spawns // Paper - throttle failed spawn attempts ++ return spawnCategoryForPosition(category, level, chunk, randomPosWithin, filter, callback, maxSpawns, trackEntity); // Paper - Optional per player mob spawns // Paper - throttle failed spawn attempts } + + return 0; // Paper - throttle failed spawn attempts } @VisibleForDebug -@@ -229,16 +261,22 @@ public final class NaturalSpawner { +@@ -229,18 +254,17 @@ public final class NaturalSpawner { + ) { + spawnCategoryForPosition(category, level, chunk, pos, filter, callback, Integer.MAX_VALUE, null); } - public static void spawnCategoryForPosition( +- public static void spawnCategoryForPosition( ++ public static int spawnCategoryForPosition( // Paper - throttle failed spawn attempts MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final @Nullable Consumer trackEntity -+ // Paper start - throttle failed spawn attempts -+ ) { -+ spawnCategoryForPosition(category, level, chunk, pos, filter, callback, maxSpawns, trackEntity, false); -+ } -+ public static int spawnCategoryForPosition( -+ MobCategory category, ServerLevel level, ChunkAccess chunk, BlockPos pos, NaturalSpawner.SpawnPredicate filter, NaturalSpawner.AfterSpawnCallback callback, final int maxSpawns, final @Nullable Consumer trackEntity, final boolean nothing -+ // Paper end - throttle failed spawn attempts ) { // Paper end - Optional per player mob spawns StructureManager structureManager = level.structureManager(); @@ -139,7 +130,7 @@ index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5 for (int i1 = 0; i1 < 3; i1++) { int x = pos.getX(); int z = pos.getZ(); -@@ -278,14 +316,14 @@ public final class NaturalSpawner { +@@ -280,14 +304,14 @@ public final class NaturalSpawner { } // Paper end - per player mob count backoff if (doSpawning == PreSpawnStatus.ABORT) { @@ -156,7 +147,7 @@ index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5 } mobForSpawn.snapTo(d, y, d1, level.random.nextFloat() * 360.0F, 0.0F); -@@ -308,7 +346,7 @@ public final class NaturalSpawner { +@@ -310,7 +334,7 @@ public final class NaturalSpawner { } // CraftBukkit end if (i >= mobForSpawn.getMaxSpawnClusterSize() || i >= maxSpawns) { // Paper - Optional per player mob spawns @@ -165,7 +156,7 @@ index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5 } if (mobForSpawn.isMaxGroupSizeReached(i3)) { -@@ -321,6 +359,8 @@ public final class NaturalSpawner { +@@ -323,6 +347,8 @@ public final class NaturalSpawner { } } } @@ -175,30 +166,30 @@ index 345d4b80bd4383e0fb66d744d87bc8ef4100fd32..68a074a1eb11b158af773a2c44aa49d5 private static boolean isRightDistanceToPlayerAndSpawnPoint(ServerLevel level, ChunkAccess chunk, BlockPos.MutableBlockPos pos, double distance) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 182c14b660f8860bed627eed4e01fd4002153e9a..81511de113c292549fe5fe720a15bf3e0497ca84 100644 +index 9889485b15501c1adf1a73bb4603d3477860482d..2457247d2bc1c3e3b042a091c3a8290d55203da8 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -88,6 +88,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -86,6 +86,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh + private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); // CraftBukkit end - public final Registry biomeRegistry; // CraftBukkit + public final long[] failedSpawnAttempts = new long[net.minecraft.world.entity.MobCategory.values().length]; // Paper - throttle failed spawn attempts // Paper start - rewrite chunk system private volatile ca.spottedleaf.moonrise.patches.starlight.light.SWMRNibbleArray[] blockNibbles; diff --git a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -index e04d3479383cd480cf35ed7ac3c82e7f6fb69e28..87abba1241552fe967229f1b442cd0a767cbf739 100644 +index 84840f50d1bcebc7b0bdb1d2f79b53fd6fc98abb..38cdc0f8ce03cfd99658177f609ba3a6590cf000 100644 --- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java -@@ -94,6 +94,7 @@ public record SerializableChunkData( +@@ -93,6 +93,7 @@ public record SerializableChunkData( List blockEntities, CompoundTag structureData , @Nullable net.minecraft.nbt.Tag persistentDataContainer // CraftBukkit - persistentDataContainer + , @Nullable long[] failedSpawnAttempts // Paper - throttle failed spawn attempts ) { - public static final Codec> BLOCK_STATE_CODEC = PalettedContainer.codecRW( - Block.BLOCK_STATE_REGISTRY, BlockState.CODEC, PalettedContainer.Strategy.SECTION_STATES, Blocks.AIR.defaultBlockState(), null // Paper - Anti-Xray -@@ -190,6 +191,19 @@ public record SerializableChunkData( + private static final Codec>> BLOCK_TICKS_CODEC = SavedTick.codec(BuiltInRegistries.BLOCK.byNameCodec()).listOf(); + private static final Codec>> FLUID_TICKS_CODEC = SavedTick.codec(BuiltInRegistries.FLUID.byNameCodec()).listOf(); +@@ -186,6 +187,19 @@ public record SerializableChunkData( lists[i] = list2; } @@ -218,7 +209,7 @@ index e04d3479383cd480cf35ed7ac3c82e7f6fb69e28..87abba1241552fe967229f1b442cd0a7 List list3 = tag.getList("entities").stream().flatMap(ListTag::compoundStream).toList(); List list4 = tag.getList("block_entities").stream().flatMap(ListTag::compoundStream).toList(); CompoundTag compoundOrEmpty = tag.getCompoundOrEmpty("structures"); -@@ -270,6 +284,7 @@ public record SerializableChunkData( +@@ -258,6 +272,7 @@ public record SerializableChunkData( list4, compoundOrEmpty , tag.get("ChunkBukkitValues") // CraftBukkit - ChunkBukkitValues @@ -226,7 +217,7 @@ index e04d3479383cd480cf35ed7ac3c82e7f6fb69e28..87abba1241552fe967229f1b442cd0a7 ); } } -@@ -426,6 +441,15 @@ public record SerializableChunkData( +@@ -421,6 +436,15 @@ public record SerializableChunkData( chunkAccess.addPackedPostProcess(this.postProcessingSections[i], i); } @@ -242,15 +233,15 @@ index e04d3479383cd480cf35ed7ac3c82e7f6fb69e28..87abba1241552fe967229f1b442cd0a7 if (chunkType == ChunkType.LEVELCHUNK) { return this.loadStarlightLightData(level, new ImposterProtoChunk((LevelChunk)chunkAccess, false)); // Paper - starlight } else { -@@ -556,6 +580,7 @@ public record SerializableChunkData( +@@ -536,6 +560,7 @@ public record SerializableChunkData( persistentDataContainer = chunk.persistentDataContainer.toTagCompound(); } // CraftBukkit end + final long[] failedSpawnAttemptsData = chunk.failedSpawnAttempts; // Paper - throttle failed spawn attempts return new SerializableChunkData( - level.registryAccess().lookupOrThrow(Registries.BIOME), + level.palettedContainerFactory(), pos, -@@ -576,6 +601,7 @@ public record SerializableChunkData( +@@ -556,6 +581,7 @@ public record SerializableChunkData( list1, compoundTag , persistentDataContainer // CraftBukkit - persistentDataContainer @@ -258,7 +249,7 @@ index e04d3479383cd480cf35ed7ac3c82e7f6fb69e28..87abba1241552fe967229f1b442cd0a7 ); } } -@@ -660,6 +686,21 @@ public record SerializableChunkData( +@@ -641,6 +667,21 @@ public record SerializableChunkData( compoundTag.put("ChunkBukkitValues", this.persistentDataContainer); } // CraftBukkit end @@ -280,7 +271,7 @@ index e04d3479383cd480cf35ed7ac3c82e7f6fb69e28..87abba1241552fe967229f1b442cd0a7 // Paper start - starlight if (this.lightCorrect && !this.chunkStatus.isBefore(net.minecraft.world.level.chunk.status.ChunkStatus.LIGHT)) { // clobber vanilla value to force vanilla to relight -@@ -875,4 +916,49 @@ public record SerializableChunkData( +@@ -856,4 +897,49 @@ public record SerializableChunkData( } // Paper end - starlight - convert from record } diff --git a/patches/todo/minecraft-patches/0006-Raytrace-AntiXray-SDK-integration.patch b/divinemc-server/minecraft-patches/features/0006-Raytrace-AntiXray-SDK-integration.patch similarity index 87% rename from patches/todo/minecraft-patches/0006-Raytrace-AntiXray-SDK-integration.patch rename to divinemc-server/minecraft-patches/features/0006-Raytrace-AntiXray-SDK-integration.patch index 0b7d832..8b58711 100644 --- a/patches/todo/minecraft-patches/0006-Raytrace-AntiXray-SDK-integration.patch +++ b/divinemc-server/minecraft-patches/features/0006-Raytrace-AntiXray-SDK-integration.patch @@ -8,10 +8,10 @@ Integration with Imanity Software's Raytrace AntiXray for better use of this plu Original project: https://github.com/Imanity-Software/raytrace-antixray-spigot-sdk diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java -index c4a4f08272b34f72dea4feaaeb66d153b2aab8c8..be5da5a81246b4f4abe19f7c0cf68990d6bdf5bd 100644 +index 599d6a4f31e05369caf3ef9f5e54e83396743ec0..07dd9b8088e363110ecab24026a20485484710c4 100644 --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -296,6 +296,12 @@ public class ServerPlayerGameMode { +@@ -316,6 +316,12 @@ public class ServerPlayerGameMode { org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelectedItem()); // CraftBukkit } } @@ -25,10 +25,10 @@ index c4a4f08272b34f72dea4feaaeb66d153b2aab8c8..be5da5a81246b4f4abe19f7c0cf68990 } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 4c1ce7e85f9c3315635472047ffaf15a711aeffd..9625213b7c1295b813071dbedea5366510c7072f 100644 +index 5b50b86c735fa2ba1b5452aacda7db5e64012076..b94b946986258fed3c6d68d9972a657e176d08a4 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -1171,6 +1171,12 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -1125,6 +1125,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl snapshot.setFlags(flags); // Paper - always set the flag of the most recent call to mitigate issues with multiple update at the same pos with different flags } BlockState blockState = chunkAt.setBlockState(pos, state, flags); diff --git a/patches/todo/minecraft-patches/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch b/divinemc-server/minecraft-patches/features/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch similarity index 59% rename from patches/todo/minecraft-patches/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch rename to divinemc-server/minecraft-patches/features/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch index 24cf19a..726038c 100644 --- a/patches/todo/minecraft-patches/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch +++ b/divinemc-server/minecraft-patches/features/0007-Paper-PR-Add-ticket-on-player-join-to-avoid-chunk-lo.patch @@ -15,32 +15,32 @@ The delay is currently set to 2 seconds, however, we may want to adjust this bef This patch fixes PaperMC/Paper#9581 diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index bdc1200ef5317fdaf58973bf580b0a672aee800f..1ed2ae41e47b2446bf1835efc8bad369408d52da 100644 +index 8697528095ebed543ee1bb3b6b617a26a800bd5d..4fc29f7aae32180f86af971f7f80a37aa6e797e4 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java @@ -48,6 +48,7 @@ public final class RegionizedPlayerChunkLoader { - public static final TicketType PLAYER_TICKET = ChunkSystemTicketType.create("chunk_system:player_ticket", Long::compareTo); - public static final TicketType PLAYER_TICKET_DELAYED = ChunkSystemTicketType.create("chunk_system:player_ticket_delayed", Long::compareTo, 1L); + public static final TicketType PLAYER_TICKET = ChunkSystemTicketType.create("chunk_system:player_ticket", Long::compareTo, 0L, TicketType.FLAG_LOADING | TicketType.FLAG_SIMULATION | TicketType.FLAG_KEEP_DIMENSION_ACTIVE); + public static final TicketType PLAYER_TICKET_DELAYED = ChunkSystemTicketType.create("chunk_system:player_ticket_delayed", Long::compareTo, 1L, TicketType.FLAG_LOADING | TicketType.FLAG_SIMULATION | TicketType.FLAG_KEEP_DIMENSION_ACTIVE); + public static final TicketType PLAYER_JOIN = ChunkSystemTicketType.create("chunk_system:player_join", (a, b) -> 0, 5 * 20); // Paper - Add ticket on player join to avoid chunk load-unload-load cycle public static final int GENERATED_TICKET_LEVEL = ChunkHolderManager.FULL_LOADED_TICKET_LEVEL; public static final int LOADED_TICKET_LEVEL = ChunkTaskScheduler.getTicketLevel(ChunkStatus.EMPTY); diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 8a67672f1175769ac213099331453fbae59442fa..c70b5ce2dc8cbcdea8715339a63e038f94849bfb 100644 +index 561165ccc8c4d66ef590fb8deb65782a214d9611..79210997e56ec6798d249608049e108724670cde 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -315,6 +315,13 @@ public abstract class PlayerList { - // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below - // Paper start - Fire PlayerJoinEvent when Player is actually ready; correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks - player.supressTrackerForLogin = true; -+ // Paper start - Add ticket on player join to avoid chunk load-unload-load cycle -+ serverLevel.moonrise$getChunkTaskScheduler().chunkHolderManager.addTicketAtLevel( -+ ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PLAYER_JOIN, -+ player.chunkPosition(), -+ ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.TICK_TICKET_LEVEL, -+ net.minecraft.util.Unit.INSTANCE); -+ // Paper end - Add ticket on player join to avoid chunk load-unload-load cycle - serverLevel.addNewPlayer(player); - this.server.getCustomBossEvents().onPlayerConnect(player); // see commented out section below serverLevel.addPlayerJoin(player); - // Paper end - Fire PlayerJoinEvent when Player is actually ready +@@ -220,6 +220,13 @@ public abstract class PlayerList { + // this.broadcastAll(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player))); // CraftBukkit - replaced with loop below + // Paper start - Fire PlayerJoinEvent when Player is actually ready; correctly register player BEFORE PlayerJoinEvent, so the entity is valid and doesn't require tick delay hacks + player.suppressTrackerForLogin = true; ++ // Paper start - Add ticket on player join to avoid chunk load-unload-load cycle ++ serverLevel.moonrise$getChunkTaskScheduler().chunkHolderManager.addTicketAtLevel( ++ ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PLAYER_JOIN, ++ player.chunkPosition(), ++ ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.TICK_TICKET_LEVEL, ++ net.minecraft.util.Unit.INSTANCE); ++ // Paper end - Add ticket on player join to avoid chunk load-unload-load cycle + this.sendLevelInfo(player, serverLevel); + serverLevel.addNewPlayer(player); + this.server.getCustomBossEvents().onPlayerConnect(player); // see commented out section below serverLevel.addPlayerJoin(player); diff --git a/patches/todo/minecraft-patches/0008-Smooth-teleport-API.patch b/divinemc-server/minecraft-patches/features/0008-Smooth-teleport-API.patch similarity index 82% rename from patches/todo/minecraft-patches/0008-Smooth-teleport-API.patch rename to divinemc-server/minecraft-patches/features/0008-Smooth-teleport-API.patch index 135fb6e..8c32a4d 100644 --- a/patches/todo/minecraft-patches/0008-Smooth-teleport-API.patch +++ b/divinemc-server/minecraft-patches/features/0008-Smooth-teleport-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Smooth teleport API diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index f7b73c4c472e53ea5593d855e7194b4eb5e4d2f5..53a0024ef133183e16b7dc06529917a4173e9b17 100644 +index 161dbd49495c33fb938a6312b6e24912474864c5..dd933185b1afadae52b51c95bb566bb453a9bfed 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -430,6 +430,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -443,6 +443,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc private boolean tpsBar = false; // Purpur - Implement TPSBar private boolean compassBar = false; // Purpur - Add compass command private boolean ramBar = false; // Purpur - Implement rambar commands @@ -17,10 +17,10 @@ index f7b73c4c472e53ea5593d855e7194b4eb5e4d2f5..53a0024ef133183e16b7dc06529917a4 // Paper start - rewrite chunk system private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 1fd3e78c7d3e35f0d9fc8abab2fb7efa8bcfd05c..1e4ebfa25e63c148fe7bf6cf5789e602d8e5ca83 100644 +index 79210997e56ec6798d249608049e108724670cde..6c6213323df278391b30dd9f22c408a34ec052c8 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -747,11 +747,11 @@ public abstract class PlayerList { +@@ -664,11 +664,11 @@ public abstract class PlayerList { byte b = (byte)(keepInventory ? 1 : 0); ServerLevel serverLevel = serverPlayer.level(); LevelData levelData = serverLevel.getLevelData(); @@ -29,12 +29,12 @@ index 1fd3e78c7d3e35f0d9fc8abab2fb7efa8bcfd05c..1e4ebfa25e63c148fe7bf6cf5789e602 // serverPlayer.connection.teleport(serverPlayer.getX(), serverPlayer.getY(), serverPlayer.getZ(), serverPlayer.getYRot(), serverPlayer.getXRot()); serverPlayer.connection.send(new ClientboundSetChunkCacheRadiusPacket(serverLevel.spigotConfig.viewDistance)); // Spigot serverPlayer.connection.send(new ClientboundSetSimulationDistancePacket(serverLevel.spigotConfig.simulationDistance)); // Spigot -- serverPlayer.connection.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(serverPlayer.position(), serverLevel.getWorld(), serverPlayer.getYRot(), serverPlayer.getXRot())); // CraftBukkit -+ if (!serverPlayer.smoothWorldTeleport || !isSameLogicalHeight((ServerLevel) fromWorld, level)) serverPlayer.connection.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(serverPlayer.position(), serverLevel.getWorld(), serverPlayer.getYRot(), serverPlayer.getXRot())); // DivineMC - Smooth teleport API - serverPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getSharedSpawnPos(), level.getSharedSpawnAngle())); +- serverPlayer.connection.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(serverPlayer.position(), serverLevel, serverPlayer.getYRot(), serverPlayer.getXRot())); // CraftBukkit ++ if (!serverPlayer.smoothWorldTeleport || !isSameLogicalHeight((ServerLevel) fromWorld, level)) serverPlayer.connection.teleport(org.bukkit.craftbukkit.util.CraftLocation.toBukkit(serverPlayer.position(), serverLevel, serverPlayer.getYRot(), serverPlayer.getXRot())); // DivineMC - Smooth teleport API + serverPlayer.connection.send(new ClientboundSetDefaultSpawnPositionPacket(level.getRespawnData())); serverPlayer.connection.send(new ClientboundChangeDifficultyPacket(levelData.getDifficulty(), levelData.isDifficultyLocked())); serverPlayer.connection -@@ -838,6 +838,12 @@ public abstract class PlayerList { +@@ -756,6 +756,12 @@ public abstract class PlayerList { return serverPlayer; } diff --git a/patches/todo/minecraft-patches/0009-lithium-fast_util.patch b/divinemc-server/minecraft-patches/features/0009-lithium-fast_util.patch similarity index 90% rename from patches/todo/minecraft-patches/0009-lithium-fast_util.patch rename to divinemc-server/minecraft-patches/features/0009-lithium-fast_util.patch index d4a982d..4e9fc32 100644 --- a/patches/todo/minecraft-patches/0009-lithium-fast_util.patch +++ b/divinemc-server/minecraft-patches/features/0009-lithium-fast_util.patch @@ -11,10 +11,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/core/Direction.java b/net/minecraft/core/Direction.java -index 63fd7b45750430b565d599337d3112cbaa7e7550..4275a2e1e29c15cdda75c29c468255635f5c7bc1 100644 +index 6e2b67350dd23a76a9f702ed192c8ae064d13915..f89d261b5ddd8413bc82eeade26a180010b5d6b1 100644 --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java -@@ -222,7 +222,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -225,7 +225,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public Direction getOpposite() { @@ -23,7 +23,7 @@ index 63fd7b45750430b565d599337d3112cbaa7e7550..4275a2e1e29c15cdda75c29c46825563 } public Direction getClockWise(Direction.Axis axis) { -@@ -355,7 +355,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -358,7 +358,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public static Direction getRandom(RandomSource random) { @@ -33,7 +33,7 @@ index 63fd7b45750430b565d599337d3112cbaa7e7550..4275a2e1e29c15cdda75c29c46825563 public static Direction getApproximateNearest(double x, double y, double z) { diff --git a/net/minecraft/world/phys/AABB.java b/net/minecraft/world/phys/AABB.java -index e53398996bbb278c6e06024d8ca945b364a44c10..13678a9c0f9056b4925e4de927ec3cbc01cb114e 100644 +index 9987e2e8278cd43c6c52063132670486ac189677..5f745afa7f30cd61e45d60d877e13c50cf818de7 100644 --- a/net/minecraft/world/phys/AABB.java +++ b/net/minecraft/world/phys/AABB.java @@ -19,6 +19,15 @@ public class AABB { diff --git a/patches/todo/minecraft-patches/0010-C2ME-Optimize-world-gen-math.patch b/divinemc-server/minecraft-patches/features/0010-C2ME-Optimize-world-gen-math.patch similarity index 68% rename from patches/todo/minecraft-patches/0010-C2ME-Optimize-world-gen-math.patch rename to divinemc-server/minecraft-patches/features/0010-C2ME-Optimize-world-gen-math.patch index 4926869..a8f2d21 100644 --- a/patches/todo/minecraft-patches/0010-C2ME-Optimize-world-gen-math.patch +++ b/divinemc-server/minecraft-patches/features/0010-C2ME-Optimize-world-gen-math.patch @@ -11,7 +11,7 @@ As part of: C2ME-fabric (https://github.com/RelativityMC/C2ME-fabric) Licensed under: MIT diff --git a/net/minecraft/world/level/ChunkPos.java b/net/minecraft/world/level/ChunkPos.java -index 55ce935a2fab7e32904d9ff599867269035d703f..7770e2aacaa7772a1710172f143452f076c6eef2 100644 +index 4caaed6d36a6d12279d68e974a2e8381ba84a951..16b5dac678790cebc8fb577fa2f1c7a05aaeb85b 100644 --- a/net/minecraft/world/level/ChunkPos.java +++ b/net/minecraft/world/level/ChunkPos.java @@ -110,7 +110,12 @@ public class ChunkPos { @@ -29,10 +29,10 @@ index 55ce935a2fab7e32904d9ff599867269035d703f..7770e2aacaa7772a1710172f143452f0 public int getMiddleBlockX() { diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java -index 74d8202b5c9bb2a3ee832be70f95c0b5cbecb460..86c15d2d90e63d21cb83622a7b29e11151a4f64a 100644 +index 5e1d88ef91e585a34e9213da923df796dd866e03..c9ddfc8670614c2d8629066b0cc805d18e4f662f 100644 --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java -@@ -131,8 +131,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -168,8 +168,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } private static double getBuryContribution(double x, double y, double z) { @@ -50,19 +50,18 @@ index 74d8202b5c9bb2a3ee832be70f95c0b5cbecb460..86c15d2d90e63d21cb83622a7b29e111 private static double getBeardContribution(int x, int y, int z, int height) { diff --git a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index 65728ef17e63d71833677fdcbd5bb90794b4822b..5716e80ba386f113d02f5d6a4848914d4bf9600f 100644 +index 199a9c4fba5fc80f04524a188270fdc9014f7950..952d00151cc6c295f37bcc499ddcb8155185c79c 100644 --- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -68,8 +68,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { - Aquifer.FluidStatus fluidStatus = new Aquifer.FluidStatus(-54, Blocks.LAVA.defaultBlockState()); - int seaLevel = settings.seaLevel(); - Aquifer.FluidStatus fluidStatus1 = new Aquifer.FluidStatus(seaLevel, settings.defaultFluid()); -- Aquifer.FluidStatus fluidStatus2 = new Aquifer.FluidStatus(DimensionType.MIN_Y * 2, Blocks.AIR.defaultBlockState()); -- return (x, y, z) -> y < Math.min(-54, seaLevel) ? fluidStatus : fluidStatus1; -+ // DivineMC start - C2ME: Optimize world gen math -+ final int min = Math.min(-54, seaLevel); -+ return (x, y, z) -> y < min ? fluidStatus : fluidStatus1; -+ // DivineMC end - C2ME: Optimize world gen math +@@ -73,7 +73,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { + if (SharedConstants.DEBUG_DISABLE_FLUID_GENERATION) { + return fluidStatus2; + } else { +- return y < Math.min(-54, seaLevel) ? fluidStatus : fluidStatus1; ++ // DivineMC start - C2ME: Optimize world gen math ++ final int min = Math.min(-54, seaLevel); ++ return y < min ? fluidStatus : fluidStatus1; ++ // DivineMC end - C2ME: Optimize world gen math + } + }; } - - @Override diff --git a/patches/todo/minecraft-patches/0011-Async-locate-command.patch b/divinemc-server/minecraft-patches/features/0011-Async-locate-command.patch similarity index 97% rename from patches/todo/minecraft-patches/0011-Async-locate-command.patch rename to divinemc-server/minecraft-patches/features/0011-Async-locate-command.patch index 9121ec7..83dfea0 100644 --- a/patches/todo/minecraft-patches/0011-Async-locate-command.patch +++ b/divinemc-server/minecraft-patches/features/0011-Async-locate-command.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Async locate command diff --git a/net/minecraft/server/commands/LocateCommand.java b/net/minecraft/server/commands/LocateCommand.java -index a734b2597c3491db35d9660e169f8e8b6320900b..1692724f5406a22702f185f66073dd5e836ce7f8 100644 +index de314f1958304ea3285dfdd776f73f0628cd5af8..1692724f5406a22702f185f66073dd5e836ce7f8 100644 --- a/net/minecraft/server/commands/LocateCommand.java +++ b/net/minecraft/server/commands/LocateCommand.java @@ -100,44 +100,77 @@ public class LocateCommand { @@ -122,7 +122,7 @@ index a734b2597c3491db35d9660e169f8e8b6320900b..1692724f5406a22702f185f66073dd5e .withHoverEvent(new HoverEvent.ShowText(Component.translatable("chat.coordinates.tooltip"))) ); source.sendSuccess(() -> Component.translatable(translationKey, elementName, component, i), false); -- LOGGER.info("Locating element " + elementName + " took " + duration.toMillis() + " ms"); +- LOGGER.info("Locating element {} took {} ms", elementName, duration.toMillis()); + LOGGER.info("Locating element {} on Thread:{} took {} ms", elementName, Thread.currentThread().getName(), duration.toMillis()); // DivineMC - Log thread name return i; } diff --git a/patches/todo/minecraft-patches/0012-Carpet-Fixes-RecipeManager-Optimize.patch b/divinemc-server/minecraft-patches/features/0012-Carpet-Fixes-RecipeManager-Optimize.patch similarity index 100% rename from patches/todo/minecraft-patches/0012-Carpet-Fixes-RecipeManager-Optimize.patch rename to divinemc-server/minecraft-patches/features/0012-Carpet-Fixes-RecipeManager-Optimize.patch diff --git a/patches/todo/minecraft-patches/0013-lithium-faster-chunk-serialization.patch b/divinemc-server/minecraft-patches/features/0013-lithium-faster-chunk-serialization.patch similarity index 76% rename from patches/todo/minecraft-patches/0013-lithium-faster-chunk-serialization.patch rename to divinemc-server/minecraft-patches/features/0013-lithium-faster-chunk-serialization.patch index 715e371..c175f34 100644 --- a/patches/todo/minecraft-patches/0013-lithium-faster-chunk-serialization.patch +++ b/divinemc-server/minecraft-patches/features/0013-lithium-faster-chunk-serialization.patch @@ -13,7 +13,7 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/util/BitStorage.java b/net/minecraft/util/BitStorage.java -index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..a0a0ec8747cf6477df8943d2268dece8e064cb33 100644 +index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..89c65b8e4b99b78ec847f0ef958166a645ed4324 100644 --- a/net/minecraft/util/BitStorage.java +++ b/net/minecraft/util/BitStorage.java @@ -38,4 +38,6 @@ public interface BitStorage extends ca.spottedleaf.moonrise.patches.block_counti @@ -21,10 +21,10 @@ index 02502d50f0255f5bbcc0ecb965abb48cc1a112da..a0a0ec8747cf6477df8943d2268dece8 } // Paper end - block counting + -+ void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out); // DivineMC - lithium: faster chunk serialization ++ void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out, net.minecraft.world.level.chunk.PalettedContainer resizeHandler); // DivineMC - lithium: faster chunk serialization } diff --git a/net/minecraft/util/SimpleBitStorage.java b/net/minecraft/util/SimpleBitStorage.java -index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..1d8125e23e34a929da6fb4e361eae3ccbaeabce9 100644 +index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..536cf90d2c4bccabe67bffde6bc4fa644a9e7d63 100644 --- a/net/minecraft/util/SimpleBitStorage.java +++ b/net/minecraft/util/SimpleBitStorage.java @@ -465,4 +465,44 @@ public class SimpleBitStorage implements BitStorage { @@ -34,7 +34,7 @@ index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..1d8125e23e34a929da6fb4e361eae3cc + + // DivineMC start - lithium: faster chunk serialization + @Override -+ public void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out) { ++ public void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out, net.minecraft.world.level.chunk.PalettedContainer resizeHandler) { + if (this.size >= Short.MAX_VALUE) { + throw new IllegalStateException("Array too large"); + } @@ -55,7 +55,7 @@ index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..1d8125e23e34a929da6fb4e361eae3cc + int remappedId = mappings[value]; + + if (remappedId == 0) { -+ remappedId = dstPalette.idFor(srcPalette.valueFor(value)) + 1; ++ remappedId = dstPalette.idFor(srcPalette.valueFor(value), resizeHandler) + 1; + mappings[value] = (short) remappedId; + } + @@ -73,7 +73,7 @@ index e6306a68c8652d4c5d22d5ecb1416f5f931f76ee..1d8125e23e34a929da6fb4e361eae3cc + // DivineMC end - lithium: faster chunk serialization } diff --git a/net/minecraft/util/ZeroBitStorage.java b/net/minecraft/util/ZeroBitStorage.java -index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..6e264b311894f510112beb996190f5ff6943e5e8 100644 +index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..6fdd51c767399bce29dce1ecea2e13072a6f4d00 100644 --- a/net/minecraft/util/ZeroBitStorage.java +++ b/net/minecraft/util/ZeroBitStorage.java @@ -80,4 +80,6 @@ public class ZeroBitStorage implements BitStorage { @@ -81,14 +81,14 @@ index 09fd99c9cbd23b5f3c899bfb00c9b89651948ed8..6e264b311894f510112beb996190f5ff } // Paper end - block counting + -+ @Override public void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out) { } // DivineMC - lithium: faster chunk serialization ++ @Override public void compact(net.minecraft.world.level.chunk.Palette srcPalette, net.minecraft.world.level.chunk.Palette dstPalette, short[] out, net.minecraft.world.level.chunk.PalettedContainer resizeHandler) { } // DivineMC - lithium: faster chunk serialization } diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java -index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..9d892c1c3890e0aaf13fd5cd7b7d138afeaad260 100644 +index 1843046fe145bb23f2e9cf3269fb05c0fb617603..f1cae4cab36546d5798d2b59ac59774d1c9838c0 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -32,6 +32,23 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - private final PalettedContainer.Strategy strategy; +@@ -29,6 +29,23 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + private final T @org.jetbrains.annotations.Nullable [] presetValues; // Paper - Anti-Xray - Add preset values //private final ThreadingDetector threadingDetector = new ThreadingDetector("PalettedContainer"); // Paper - unused + // DivineMC start - lithium: faster chunk serialization @@ -111,24 +111,25 @@ index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..9d892c1c3890e0aaf13fd5cd7b7d138a public void acquire() { // this.threadingDetector.checkAndLock(); // Paper - disable this - use proper synchronization } -@@ -343,28 +360,49 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - public synchronized PalettedContainerRO.PackedData pack(IdMap registry, PalettedContainer.Strategy strategy) { // Paper - synchronize +@@ -340,29 +357,49 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + public synchronized PalettedContainerRO.PackedData pack(Strategy strategy) { // Paper - synchronize this.acquire(); -- PalettedContainerRO.PackedData var12; +- PalettedContainerRO.PackedData var14; + // DivineMC start - lithium: faster chunk serialization + Optional data = Optional.empty(); + List elements = null; try { -- HashMapPalette hashMapPalette = new HashMapPalette<>(registry, this.data.storage.getBits(), this.dummyPaletteResize); -- int size = strategy.size(); -- int[] ints = new int[size]; -- this.data.storage.unpack(ints); -- swapPalette(ints, id -> hashMapPalette.idFor(this.data.palette.valueFor(id))); -- int i = strategy.calculateBitsForSerialization(registry, hashMapPalette.getSize()); +- BitStorage bitStorage = this.data.storage; +- Palette palette = this.data.palette; +- HashMapPalette hashMapPalette = new HashMapPalette<>(bitStorage.getBits()); +- int entryCount = strategy.entryCount(); +- int[] ints = reencodeContents(bitStorage, palette, hashMapPalette); +- Configuration configurationForPaletteSize = strategy.getConfigurationForPaletteSize(hashMapPalette.getSize()); +- int i = configurationForPaletteSize.bitsInStorage(); - Optional optional; - if (i != 0) { -- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(i, size, ints); +- SimpleBitStorage simpleBitStorage = new SimpleBitStorage(i, entryCount, ints); - optional = Optional.of(Arrays.stream(simpleBitStorage.getRaw())); - } else { - optional = Optional.empty(); @@ -142,18 +143,18 @@ index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..9d892c1c3890e0aaf13fd5cd7b7d138a + hashPalette = lithiumHashPalette; } -- var12 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional); +- var14 = new PalettedContainerRO.PackedData<>(hashMapPalette.getEntries(), optional, i); + if (elements == null) { -+ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(registry, storage.getBits(), this.dummyPaletteResize); -+ short[] array = this.getOrCreate(strategy.size()); ++ net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette compactedPalette = new net.caffeinemc.mods.lithium.common.world.chunk.LithiumHashPalette<>(storage.getBits()); ++ short[] array = this.getOrCreate(strategy.entryCount()); + -+ storage.compact(this.data.palette(), compactedPalette, array); ++ storage.compact(this.data.palette(), compactedPalette, array, this); + -+ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.calculateBitsForSerialization(registry, hashPalette.getSize())) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279 ++ if (hashPalette != null && hashPalette.getSize() == compactedPalette.getSize() && storage.getBits() == strategy.getConfigurationForPaletteSize(hashPalette.getSize()).bitsInStorage()) { // paletteSize can de-sync from palette - see https://github.com/CaffeineMC/lithium-fabric/issues/279 + data = this.asOptional(storage.getRaw().clone()); + elements = hashPalette.getElements(); + } else { -+ int bits = strategy.calculateBitsForSerialization(registry, compactedPalette.getSize()); ++ int bits = strategy.getConfigurationForPaletteSize(compactedPalette.getSize()).bitsInStorage(); + if (bits != 0) { + SimpleBitStorage copy = new SimpleBitStorage(bits, array.length); + for (int i = 0; i < array.length; ++i) { @@ -170,13 +171,13 @@ index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..9d892c1c3890e0aaf13fd5cd7b7d138a this.release(); } -- return var12; +- return var14; + return new PalettedContainerRO.PackedData<>(elements, data); + // DivineMC end - lithium: faster chunk serialization } - private static void swapPalette(int[] bits, IntUnaryOperator operator) { -@@ -404,13 +442,31 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + private static int[] reencodeContents(BitStorage storage, Palette oldPalette, Palette newPalette) { +@@ -412,13 +449,31 @@ public class PalettedContainer implements PaletteResize, PalettedContainer @Override public void count(PalettedContainer.CountConsumer countConsumer) { @@ -184,8 +185,8 @@ index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..9d892c1c3890e0aaf13fd5cd7b7d138a - countConsumer.accept(this.data.palette.valueFor(0), this.data.storage.getSize()); - } else { - Int2IntOpenHashMap map = new Int2IntOpenHashMap(); -- this.data.storage.getAll(id -> map.addTo(id, 1)); -- map.int2IntEntrySet().forEach(idEntry -> countConsumer.accept(this.data.palette.valueFor(idEntry.getIntKey()), idEntry.getIntValue())); +- this.data.storage.getAll(i -> map.addTo(i, 1)); +- map.int2IntEntrySet().forEach(entry -> countConsumer.accept(this.data.palette.valueFor(entry.getIntKey()), entry.getIntValue())); + // DivineMC start - lithium: faster chunk serialization + int len = this.data.palette().getSize(); + @@ -213,4 +214,4 @@ index a251ba67644cd02a0b00d7c8b0e2c64aa5e26291..9d892c1c3890e0aaf13fd5cd7b7d138a + // DivineMC end - lithium: faster chunk serialization } - record Configuration(Palette.Factory factory, int bits) { + @FunctionalInterface diff --git a/patches/todo/minecraft-patches/0014-C2ME-optimize-noise-generation.patch b/divinemc-server/minecraft-patches/features/0014-C2ME-optimize-noise-generation.patch similarity index 100% rename from patches/todo/minecraft-patches/0014-C2ME-optimize-noise-generation.patch rename to divinemc-server/minecraft-patches/features/0014-C2ME-optimize-noise-generation.patch diff --git a/patches/todo/minecraft-patches/0015-Use-Java-s-Math-functions.patch b/divinemc-server/minecraft-patches/features/0015-Use-Java-s-Math-functions.patch similarity index 72% rename from patches/todo/minecraft-patches/0015-Use-Java-s-Math-functions.patch rename to divinemc-server/minecraft-patches/features/0015-Use-Java-s-Math-functions.patch index 42caea4..52c94f4 100644 --- a/patches/todo/minecraft-patches/0015-Use-Java-s-Math-functions.patch +++ b/divinemc-server/minecraft-patches/features/0015-Use-Java-s-Math-functions.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Use Java's Math functions diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java -index e2602c6d817794616eb05a471077447804b835a1..c4d55514a44939c3e6006d9e23b6097b6360853e 100644 +index 0713d164851216483247da09ff7901f8bfbe2eb9..ed46863a244f4e23610a918f0692390130eaadaf 100644 --- a/net/minecraft/util/Mth.java +++ b/net/minecraft/util/Mth.java @@ -58,18 +58,15 @@ public class Mth { @@ -45,21 +45,4 @@ index e2602c6d817794616eb05a471077447804b835a1..c4d55514a44939c3e6006d9e23b6097b + return (int) Math.ceil(value); // DivineMC - Use Java's Math functions } - public static int clamp(int value, int min, int max) { -@@ -123,15 +118,7 @@ public class Mth { - } - - public static double absMax(double x, double y) { -- if (x < 0.0) { -- x = -x; -- } -- -- if (y < 0.0) { -- y = -y; -- } -- -- return Math.max(x, y); -+ return Math.max(Math.abs(x), Math.abs(y)); // DivineMC - Use Java's Math functions - } - - public static int floorDiv(int dividend, int divisor) { + public static long ceilLong(double value) { diff --git a/patches/todo/minecraft-patches/0016-Disable-leaf-decay.patch b/divinemc-server/minecraft-patches/features/0016-Disable-leaf-decay.patch similarity index 100% rename from patches/todo/minecraft-patches/0016-Disable-leaf-decay.patch rename to divinemc-server/minecraft-patches/features/0016-Disable-leaf-decay.patch diff --git a/patches/todo/minecraft-patches/0017-Optimize-entities.patch b/divinemc-server/minecraft-patches/features/0017-Optimize-entities.patch similarity index 95% rename from patches/todo/minecraft-patches/0017-Optimize-entities.patch rename to divinemc-server/minecraft-patches/features/0017-Optimize-entities.patch index f97ccf6..afab0e5 100644 --- a/patches/todo/minecraft-patches/0017-Optimize-entities.patch +++ b/divinemc-server/minecraft-patches/features/0017-Optimize-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize entities diff --git a/net/minecraft/world/entity/AgeableMob.java b/net/minecraft/world/entity/AgeableMob.java -index 04875840085541ebfc7014868beec49bb7ab9976..caea723a4614d3c406dbce71a392716b7442987c 100644 +index 065553a549e54492e8fe42fe7dc61d11ac8da6ef..402955e7042f01bdb8296a43bcca52dbb3a224c1 100644 --- a/net/minecraft/world/entity/AgeableMob.java +++ b/net/minecraft/world/entity/AgeableMob.java -@@ -125,6 +125,16 @@ public abstract class AgeableMob extends PathfinderMob { +@@ -126,6 +126,16 @@ public abstract class AgeableMob extends PathfinderMob { public void onSyncedDataUpdated(EntityDataAccessor key) { if (DATA_BABY_ID.equals(key)) { this.refreshDimensions(); @@ -26,24 +26,24 @@ index 04875840085541ebfc7014868beec49bb7ab9976..caea723a4614d3c406dbce71a392716b super.onSyncedDataUpdated(key); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 989043d73af2c719e6c36ac5d4c35e7d31d3410c..6c7f0c04e94eb3fa2f22d2637a1c2abceb1563f4 100644 +index 79d224baca372cb1b6b89f7fcb63c5fe3707adb5..b5004de3ca8951a5884a3b62b129aa2588a67af7 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1687,6 +1687,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1712,6 +1712,10 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name - private void checkInsideBlocks(Vec3 vec3, Vec3 vec31, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet set) { - AABB aabb = this.makeBoundingBox(vec31).deflate(1.0E-5F); + private int checkInsideBlocks(Vec3 from, Vec3 to, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet visited, int maxSteps) { + AABB aabb = this.makeBoundingBox(to).deflate(1.0E-5F); + // DivineMC start - Optimize entities + final net.minecraft.world.level.chunk.ChunkAccess[] cachedChunk = new net.minecraft.world.level.chunk.ChunkAccess[] { null }; + final long[] lastChunkPos = { Long.MIN_VALUE }; + // DivineMC end - Optimize entities - BlockGetter.forEachBlockIntersectedBetween( - vec3, - vec31, -@@ -1695,7 +1699,21 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - if (!this.isAlive()) { + boolean flag = from.distanceToSqr(to) > Mth.square(0.9999900000002526); + boolean flag1 = this.level instanceof ServerLevel serverLevel + && serverLevel.getServer().debugSubscribers().hasAnySubscriberFor(DebugSubscriptions.ENTITY_BLOCK_INTERSECTIONS); +@@ -1727,7 +1731,21 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name return false; } else { + atomicInteger.set(index); - BlockState blockState = this.level().getBlockState(pos); + // DivineMC start - Optimize entities + final int chunkX = pos.getX() >> 4; @@ -61,16 +61,8 @@ index 989043d73af2c719e6c36ac5d4c35e7d31d3410c..6c7f0c04e94eb3fa2f22d2637a1c2abc + BlockState blockState = chunk.getBlockState(pos); + // DivineMC end - Optimize entities if (blockState.isAir()) { - this.debugBlockIntersection(pos, false, false); - return true; -@@ -1738,6 +1756,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - public boolean collidedWithFluid(FluidState fluid, BlockPos pos, Vec3 from, Vec3 to) { -+ if (fluid.isEmpty()) return false; // DivineMC - Optimize entities - AABB aabb = fluid.getAABB(this.level(), pos); - return aabb != null && this.collidedWithShapeMovingFrom(from, to, List.of(aabb)); - } + if (flag1) { + this.debugBlockIntersection((ServerLevel)this.level(), pos.immutable(), false, false); diff --git a/net/minecraft/world/entity/InsideBlockEffectApplier.java b/net/minecraft/world/entity/InsideBlockEffectApplier.java index a7bc5ead2062504ceac95f603bc1ca8d4290bbfd..533c790ce305043f53c76f03a12676c567118a44 100644 --- a/net/minecraft/world/entity/InsideBlockEffectApplier.java @@ -218,7 +210,7 @@ index a7bc5ead2062504ceac95f603bc1ca8d4290bbfd..533c790ce305043f53c76f03a12676c5 // Paper start - track position inside effect was triggered on diff --git a/net/minecraft/world/entity/ai/Brain.java b/net/minecraft/world/entity/ai/Brain.java -index 99ced3cb7d3d4c7a80d890689d7585fa9acd17f6..f839b1429c8ef2a630ae3d6e6a02678161aa5858 100644 +index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298a3e10c3d 100644 --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java @@ -45,16 +45,75 @@ public class Brain { @@ -613,10 +605,10 @@ index 24d1928445b5571e040a2b12d5c82e77a880d9bd..dac0a23aebf2dea1972c07d5c82079da private boolean isVillagerBaby(LivingEntity livingEntity) { return livingEntity.getType() == EntityType.VILLAGER && livingEntity.isBaby(); diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 70b32e0d06f9b8b7999df5fdfd773c09394e23fb..188c233721d7a98c8a437dd5bd155b1f3de9134e 100644 +index 80714e2a6e74047af89680c261e2dbc097d86062..73fe7a8c216aed7dc2274fd53fb126d85ec5137d 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -100,6 +100,13 @@ public class Goat extends Animal { +@@ -99,6 +99,13 @@ public class Goat extends Animal { this.getNavigation().setCanFloat(true); this.setPathfindingMalus(PathType.POWDER_SNOW, -1.0F); this.setPathfindingMalus(PathType.DANGER_POWDER_SNOW, -1.0F); diff --git a/patches/todo/minecraft-patches/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch b/divinemc-server/minecraft-patches/features/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch similarity index 83% rename from patches/todo/minecraft-patches/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch rename to divinemc-server/minecraft-patches/features/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch index 8bb2e69..c7babf4 100644 --- a/patches/todo/minecraft-patches/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch +++ b/divinemc-server/minecraft-patches/features/0018-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch @@ -12,10 +12,10 @@ The "distanceToSqr" call is a bit expensive, so avoiding it is pretty nice, arou We could also check if the x,y,z coordinates are equal, but for now, let's just keep the identity check, which also helps us since Minecraft's code does reuse the original delta movement Vec3 object diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index e96d4dee14c05f2fa329bfb1588ec795d4e3d730..0868189fee30d40dfb82ae39592a65b510e96b54 100644 +index 638432a2e6506d3db6a25c068a33eeafb13cf0d6..737a6ff0bfec9b555fa425619d97b80ef95cb3e6 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -209,23 +209,27 @@ public class ServerEntity { +@@ -197,23 +197,27 @@ public class ServerEntity { if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { Vec3 deltaMovement = this.entity.getDeltaMovement(); @@ -23,8 +23,8 @@ index e96d4dee14c05f2fa329bfb1588ec795d4e3d730..0868189fee30d40dfb82ae39592a65b5 - if (d > 1.0E-7 || d > 0.0 && deltaMovement.lengthSqr() == 0.0) { - this.lastSentMovement = deltaMovement; - if (this.entity instanceof AbstractHurtingProjectile abstractHurtingProjectile) { -- this.broadcast -- .accept( +- this.synchronizer +- .sendToTrackingPlayers( - new ClientboundBundlePacket( - List.of( - new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), @@ -35,8 +35,8 @@ index e96d4dee14c05f2fa329bfb1588ec795d4e3d730..0868189fee30d40dfb82ae39592a65b5 + if (d > 1.0E-7 || d > 0.0 && deltaMovement.lengthSqr() == 0.0) { + this.lastSentMovement = deltaMovement; + if (this.entity instanceof AbstractHurtingProjectile abstractHurtingProjectile) { -+ this.broadcast -+ .accept( ++ this.synchronizer ++ .sendToTrackingPlayers( + new ClientboundBundlePacket( + List.of( + new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement), @@ -46,10 +46,10 @@ index e96d4dee14c05f2fa329bfb1588ec795d4e3d730..0868189fee30d40dfb82ae39592a65b5 - ) - ); - } else { -- this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); +- this.synchronizer.sendToTrackingPlayers(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); + ); + } else { -+ this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); ++ this.synchronizer.sendToTrackingPlayers(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); + } } } diff --git a/patches/todo/minecraft-patches/0019-Carpet-Fixes-Optimized-getBiome-method.patch b/divinemc-server/minecraft-patches/features/0019-Carpet-Fixes-Optimized-getBiome-method.patch similarity index 100% rename from patches/todo/minecraft-patches/0019-Carpet-Fixes-Optimized-getBiome-method.patch rename to divinemc-server/minecraft-patches/features/0019-Carpet-Fixes-Optimized-getBiome-method.patch diff --git a/patches/todo/minecraft-patches/0020-Carpet-Fixes-Sheep-Optimization.patch b/divinemc-server/minecraft-patches/features/0020-Carpet-Fixes-Sheep-Optimization.patch similarity index 100% rename from patches/todo/minecraft-patches/0020-Carpet-Fixes-Sheep-Optimization.patch rename to divinemc-server/minecraft-patches/features/0020-Carpet-Fixes-Sheep-Optimization.patch diff --git a/patches/todo/minecraft-patches/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch b/divinemc-server/minecraft-patches/features/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch similarity index 98% rename from patches/todo/minecraft-patches/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch rename to divinemc-server/minecraft-patches/features/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch index e9188d5..f712f7d 100644 --- a/patches/todo/minecraft-patches/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch +++ b/divinemc-server/minecraft-patches/features/0021-Carpet-AMS-Addition-Optimized-dragon-respawn.patch @@ -25,7 +25,7 @@ index f7bb979f08634a7e1b77c59040f59fb5e11aafa5..e0eca73d9e8a77b2a4972db61001394c for (int i1 = 0; i1 < this.height; i1++) { for (int i2 = 0; i2 < this.depth; i2++) { diff --git a/net/minecraft/world/level/dimension/end/EndDragonFight.java b/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 8ccd40c70e150bd5a8d89818c229258642f2349e..d498dbdc5d29c9bb94ccbf2ae84d5d6caf2943f2 100644 +index 7f9bd256da15da915db1c45099572d9eb3286166..fe586b99bdf7c145b7a51afc9f4ca910f22af6d8 100644 --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -273,8 +273,68 @@ public class EndDragonFight { diff --git a/patches/todo/minecraft-patches/0022-ModernFix-compact_bit_storage.patch b/divinemc-server/minecraft-patches/features/0022-ModernFix-compact_bit_storage.patch similarity index 90% rename from patches/todo/minecraft-patches/0022-ModernFix-compact_bit_storage.patch rename to divinemc-server/minecraft-patches/features/0022-ModernFix-compact_bit_storage.patch index 29cd187..d1b8ab3 100644 --- a/patches/todo/minecraft-patches/0022-ModernFix-compact_bit_storage.patch +++ b/divinemc-server/minecraft-patches/features/0022-ModernFix-compact_bit_storage.patch @@ -10,11 +10,11 @@ As part of: ModernFix (https://github.com/embeddedt/ModernFix) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/level/chunk/PalettedContainer.java b/net/minecraft/world/level/chunk/PalettedContainer.java -index 9d892c1c3890e0aaf13fd5cd7b7d138afeaad260..ca3fab804e464a5db2b47495ecb588a96044265d 100644 +index f1cae4cab36546d5798d2b59ac59774d1c9838c0..731da3f35013d9916577a7f475d6a796dd201742 100644 --- a/net/minecraft/world/level/chunk/PalettedContainer.java +++ b/net/minecraft/world/level/chunk/PalettedContainer.java -@@ -291,6 +291,28 @@ public class PalettedContainer implements PaletteResize, PalettedContainer - data.palette.read(buffer); +@@ -283,6 +283,28 @@ public class PalettedContainer implements PaletteResize, PalettedContainer + data.palette.read(buffer, this.strategy.globalMap()); buffer.readFixedSizeLongArray(data.storage.getRaw()); this.data = data; + // DivineMC start - ModernFix: compact_bit_storage diff --git a/patches/todo/minecraft-patches/0023-Option-to-disable-disconnect.spam.patch b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-disconnect.spam.patch similarity index 77% rename from patches/todo/minecraft-patches/0023-Option-to-disable-disconnect.spam.patch rename to divinemc-server/minecraft-patches/features/0023-Option-to-disable-disconnect.spam.patch index 758a5fb..bfd77be 100644 --- a/patches/todo/minecraft-patches/0023-Option-to-disable-disconnect.spam.patch +++ b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-disconnect.spam.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Option to disable disconnect.spam diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 619133e907e1c3e6b05f50bf6c4092c08a2a3c44..b44afe316fc8d886b9a21102cddf20d977169c51 100644 +index dc180d67066436263370d8bf55dafabad7c34004..46cf071e34c8b46c0dafadb14eb6fc1bb1c4d9a8 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -846,7 +846,7 @@ public class ServerGamePacketListenerImpl +@@ -852,7 +852,7 @@ public class ServerGamePacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start -- if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // Paper - configurable tab spam limits -+ if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile()) && !org.bxteam.divinemc.config.DivineConfig.NetworkCategory.disableDisconnectSpam) { // Paper - configurable tab spam limits // DivineMC - Option to disable disconnect.spam +- if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.nameAndId()) && !this.server.isSingleplayerOwner(this.player.nameAndId())) { // Paper - configurable tab spam limits ++ if (!this.tabSpamThrottler.isIncrementAndUnderThreshold() && !this.server.getPlayerList().isOp(this.player.nameAndId()) && !this.server.isSingleplayerOwner(this.player.nameAndId()) && !org.bxteam.divinemc.config.DivineConfig.NetworkCategory.disableDisconnectSpam) { // Paper - configurable tab spam limits // DivineMC - Option to disable disconnect.spam this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; } -@@ -858,7 +858,7 @@ public class ServerGamePacketListenerImpl +@@ -864,7 +864,7 @@ public class ServerGamePacketListenerImpl // Paper end - Don't suggest if tab-complete is disabled // Paper start final int index; @@ -26,7 +26,7 @@ index 619133e907e1c3e6b05f50bf6c4092c08a2a3c44..b44afe316fc8d886b9a21102cddf20d9 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - add proper async disconnect return; } -@@ -918,6 +918,7 @@ public class ServerGamePacketListenerImpl +@@ -924,6 +924,7 @@ public class ServerGamePacketListenerImpl ParseResults parseResults = this.server.getCommands().getDispatcher().parse(stringReader, this.player.createCommandSourceStack()); // Paper start - Handle non-recoverable exceptions if (!parseResults.getExceptions().isEmpty() @@ -34,15 +34,15 @@ index 619133e907e1c3e6b05f50bf6c4092c08a2a3c44..b44afe316fc8d886b9a21102cddf20d9 && parseResults.getExceptions().values().stream().anyMatch(e -> e instanceof io.papermc.paper.brigadier.TagParseCommandSyntaxException)) { this.disconnect(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); return; -@@ -2631,6 +2632,7 @@ public class ServerGamePacketListenerImpl +@@ -2638,6 +2639,7 @@ public class ServerGamePacketListenerImpl // this.chatSpamThrottler.increment(); if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() // CraftBukkit end + && !org.bxteam.divinemc.config.DivineConfig.NetworkCategory.disableDisconnectSpam // DivineMC - Option to disable disconnect.spam - && !this.server.getPlayerList().isOp(this.player.getGameProfile()) - && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { + && !this.server.getPlayerList().isOp(this.player.nameAndId()) + && !this.server.isSingleplayerOwner(this.player.nameAndId())) { this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - kick event cause & add proper async disconnect -@@ -3332,7 +3334,7 @@ public class ServerGamePacketListenerImpl +@@ -3348,7 +3350,7 @@ public class ServerGamePacketListenerImpl public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { diff --git a/patches/todo/minecraft-patches/0024-Option-to-disable-saving-of-snowball-and-firework.patch b/divinemc-server/minecraft-patches/features/0024-Option-to-disable-saving-of-snowball-and-firework.patch similarity index 90% rename from patches/todo/minecraft-patches/0024-Option-to-disable-saving-of-snowball-and-firework.patch rename to divinemc-server/minecraft-patches/features/0024-Option-to-disable-saving-of-snowball-and-firework.patch index 25a6e5c..e6eedfa 100644 --- a/patches/todo/minecraft-patches/0024-Option-to-disable-saving-of-snowball-and-firework.patch +++ b/divinemc-server/minecraft-patches/features/0024-Option-to-disable-saving-of-snowball-and-firework.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Option to disable saving of snowball and firework diff --git a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -index d8dc196ef92e97f831cf97cd1536a46f81f9d5d1..ed8c50f67f5a6deda74845e4bce9fd9aa42558c0 100644 +index 9b13991088a5e5f4d7697588777e5252ae67b73a..449d86680bd7c084287cab6ba31466a889ae52cd 100644 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java @@ -350,4 +350,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { @@ -24,7 +24,7 @@ index d8dc196ef92e97f831cf97cd1536a46f81f9d5d1..ed8c50f67f5a6deda74845e4bce9fd9a + // DivineMC end - Option to disable saving firework } diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java -index d8f9fb603fd2e3e5c1dfc05face7f42b4844daf4..42b2be469972e02671fa5a02aeecfb4e5be405c3 100644 +index 49694d7fe529fb8197ab4a3a7412d6923ee1bda7..bfa08f51aab4f5cfa0ef0a66075c6a266f586d0a 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -94,4 +94,14 @@ public class Snowball extends ThrowableItemProjectile { diff --git a/patches/todo/minecraft-patches/0025-Snowball-and-Egg-knockback.patch b/divinemc-server/minecraft-patches/features/0025-Snowball-and-Egg-knockback.patch similarity index 93% rename from patches/todo/minecraft-patches/0025-Snowball-and-Egg-knockback.patch rename to divinemc-server/minecraft-patches/features/0025-Snowball-and-Egg-knockback.patch index 9c2869c..6677cd2 100644 --- a/patches/todo/minecraft-patches/0025-Snowball-and-Egg-knockback.patch +++ b/divinemc-server/minecraft-patches/features/0025-Snowball-and-Egg-knockback.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Snowball and Egg knockback diff --git a/net/minecraft/world/entity/projectile/Snowball.java b/net/minecraft/world/entity/projectile/Snowball.java -index 42b2be469972e02671fa5a02aeecfb4e5be405c3..0f611169a4ed2a059b9231bedf94a903600b73f0 100644 +index bfa08f51aab4f5cfa0ef0a66075c6a266f586d0a..9fb9244ad95a5fa64df6beb3e7208c7598216132 100644 --- a/net/minecraft/world/entity/projectile/Snowball.java +++ b/net/minecraft/world/entity/projectile/Snowball.java @@ -54,6 +54,12 @@ public class Snowball extends ThrowableItemProjectile { @@ -22,7 +22,7 @@ index 42b2be469972e02671fa5a02aeecfb4e5be405c3..0f611169a4ed2a059b9231bedf94a903 // Purpur start - options to extinguish fire blocks with snowballs - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire diff --git a/net/minecraft/world/entity/projectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/ThrownEgg.java -index 73ec34b43f3fb2aa3edc3f1cb48a923d1fa32036..fe605f728020b42a61ea6703401e08f0efc3a69c 100644 +index 57cb5b73dae86379be857ffa0f55ef7a056a0b4a..d3dea3e36297da11c3b753394f3c4c72c9c5b4f2 100644 --- a/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/net/minecraft/world/entity/projectile/ThrownEgg.java @@ -54,7 +54,14 @@ public class ThrownEgg extends ThrowableItemProjectile { diff --git a/patches/todo/minecraft-patches/0026-Optimize-suffocation.patch b/divinemc-server/minecraft-patches/features/0026-Optimize-suffocation.patch similarity index 84% rename from patches/todo/minecraft-patches/0026-Optimize-suffocation.patch rename to divinemc-server/minecraft-patches/features/0026-Optimize-suffocation.patch index 45e229d..b571f0c 100644 --- a/patches/todo/minecraft-patches/0026-Optimize-suffocation.patch +++ b/divinemc-server/minecraft-patches/features/0026-Optimize-suffocation.patch @@ -7,10 +7,10 @@ Original license: GPL v3 Original project: https://github.com/pufferfish-gg/Pufferfish diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 8df6ceea1536b12d87755c8a69e1b652d280600c..33f33a51a7016e214bca1aec8e6cc3910ec3bb42 100644 +index 4e8594985442fe4371504fca697569bd3c58339d..5c2d1d78dce9fed6649eda2dea14bf32f8f591dc 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -420,6 +420,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -426,6 +426,12 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin return this.getDeltaMovement().y() < 1.0E-5F && this.isInLiquid(); } @@ -23,12 +23,12 @@ index 8df6ceea1536b12d87755c8a69e1b652d280600c..33f33a51a7016e214bca1aec8e6cc391 @Override public void baseTick() { this.oAttackAnim = this.attackAnim; -@@ -438,7 +444,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin - +@@ -440,7 +446,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + super.baseTick(); if (this.isAlive() && this.level() instanceof ServerLevel serverLevel1) { boolean flag = this instanceof Player; - if (this.isInWall()) { + if ((!org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.enableSuffocationOptimization || this instanceof WitherBoss || (tickCount % 10 == 0 && couldPossiblyBeHurt(1.0F))) && this.isInWall()) { // DivineMC - Optimize suffocation this.hurtServer(serverLevel1, this.damageSources().inWall(), 1.0F); } else if (flag && !serverLevel1.getWorldBorder().isWithinBounds(this.getBoundingBox())) { - double d = serverLevel1.getWorldBorder().getDistanceToBorder(this) + serverLevel1.getWorldBorder().getDamageSafeZone(); + double d = serverLevel1.getWorldBorder().getDistanceToBorder(this) + serverLevel1.getWorldBorder().getSafeZone(); diff --git a/patches/todo/minecraft-patches/0027-Reduce-chunk-loading-lookups.patch b/divinemc-server/minecraft-patches/features/0027-Reduce-chunk-loading-lookups.patch similarity index 93% rename from patches/todo/minecraft-patches/0027-Reduce-chunk-loading-lookups.patch rename to divinemc-server/minecraft-patches/features/0027-Reduce-chunk-loading-lookups.patch index 92c86f5..19b5c59 100644 --- a/patches/todo/minecraft-patches/0027-Reduce-chunk-loading-lookups.patch +++ b/divinemc-server/minecraft-patches/features/0027-Reduce-chunk-loading-lookups.patch @@ -7,10 +7,10 @@ Original license: GPL v3 Original project: https://github.com/pufferfish-gg/Pufferfish diff --git a/net/minecraft/world/entity/monster/EnderMan.java b/net/minecraft/world/entity/monster/EnderMan.java -index fcdb3ee493e65bf002e78862f00061336e731ede..a8c11c6d7d107987dc04e5b741cfabf5ea0e8090 100644 +index bf5fedd1dc7eea2a36edfb1420efe207ac409085..f4e90ced5ce5acd3a51f99cea905c92aa9c40e4f 100644 --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java -@@ -330,11 +330,28 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -336,11 +336,28 @@ public class EnderMan extends Monster implements NeutralMob { private boolean teleport(double x, double y, double z) { BlockPos.MutableBlockPos mutableBlockPos = new BlockPos.MutableBlockPos(x, y, z); diff --git a/patches/todo/minecraft-patches/0028-Configurable-movement-speed-for-entities.patch b/divinemc-server/minecraft-patches/features/0028-Configurable-movement-speed-for-entities.patch similarity index 86% rename from patches/todo/minecraft-patches/0028-Configurable-movement-speed-for-entities.patch rename to divinemc-server/minecraft-patches/features/0028-Configurable-movement-speed-for-entities.patch index 07c5710..c5b1421 100644 --- a/patches/todo/minecraft-patches/0028-Configurable-movement-speed-for-entities.patch +++ b/divinemc-server/minecraft-patches/features/0028-Configurable-movement-speed-for-entities.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable movement speed for entities diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 2e6d0f035a01277aa28bbe912d5df8dc4cf04547..2a13332ebabf2e63a8f51a5d794fab3d66c7a1db 100644 +index 592b4f139a184f0522e350f5b83777b235eb243c..12650e3981fe48ab0cb4398e021e768eea03bd60 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java @@ -98,6 +98,7 @@ public class Drowned extends Zombie implements RangedAttackMob { @@ -17,10 +17,10 @@ index 2e6d0f035a01277aa28bbe912d5df8dc4cf04547..2a13332ebabf2e63a8f51a5d794fab3d @Override diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java -index a4ce65911a5d778f60bcedb3acd9fe59a5094c96..f359bfedd2d6fbd1c2d77d664157c4725fef014b 100644 +index f2c55aa23ec647af6907b349b937c98fffd95523..33b32d0a9f29628ea4c59e72a1157a83992c222e 100644 --- a/net/minecraft/world/entity/monster/Husk.java +++ b/net/minecraft/world/entity/monster/Husk.java -@@ -43,6 +43,7 @@ public class Husk extends Zombie { +@@ -42,6 +42,7 @@ public class Husk extends Zombie { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.huskMaxHealth); @@ -29,10 +29,10 @@ index a4ce65911a5d778f60bcedb3acd9fe59a5094c96..f359bfedd2d6fbd1c2d77d664157c472 @Override diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java -index ab4dc7b3a7593d255dbd7d1df667fce3504af3ed..86fd1eb0b9e235f58fb9eca3f384f001b2330907 100644 +index 63b29933e262115062a082dcaed0d16146a181bd..6c41126ad4b485a3dad8fafc8e26defccb426c47 100644 --- a/net/minecraft/world/entity/monster/Zombie.java +++ b/net/minecraft/world/entity/monster/Zombie.java -@@ -126,6 +126,7 @@ public class Zombie extends Monster { +@@ -125,6 +125,7 @@ public class Zombie extends Monster { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.zombieScale); @@ -40,7 +40,7 @@ index ab4dc7b3a7593d255dbd7d1df667fce3504af3ed..86fd1eb0b9e235f58fb9eca3f384f001 } // Purpur end - Configurable entity base attributes -@@ -193,7 +194,6 @@ public class Zombie extends Monster { +@@ -192,7 +193,6 @@ public class Zombie extends Monster { public static AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.FOLLOW_RANGE, 35.0) @@ -49,10 +49,10 @@ index ab4dc7b3a7593d255dbd7d1df667fce3504af3ed..86fd1eb0b9e235f58fb9eca3f384f001 .add(Attributes.ARMOR, 2.0) .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE); diff --git a/net/minecraft/world/entity/monster/ZombieVillager.java b/net/minecraft/world/entity/monster/ZombieVillager.java -index 00af89717bf2459b315baf70a515a0e68267fb9f..438e07863f85d83874373b9d2407c0c383ba5722 100644 +index 24378d21c12038c3b649fa4766bd9c66cb4afd54..3667ef042057bb1f6006c421e67cfd1c5dd6da36 100644 --- a/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -97,6 +97,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { +@@ -94,6 +94,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieVillagerMaxHealth); @@ -61,7 +61,7 @@ index 00af89717bf2459b315baf70a515a0e68267fb9f..438e07863f85d83874373b9d2407c0c3 @Override diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index f58c48d9de85fda3d13079f3e56b31af75b3c725..db43ea25cb817c10bde1a30076d4b1f6266651d6 100644 +index 1955ea6cff628234342989249de6efd1180b0999..2b1fb75c490d4e4f6aa65dbc74454143d29c3fc9 100644 --- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -86,6 +86,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { diff --git a/patches/todo/minecraft-patches/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch b/divinemc-server/minecraft-patches/features/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch similarity index 85% rename from patches/todo/minecraft-patches/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch rename to divinemc-server/minecraft-patches/features/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch index bb99794..34f3ded 100644 --- a/patches/todo/minecraft-patches/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch +++ b/divinemc-server/minecraft-patches/features/0029-Option-to-allow-weird-movement-and-disable-teleporti.patch @@ -6,28 +6,28 @@ Subject: [PATCH] Option to allow weird movement and disable teleporting diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index b44afe316fc8d886b9a21102cddf20d977169c51..b58fc16f9054f36d5ddb2dffabd9274969e56897 100644 +index 46cf071e34c8b46c0dafadb14eb6fc1bb1c4d9a8..93fc67f8cf60be489249d83a748490b653953e7a 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -609,7 +609,7 @@ public class ServerGamePacketListenerImpl +@@ -617,7 +617,7 @@ public class ServerGamePacketListenerImpl return; } // Paper end - Prevent moving into unloaded chunks - if (d7 - d6 > Math.max(100.0, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed)) && !this.isSingleplayerOwner()) { + if (!org.bxteam.divinemc.config.DivineConfig.FixesCategory.alwaysAllowWeirdMovement && (d7 - d6 > Math.max(100.0, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed)) && !this.isSingleplayerOwner())) { // DivineMC - stop weird movement // CraftBukkit end - LOGGER.warn( - "{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getName().getString(), this.player.getName().getString(), d3, d4, d5 -@@ -639,7 +639,7 @@ public class ServerGamePacketListenerImpl + LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getPlainTextName(), this.player.getPlainTextName(), d3, d4, d5); + this.send(ClientboundMoveVehiclePacket.fromEntity(rootVehicle)); +@@ -645,7 +645,7 @@ public class ServerGamePacketListenerImpl d5 = d2 - rootVehicle.getZ(); d7 = d3 * d3 + d4 * d4 + d5 * d5; boolean flag1 = false; - if (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold) { // Spigot + if (!org.bxteam.divinemc.config.DivineConfig.FixesCategory.alwaysAllowWeirdMovement && (d7 > org.spigotmc.SpigotConfig.movedWronglyThreshold)) { // Spigot // DivineMC - stop weird movement flag1 = true; // Paper - diff on change, this should be moved wrongly - LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getName().getString(), this.player.getName().getString(), Math.sqrt(d7)); + LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getPlainTextName(), this.player.getPlainTextName(), Math.sqrt(d7)); } -@@ -1557,20 +1557,24 @@ public class ServerGamePacketListenerImpl +@@ -1562,20 +1562,24 @@ public class ServerGamePacketListenerImpl if (this.shouldCheckPlayerMovement(isFallFlying)) { float f2 = isFallFlying ? 300.0F : 100.0F; if (d7 - d6 > Math.max(f2, Mth.square(org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed))) { @@ -42,12 +42,12 @@ index b44afe316fc8d886b9a21102cddf20d977169c51..b58fc16f9054f36d5ddb2dffabd92749 toX, toY, toZ, toYaw, toPitch, true); - if (!event.isAllowed()) { - if (event.getLogWarning()) { -- LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); +- LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getPlainTextName(), d3, d4, d5); - } - this.teleport( + if (!event.isAllowed()) { + if (event.getLogWarning()) { -+ LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getName().getString(), d3, d4, d5); ++ LOGGER.warn("{} moved too quickly! {},{},{}", this.player.getPlainTextName(), d3, d4, d5); + } + this.teleport( this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot() @@ -63,7 +63,7 @@ index b44afe316fc8d886b9a21102cddf20d977169c51..b58fc16f9054f36d5ddb2dffabd92749 } } } -@@ -1631,6 +1635,7 @@ public class ServerGamePacketListenerImpl +@@ -1636,6 +1640,7 @@ public class ServerGamePacketListenerImpl d7 = d3 * d3 + d4 * d4 + d5 * d5; boolean movedWrongly = false; // Paper - Add fail move event; rename if (!this.player.isChangingDimension() diff --git a/patches/todo/minecraft-patches/0030-Optimize-Raids.patch b/divinemc-server/minecraft-patches/features/0030-Optimize-Raids.patch similarity index 94% rename from patches/todo/minecraft-patches/0030-Optimize-Raids.patch rename to divinemc-server/minecraft-patches/features/0030-Optimize-Raids.patch index 8be09f1..4de5475 100644 --- a/patches/todo/minecraft-patches/0030-Optimize-Raids.patch +++ b/divinemc-server/minecraft-patches/features/0030-Optimize-Raids.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize Raids diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 5f2c27800f047f128857044493a6d9325ffd759b..4a2cace22512fe06c1713bc8735e775e3012f3bc 100644 +index cea6213837b001d7a494d17aa7e6e326abd1b2fc..06d3cbc33f41517028b5998f11695f68eb19aa5e 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -215,6 +215,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -223,6 +223,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public boolean hasEntityMoveEvent; // Paper - Add EntityMoveEvent private final alternate.current.wire.WireHandler wireHandler = new alternate.current.wire.WireHandler(this); // Paper - optimize redstone (Alternate Current) public boolean hasRidableMoveEvent = false; // Purpur - Ridables @@ -16,7 +16,7 @@ index 5f2c27800f047f128857044493a6d9325ffd759b..4a2cace22512fe06c1713bc8735e775e @Override public @Nullable LevelChunk getChunkIfLoaded(int x, int z) { -@@ -694,6 +695,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -718,6 +719,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle @@ -25,10 +25,10 @@ index 5f2c27800f047f128857044493a6d9325ffd759b..4a2cace22512fe06c1713bc8735e775e // Paper start diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java -index eb62402b7ed4cc76b4d510b1c8781b6f7b5be6ab..9183b8e8c54383a489a1f446d36bef41d11667ba 100644 +index adae4ef6b2f5019b79838eddf0255200096bccd9..97b9676c03b4b2d2aea7fd7c7dff3e6c4cecd57f 100644 --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -126,6 +126,7 @@ public class Raid { +@@ -128,6 +128,7 @@ public class Raid { private Raid.RaidStatus status; private int celebrationTicks; private Optional waveSpawnPos = Optional.empty(); @@ -36,7 +36,7 @@ index eb62402b7ed4cc76b4d510b1c8781b6f7b5be6ab..9183b8e8c54383a489a1f446d36bef41 public Raid(BlockPos center, Difficulty difficulty) { this.active = true; -@@ -278,6 +279,12 @@ public class Raid { +@@ -280,6 +281,12 @@ public class Raid { } public void tick(ServerLevel level) { @@ -49,7 +49,7 @@ index eb62402b7ed4cc76b4d510b1c8781b6f7b5be6ab..9183b8e8c54383a489a1f446d36bef41 if (!this.isStopped()) { if (this.status == Raid.RaidStatus.ONGOING) { boolean flag = this.active; -@@ -588,7 +595,7 @@ public class Raid { +@@ -610,7 +617,7 @@ public class Raid { } public void updateBossbar() { diff --git a/patches/todo/minecraft-patches/0031-Small-optimization-to-LinearPalette.patch b/divinemc-server/minecraft-patches/features/0031-Small-optimization-to-LinearPalette.patch similarity index 77% rename from patches/todo/minecraft-patches/0031-Small-optimization-to-LinearPalette.patch rename to divinemc-server/minecraft-patches/features/0031-Small-optimization-to-LinearPalette.patch index b876143..f9b6268 100644 --- a/patches/todo/minecraft-patches/0031-Small-optimization-to-LinearPalette.patch +++ b/divinemc-server/minecraft-patches/features/0031-Small-optimization-to-LinearPalette.patch @@ -5,27 +5,29 @@ Subject: [PATCH] Small optimization to LinearPalette diff --git a/net/minecraft/world/level/chunk/LinearPalette.java b/net/minecraft/world/level/chunk/LinearPalette.java -index 2073f6ff41aa570102621d183ee890b076267d54..93cb815032fada7b8abc7301a7005114eea8384d 100644 +index 9aa55456d18ffa3ad5cc300ed321582b2a7af1d1..af687853650d9fc58b23d88a7c6e19f36615e8b7 100644 --- a/net/minecraft/world/level/chunk/LinearPalette.java +++ b/net/minecraft/world/level/chunk/LinearPalette.java -@@ -12,7 +12,7 @@ public class LinearPalette implements Palette, ca.spottedleaf.moonrise.pat +@@ -10,7 +10,7 @@ import org.apache.commons.lang3.Validate; + public class LinearPalette implements Palette, ca.spottedleaf.moonrise.patches.fast_palette.FastPalette { // Paper - optimise palette reads private final T[] values; - private final PaletteResize resizeHandler; private final int bits; - private int size; + private volatile int size; // DivineMC - Small optimization to LinearPalette // Paper start - optimise palette reads @Override -@@ -49,11 +49,14 @@ public class LinearPalette implements Palette, ca.spottedleaf.moonrise.pat +@@ -43,11 +43,16 @@ public class LinearPalette implements Palette, ca.spottedleaf.moonrise.pat @Override - public int idFor(T state) { + public int idFor(T state, PaletteResize resizeHandler) { - for (int i = 0; i < this.size; i++) { - if (this.values[i] == state) { + // DivineMC start - Small optimization to LinearPalette + final T[] values = this.values; -+ for (int i = 0; i < values.length; i++) { ++ final int currentSize = this.size; ++ ++ for (int i = 0; i < currentSize; i++) { + if (values[i] == state) { return i; } @@ -34,7 +36,7 @@ index 2073f6ff41aa570102621d183ee890b076267d54..93cb815032fada7b8abc7301a7005114 int ix = this.size; if (ix < this.values.length) { -@@ -67,17 +70,23 @@ public class LinearPalette implements Palette, ca.spottedleaf.moonrise.pat +@@ -61,17 +66,23 @@ public class LinearPalette implements Palette, ca.spottedleaf.moonrise.pat @Override public boolean maybeHas(Predicate filter) { diff --git a/patches/todo/minecraft-patches/0032-Optimize-VarInt-and-VarLong-write.patch b/divinemc-server/minecraft-patches/features/0032-Optimize-VarInt-and-VarLong-write.patch similarity index 98% rename from patches/todo/minecraft-patches/0032-Optimize-VarInt-and-VarLong-write.patch rename to divinemc-server/minecraft-patches/features/0032-Optimize-VarInt-and-VarLong-write.patch index 1ead46e..1fe3a26 100644 --- a/patches/todo/minecraft-patches/0032-Optimize-VarInt-and-VarLong-write.patch +++ b/divinemc-server/minecraft-patches/features/0032-Optimize-VarInt-and-VarLong-write.patch @@ -10,7 +10,7 @@ As part of: Velocity (https://github.com/PaperMC/Velocity) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/network/VarInt.java b/net/minecraft/network/VarInt.java -index 4897ff4648083ebe737ae5b32bae344af27357e4..e138b64c4b09d83e5f38d7421fc23e9cc5e5d5a7 100644 +index 7a1cafc3fb56054a72591bfb446a433f959a6b28..9bbec7288734899d0b08d0ef2061f0d3c6f265be 100644 --- a/net/minecraft/network/VarInt.java +++ b/net/minecraft/network/VarInt.java @@ -50,28 +50,45 @@ public class VarInt { diff --git a/patches/todo/minecraft-patches/0033-Optimize-Fluids.patch b/divinemc-server/minecraft-patches/features/0033-Optimize-Fluids.patch similarity index 92% rename from patches/todo/minecraft-patches/0033-Optimize-Fluids.patch rename to divinemc-server/minecraft-patches/features/0033-Optimize-Fluids.patch index 04ece05..7e0a3a7 100644 --- a/patches/todo/minecraft-patches/0033-Optimize-Fluids.patch +++ b/divinemc-server/minecraft-patches/features/0033-Optimize-Fluids.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize Fluids diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java -index ae609e0603a78423c4c89b7efb9c41ab8fe7aa52..5c143e3227371c701f36362e24bd3c1fc8061ed2 100644 +index 34a10afcc242e4e37673918ee271d683e35385b7..2f278b528acfd3df1aff4438e31e6e81fbd6cf70 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java -@@ -193,6 +193,7 @@ public class LiquidBlock extends Block implements BucketPickup { +@@ -197,6 +197,7 @@ public class LiquidBlock extends Block implements BucketPickup { Block block = level.getFluidState(pos).isSource() ? Blocks.OBSIDIAN : Blocks.COBBLESTONE; // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockFormEvent(level, pos, block.defaultBlockState(), 3)) { @@ -17,10 +17,10 @@ index ae609e0603a78423c4c89b7efb9c41ab8fe7aa52..5c143e3227371c701f36362e24bd3c1f } // CraftBukkit end diff --git a/net/minecraft/world/level/material/FlowingFluid.java b/net/minecraft/world/level/material/FlowingFluid.java -index 1b06e44a267d2d4af844997ac0c557f30aaf9b15..abf1866c26330fc3ec61a4457a7c6966cf0f38a7 100644 +index e1a96f2448de90efef48e21ce4d673edbceda59a..7a14227f07b2b94bff7c67eb7f7f11cdd45c7b62 100644 --- a/net/minecraft/world/level/material/FlowingFluid.java +++ b/net/minecraft/world/level/material/FlowingFluid.java -@@ -199,6 +199,7 @@ public abstract class FlowingFluid extends Fluid { +@@ -200,6 +200,7 @@ public abstract class FlowingFluid extends Fluid { BlockPos blockPos = pos.relative(direction); final BlockState blockStateIfLoaded = level.getBlockStateIfLoaded(blockPos); // Paper - Prevent chunk loading from fluid flowing if (blockStateIfLoaded == null) continue; // Paper - Prevent chunk loading from fluid flowing @@ -28,7 +28,7 @@ index 1b06e44a267d2d4af844997ac0c557f30aaf9b15..abf1866c26330fc3ec61a4457a7c6966 // CraftBukkit start org.bukkit.block.Block source = org.bukkit.craftbukkit.block.CraftBlock.at(level, pos); org.bukkit.event.block.BlockFromToEvent event = new org.bukkit.event.block.BlockFromToEvent(source, org.bukkit.craftbukkit.block.CraftBlock.notchToBlockFace(direction)); -@@ -213,6 +214,39 @@ public abstract class FlowingFluid extends Fluid { +@@ -214,6 +215,39 @@ public abstract class FlowingFluid extends Fluid { } } @@ -68,7 +68,7 @@ index 1b06e44a267d2d4af844997ac0c557f30aaf9b15..abf1866c26330fc3ec61a4457a7c6966 protected FluidState getNewLiquid(ServerLevel level, BlockPos pos, BlockState state) { int i = 0; int i1 = 0; -@@ -342,33 +376,46 @@ public abstract class FlowingFluid extends Fluid { +@@ -343,33 +377,46 @@ public abstract class FlowingFluid extends Fluid { protected abstract void beforeDestroyingBlock(LevelAccessor level, BlockPos pos, BlockState state); @@ -132,10 +132,10 @@ index 1b06e44a267d2d4af844997ac0c557f30aaf9b15..abf1866c26330fc3ec61a4457a7c6966 return canPassThroughWall(Direction.DOWN, level, pos, state, belowPos, belowState) && (belowState.getFluidState().getType().isSame(this) || canHoldFluid(level, belowPos, belowState, this.getFlowing())); diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index 43cdc2f8fdfdeb1426e386e0084087779ef62754..e7ae29a4da3bf36b99fdab39af78f03c06696dbc 100644 +index 545c75cfd03a36d4e8b96a69fc8dcd893b548eeb..bbc658abfb2df1b3ee3a31d46c4b9014bb34e0a2 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -236,6 +236,7 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -237,6 +237,7 @@ public abstract class LavaFluid extends FlowingFluid { // CraftBukkit end } diff --git a/patches/todo/minecraft-patches/0034-Optimize-Structure-Generation.patch b/divinemc-server/minecraft-patches/features/0034-Optimize-Structure-Generation.patch similarity index 98% rename from patches/todo/minecraft-patches/0034-Optimize-Structure-Generation.patch rename to divinemc-server/minecraft-patches/features/0034-Optimize-Structure-Generation.patch index ee3655c..5d1ce9b 100644 --- a/patches/todo/minecraft-patches/0034-Optimize-Structure-Generation.patch +++ b/divinemc-server/minecraft-patches/features/0034-Optimize-Structure-Generation.patch @@ -7,7 +7,7 @@ Original project: https://github.com/TelepathicGrunt/StructureLayoutOptimizer Original license: MIT diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index 1cfa0fcd28685736fcdce4aef817e4d4cc4061cb..cd3b24a760053dcd650a1a263b3c0093a0cbb175 100644 +index 4e3302e8f28c7f12dc5fbaeb6c1f5715a9afc8e5..3b66b16612b8328eaea786cc8ba3a59fd67900e4 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java @@ -4,6 +4,8 @@ import com.google.common.collect.Lists; @@ -233,10 +233,10 @@ index 5c081a5b3d10f713e4e82fe1a43758f553fe50e0..85e84603a19964f05d9d5e62eb096ca7 + // DivineMC end - Optimize Structure Generation } diff --git a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -index f21e612a35d6ac4482dbf5d14e506959659e371a..c02c3b1fddd513cb477cbb7400c30a9ad57f80a6 100644 +index 4068becb9eca9cbbb67e6d6fb9ff848bfc25877e..d8756e4bfc669eb17c60429c4b532b13f1c308ec 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java -@@ -255,6 +255,12 @@ public class StructureTemplate { +@@ -256,6 +256,12 @@ public class StructureTemplate { return transform(pos, decorator.getMirror(), decorator.getRotation(), decorator.getRotationPivot()); } @@ -249,7 +249,7 @@ index f21e612a35d6ac4482dbf5d14e506959659e371a..c02c3b1fddd513cb477cbb7400c30a9a public boolean placeInWorld(ServerLevelAccessor serverLevel, BlockPos offset, BlockPos pos, StructurePlaceSettings settings, RandomSource random, int flags) { if (this.palettes.isEmpty()) { return false; -@@ -272,7 +278,11 @@ public class StructureTemplate { +@@ -273,7 +279,11 @@ public class StructureTemplate { } } // CraftBukkit end @@ -262,7 +262,7 @@ index f21e612a35d6ac4482dbf5d14e506959659e371a..c02c3b1fddd513cb477cbb7400c30a9a if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty()) && this.size.getX() >= 1 && this.size.getY() >= 1 -@@ -882,7 +892,11 @@ public class StructureTemplate { +@@ -885,7 +895,11 @@ public class StructureTemplate { private List cachedJigsaws; Palette(List blocks) { diff --git a/patches/todo/minecraft-patches/0035-Implement-NoChatReports.patch b/divinemc-server/minecraft-patches/features/0035-Implement-NoChatReports.patch similarity index 89% rename from patches/todo/minecraft-patches/0035-Implement-NoChatReports.patch rename to divinemc-server/minecraft-patches/features/0035-Implement-NoChatReports.patch index 3573916..4cc81b9 100644 --- a/patches/todo/minecraft-patches/0035-Implement-NoChatReports.patch +++ b/divinemc-server/minecraft-patches/features/0035-Implement-NoChatReports.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement NoChatReports diff --git a/net/minecraft/network/FriendlyByteBuf.java b/net/minecraft/network/FriendlyByteBuf.java -index bef92cfa7eb86fbc6bc1b7d862eaca575eeeadec..b8701c45a6fa635f3ea18616f7c841de9df32877 100644 +index 70b35188e4762c8dcd46b2df14d4efd85e147dcd..8861148b0598891e7851d2c9cc6d79edfc26e55e 100644 --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java -@@ -106,7 +106,28 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -105,7 +105,28 @@ public class FriendlyByteBuf extends ByteBuf { return this; } @@ -37,7 +37,7 @@ index bef92cfa7eb86fbc6bc1b7d862eaca575eeeadec..b8701c45a6fa635f3ea18616f7c841de JsonElement jsonElement = LenientJsonParser.parse(this.readUtf()); DataResult dataResult = codec.parse(JsonOps.INSTANCE, jsonElement); return dataResult.getOrThrow(string -> new DecoderException("Failed to decode JSON: " + string)); -@@ -118,6 +139,19 @@ public class FriendlyByteBuf extends ByteBuf { +@@ -117,6 +138,19 @@ public class FriendlyByteBuf extends ByteBuf { } public void writeJsonWithCodec(Codec codec, T value, int maxLength) { // Paper end - Adventure; add max length parameter @@ -123,12 +123,12 @@ index 1df628ac0b414511aaed6e09d78f884c4170f730..1543f730843c1736c4db9a6ebe30be9c } } diff --git a/net/minecraft/network/protocol/status/ServerStatus.java b/net/minecraft/network/protocol/status/ServerStatus.java -index a491be4250de3199c3e1aa9e5482b568692bd2f5..c88826db76c28c536e6c36c5592d69c12de395d0 100644 +index 88447fc2108126ccfad2fb7eb79ac94537f132d3..571cbe6844ebb330801dd893a45c1f735ee87531 100644 --- a/net/minecraft/network/protocol/status/ServerStatus.java +++ b/net/minecraft/network/protocol/status/ServerStatus.java -@@ -15,13 +15,7 @@ import net.minecraft.network.chat.CommonComponents; - import net.minecraft.network.chat.Component; +@@ -14,13 +14,7 @@ import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentSerialization; + import net.minecraft.server.players.NameAndId; -public record ServerStatus( - Component description, @@ -141,7 +141,7 @@ index a491be4250de3199c3e1aa9e5482b568692bd2f5..c88826db76c28c536e6c36c5592d69c1 public static final Codec CODEC = RecordCodecBuilder.create( instance -> instance.group( ComponentSerialization.CODEC.lenientOptionalFieldOf("description", CommonComponents.EMPTY).forGetter(ServerStatus::description), -@@ -33,6 +27,63 @@ public record ServerStatus( +@@ -32,6 +26,63 @@ public record ServerStatus( .apply(instance, ServerStatus::new) ); @@ -206,10 +206,10 @@ index a491be4250de3199c3e1aa9e5482b568692bd2f5..c88826db76c28c536e6c36c5592d69c1 private static final String PREFIX = "data:image/png;base64,"; public static final Codec CODEC = Codec.STRING.comapFlatMap(string -> { diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 104a9ec97bd39e15f6707f19865fa6fcf47f6e4f..46adbe6ccf1e4291e33a52a6612f624558c18f96 100644 +index 7486df33cedea98695c614bb3d584e1d8e84314f..f9ec63ed7feb67e558abed99746726c10e9e10f4 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -623,6 +623,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -833,6 +833,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @Override public boolean enforceSecureProfile() { @@ -218,10 +218,10 @@ index 104a9ec97bd39e15f6707f19865fa6fcf47f6e4f..46adbe6ccf1e4291e33a52a6612f6245 // Paper start - Add setting for proxy online mode status return properties.enforceSecureProfile diff --git a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 1975aeecbfdebaacecae1c43005d4ff26fa6a263..e5d6e5ec12168936d6d50b2f38a3cb58150b0af1 100644 +index 4a333e87af17bd5b673b57c0fa0d3a239fb8db59..e5569978a23c5bde673146421963a2ff0905d514 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -343,10 +343,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -344,10 +344,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } public void send(Packet packet) { @@ -257,7 +257,7 @@ index 1975aeecbfdebaacecae1c43005d4ff26fa6a263..e5d6e5ec12168936d6d50b2f38a3cb58 this.send(packet, null); } - public void send(Packet packet, @Nullable ChannelFutureListener channelFutureListener) { + public void send(Packet packet, @Nullable ChannelFutureListener sendListener) { + // DivineMC start - Implement NoChatReports + if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsEnabled) { + Object self = this; @@ -270,7 +270,7 @@ index 1975aeecbfdebaacecae1c43005d4ff26fa6a263..e5d6e5ec12168936d6d50b2f38a3cb58 + } + + if (org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsConvertToGameMessage) { -+ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && channelFutureListener != null) { ++ if (packet instanceof net.minecraft.network.protocol.game.ClientboundPlayerChatPacket chat && sendListener != null) { + cancel = true; + listenerImpl.send(chat); + } @@ -287,19 +287,19 @@ index 1975aeecbfdebaacecae1c43005d4ff26fa6a263..e5d6e5ec12168936d6d50b2f38a3cb58 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 1e4ebfa25e63c148fe7bf6cf5789e602d8e5ca83..259572797f17c3c660de9fd42bb1cebe600fbf27 100644 +index 6c6213323df278391b30dd9f22c408a34ec052c8..c8e68bbb210457366822f2c4a01afb49693035ac 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -276,7 +276,7 @@ public abstract class PlayerList { - !_boolean, - _boolean2, - player.createCommonSpawnInfo(serverLevel), -- this.server.enforceSecureProfile() -+ org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsEnabled || this.server.enforceSecureProfile() // DivineMC - Implement NoChatReports - ) - ); - player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit -@@ -1331,6 +1331,7 @@ public abstract class PlayerList { +@@ -181,7 +181,7 @@ public abstract class PlayerList { + !_boolean, + _boolean2, + player.createCommonSpawnInfo(serverLevel), +- this.server.enforceSecureProfile() ++ org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsEnabled || this.server.enforceSecureProfile() // DivineMC - Implement NoChatReports + ) + ); + player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit +@@ -1255,6 +1255,7 @@ public abstract class PlayerList { } public boolean verifyChatTrusted(PlayerChatMessage message) { diff --git a/patches/todo/minecraft-patches/0036-Lag-compensation.patch b/divinemc-server/minecraft-patches/features/0036-Lag-compensation.patch similarity index 87% rename from patches/todo/minecraft-patches/0036-Lag-compensation.patch rename to divinemc-server/minecraft-patches/features/0036-Lag-compensation.patch index 231102a..ac5cb31 100644 --- a/patches/todo/minecraft-patches/0036-Lag-compensation.patch +++ b/divinemc-server/minecraft-patches/features/0036-Lag-compensation.patch @@ -5,18 +5,18 @@ Subject: [PATCH] Lag compensation diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 221afb586fa0a0826809fb2c0c956450b461b341..2a03d85b15377f5c5286a6fea5b592b9ff76b791 100644 +index 207726e54ccad6b41d5e6f509076903eab00e870..fd3ecd4f9b5a7c34a22cd290f1869d90061a4c65 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -288,6 +288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system -@@ -1536,6 +1537,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop key) { @@ -220,10 +220,10 @@ index c78a68df7f088338b18b6c2511d8db62bb809c52..5ad9ad7303b1322e811f178f03b1853a public static class BooleanValue extends GameRules.Value { private boolean value; diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index 8db95b74f88f8096de93115ae8d3fb2e6184ad3b..e044830439fe9821ab3f62695d318a6321b8a266 100644 +index a7dadab83644e9555dec4f597fee682be37e85c8..5f6fbc7eaa5522bd5e0692c9c2d280457a284e71 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -347,13 +347,21 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -350,13 +350,21 @@ public abstract class BlockBehaviour implements FeatureElement { protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { } @@ -248,10 +248,10 @@ index 8db95b74f88f8096de93115ae8d3fb2e6184ad3b..e044830439fe9821ab3f62695d318a63 } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 6d9274f0da9507d0152611d6b7785e0524dedb2d..1ffd82f8459525c73ea2f4a57568eb5966b312dd 100644 +index b03fa199a532ff7e0e14d9ad449ee8308e6e76bc..3a9843c30f685d2e1f0cd54ace5dddfa9e2314fa 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -917,6 +917,19 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -957,6 +957,19 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot this.ticker = ticker; } @@ -271,8 +271,8 @@ index 6d9274f0da9507d0152611d6b7785e0524dedb2d..1ffd82f8459525c73ea2f4a57568eb59 @Override public void tick() { if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) { -@@ -925,7 +938,11 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - try { +@@ -967,7 +980,11 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot + profilerFiller.push(this::getType); BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { - this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); @@ -285,10 +285,10 @@ index 6d9274f0da9507d0152611d6b7785e0524dedb2d..1ffd82f8459525c73ea2f4a57568eb59 // Paper start - Remove the Block Entity if it's invalid } else { diff --git a/net/minecraft/world/level/material/LavaFluid.java b/net/minecraft/world/level/material/LavaFluid.java -index e7ae29a4da3bf36b99fdab39af78f03c06696dbc..6ae99a4dc04f48342b948fcfeaffc68babe60f96 100644 +index bbc658abfb2df1b3ee3a31d46c4b9014bb34e0a2..38d4392a09d1d3ccebe602cf2319395217d55649 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -187,9 +187,22 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -188,9 +188,22 @@ public abstract class LavaFluid extends FlowingFluid { return fluidState.getHeight(blockReader, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); } diff --git a/patches/todo/minecraft-patches/0037-Virtual-Threads.patch b/divinemc-server/minecraft-patches/features/0037-Virtual-Threads.patch similarity index 74% rename from patches/todo/minecraft-patches/0037-Virtual-Threads.patch rename to divinemc-server/minecraft-patches/features/0037-Virtual-Threads.patch index 25a57a4..693661b 100644 --- a/patches/todo/minecraft-patches/0037-Virtual-Threads.patch +++ b/divinemc-server/minecraft-patches/features/0037-Virtual-Threads.patch @@ -4,29 +4,11 @@ Date: Mon, 24 Feb 2025 19:29:58 +0300 Subject: [PATCH] Virtual Threads -diff --git a/net/minecraft/Util.java b/net/minecraft/Util.java -index 138a58c5e5698b926b01e0170733dc3dbc5589ec..bfe52d5a93a35cafcb8965482b1c1d6c398255e4 100644 ---- a/net/minecraft/Util.java -+++ b/net/minecraft/Util.java -@@ -98,7 +98,12 @@ public class Util { - public static final TracingExecutor DIMENSION_DATA_IO_POOL = makeExtraIoExecutor("Dimension-Data-IO-Worker-"); // Paper - Separate dimension data IO pool - private static final TracingExecutor DOWNLOAD_POOL = makeIoExecutor("Download-", true); - // Paper start - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread -- public static final ExecutorService PROFILE_EXECUTOR = Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() { -+ // DivineMC start - Virtual Threads -+ public static final ExecutorService PROFILE_EXECUTOR = org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.virtualThreadsEnabled && org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.virtualProfileLookupPool -+ ? Executors.newVirtualThreadPerTaskExecutor() -+ : Executors.newFixedThreadPool(2, new java.util.concurrent.ThreadFactory() -+ { -+ // DivineMC end - Virtual Threads - - private final AtomicInteger count = new AtomicInteger(); - diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 758ce439d2e10e6ef42a58d147a77093667e0acd..de622982f864d96a5b76efcd69f1836ef541317b 100644 +index 9a7a40c1dcea57ba674d8431077d2477104a456f..8e41097f978800039e6e057c5bbcfcf03f5a9c89 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -481,7 +481,7 @@ public class Commands { +@@ -482,7 +482,7 @@ public class Commands { } // Fixed pool, but with discard policy @@ -36,10 +18,10 @@ index 758ce439d2e10e6ef42a58d147a77093667e0acd..de622982f864d96a5b76efcd69f1836e new java.util.concurrent.LinkedBlockingQueue<>(), new com.google.common.util.concurrent.ThreadFactoryBuilder() diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 2a03d85b15377f5c5286a6fea5b592b9ff76b791..1877ee1431b0f858b6a5da7347d72fe90374e27a 100644 +index fd3ecd4f9b5a7c34a22cd290f1869d90061a4c65..a876c7c47788218a86cef53330b2c07f7008b0b0 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2644,8 +2644,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0) { new io.papermc.paper.event.packet.PlayerChunkUnloadEvent(player.getBukkitEntity().getWorld().getChunkAt(new ChunkPos(chunkX, chunkZ).longKey), player.getBukkitEntity()).callEvent(); diff --git a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java -index 9f6d7c5dc0e591488a8a3763d8a1f1b3671d5299..4983a34e42ef972f2d5ad8a12dfad99ca88d7032 100644 +index 6987eeace609fbfba967922e558e09268e0f6d44..5af3bb5b9f8670977479cbc5ced39663d46d261d 100644 --- a/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java +++ b/net/minecraft/network/protocol/game/ClientboundLevelChunkPacketData.java @@ -75,6 +75,52 @@ public class ClientboundLevelChunkPacketData { @@ -113,7 +113,7 @@ index 8578d1f78ddd1bb75f3230f04bfaa35af9f5f822..7c55fabd264e4e813d68798433dfccfb this.x = buffer.readInt(); this.z = buffer.readInt(); diff --git a/net/minecraft/server/network/PlayerChunkSender.java b/net/minecraft/server/network/PlayerChunkSender.java -index 0376a10ee0544b13e8fd629a7b13f78811e57a30..68c34ebf4dcf280aca6be27f3e34a5a74934ff45 100644 +index 644948d64791d0ffa4166375d0f4419f1ffa214a..f2d563076fd4e723372042df108f7f6c7ab45304 100644 --- a/net/minecraft/server/network/PlayerChunkSender.java +++ b/net/minecraft/server/network/PlayerChunkSender.java @@ -64,13 +64,25 @@ public class PlayerChunkSender { @@ -145,8 +145,8 @@ index 0376a10ee0544b13e8fd629a7b13f78811e57a30..68c34ebf4dcf280aca6be27f3e34a5a7 } } @@ -81,7 +93,24 @@ public class PlayerChunkSender { - // Paper start - Anti-Xray - public static void sendChunk(ServerGamePacketListenerImpl packetListener, ServerLevel level, LevelChunk chunk) { + public static void sendChunk(ServerGamePacketListenerImpl packetListener, ServerLevel level, LevelChunk chunk) { // Paper - rewrite chunk system - public + // Paper start - Anti-Xray final boolean shouldModify = level.chunkPacketBlockController.shouldModify(packetListener.player, chunk); - packetListener.send(new ClientboundLevelChunkWithLightPacket(chunk, level.getLightEngine(), null, null, shouldModify)); + @@ -171,10 +171,10 @@ index 0376a10ee0544b13e8fd629a7b13f78811e57a30..68c34ebf4dcf280aca6be27f3e34a5a7 // Paper start - PlayerChunkLoadEvent if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { diff --git a/net/minecraft/world/level/chunk/LevelChunkSection.java b/net/minecraft/world/level/chunk/LevelChunkSection.java -index df717c545472006b99532280c38c1fbef12bcf82..ba4c20df405f41a526273a6216d2aedf4e5c435e 100644 +index 66ef3678fd70c5f15a13eee95f4046697e46b077..ecb04bc9f42cd55949aab9f21e052619a6d0afca 100644 --- a/net/minecraft/world/level/chunk/LevelChunkSection.java +++ b/net/minecraft/world/level/chunk/LevelChunkSection.java -@@ -18,7 +18,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ +@@ -14,7 +14,7 @@ public class LevelChunkSection implements ca.spottedleaf.moonrise.patches.block_ public static final int SECTION_HEIGHT = 16; public static final int SECTION_SIZE = 4096; public static final int BIOME_CONTAINER_BITS = 2; diff --git a/divinemc-server/minecraft-patches/features/0039-Command-block-parse-results-caching.patch b/divinemc-server/minecraft-patches/features/0039-Command-block-parse-results-caching.patch new file mode 100644 index 0000000..5659ecd --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0039-Command-block-parse-results-caching.patch @@ -0,0 +1,83 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sat, 15 Mar 2025 22:01:08 +0300 +Subject: [PATCH] Command block parse results caching + + +diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java +index 8bb72b05707250774fca1def7764036f04d2a896..4a6ccf073db21a40edbedf1122258e7cef68b857 100644 +--- a/net/minecraft/world/level/BaseCommandBlock.java ++++ b/net/minecraft/world/level/BaseCommandBlock.java +@@ -35,6 +35,10 @@ public abstract class BaseCommandBlock { + private String command = ""; + @Nullable + private Component customName; ++ // DivineMC start - Caching command block parse results ++ private String lastExecutedCommand; ++ private com.mojang.brigadier.ParseResults parseResultsCache; ++ // DivineMC end - Caching command block parse results + // CraftBukkit start + protected abstract org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper); + // CraftBukkit end +@@ -115,13 +119,41 @@ public abstract class BaseCommandBlock { + this.successCount++; + } + }); +- // Paper start - ServerCommandEvent +- org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), net.minecraft.commands.Commands.trimOptionalPrefix(this.command)); +- if (!event.callEvent()) { +- return true; ++ // DivineMC start - Command block parse results caching ++ if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.commandBlockParseResultsCaching) { ++ String commandCache = this.command; ++ // noinspection DuplicatedCode ++ com.google.common.base.Joiner joiner = com.google.common.base.Joiner.on(" "); ++ ++ if (commandCache.startsWith("/")) { ++ commandCache = commandCache.substring(1); ++ } ++ ++ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), commandCache); ++ org.bukkit.Bukkit.getPluginManager().callEvent(event); ++ if (!event.isCancelled()) { ++ commandCache = event.getCommand(); ++ String[] args = commandCache.split(" "); ++ ++ if (args.length != 0) { ++ String newCommand = joiner.join(args); ++ if (!newCommand.equals(lastExecutedCommand) || parseResultsCache == null) { ++ MinecraftServer.LOGGER.info("Recompiling parse results cache for command block at ({}, {}, {})", this.getPosition().x, this.getPosition().y, this.getPosition().z); ++ this.cache(server.getCommands().getDispatcher(), commandSourceStack, newCommand); ++ } ++ server.getCommands().performCommand(parseResultsCache, newCommand); ++ } ++ } ++ } else { ++ // Paper start - ServerCommandEvent ++ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), net.minecraft.commands.Commands.trimOptionalPrefix(this.command)); ++ if (!event.callEvent()) { ++ return true; ++ } ++ server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); ++ // Paper end - ServerCommandEvent + } +- server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); +- // Paper end - ServerCommandEvent ++ // DivineMC end - Command block parse results caching + } + } catch (Throwable var8) { + CrashReport crashReport = CrashReport.forThrowable(var8, "Executing command block"); +@@ -142,6 +174,13 @@ public abstract class BaseCommandBlock { + } + } + ++ // DivineMC start - Command block parse results caching ++ private void cache(com.mojang.brigadier.CommandDispatcher dispatcher, CommandSourceStack commandSourceStack, String commandCache) { ++ this.parseResultsCache = dispatcher.parse(commandCache, commandSourceStack); ++ this.lastExecutedCommand = commandCache; ++ } ++ // DivineMC end - Command block parse results caching ++ + @Nullable + private BaseCommandBlock.CloseableCommandBlockSource createSource() { + return this.trackOutput ? new BaseCommandBlock.CloseableCommandBlockSource() : null; diff --git a/patches/todo/minecraft-patches/0040-Player-ProfileResult-caching.patch b/divinemc-server/minecraft-patches/features/0040-Player-ProfileResult-caching.patch similarity index 84% rename from patches/todo/minecraft-patches/0040-Player-ProfileResult-caching.patch rename to divinemc-server/minecraft-patches/features/0040-Player-ProfileResult-caching.patch index 5d21587..0c96eaa 100644 --- a/patches/todo/minecraft-patches/0040-Player-ProfileResult-caching.patch +++ b/divinemc-server/minecraft-patches/features/0040-Player-ProfileResult-caching.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Player ProfileResult caching diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 20ba45054c243fbb85e50cf0bdf75648730cb0bc..443aebb71b2a55ee9dcd2dd4bf9a30fbb8da9e49 100644 +index ace65f36d6562988665c530dd3fdbfaa5d2e2071..68e88a923d8dd8cd91f0ccd2b82cd60a492ad359 100644 --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -71,6 +71,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -72,6 +72,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, public @Nullable java.util.UUID requestedUuid; // Paper private final io.papermc.paper.connection.PaperPlayerLoginConnection paperLoginConnection; // Paper - Config API private volatile boolean disconnecting = false; // Paper - Fix disconnect still ticking login @@ -20,12 +20,13 @@ index 20ba45054c243fbb85e50cf0bdf75648730cb0bc..443aebb71b2a55ee9dcd2dd4bf9a30fb public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) { this.server = server; -@@ -256,9 +261,23 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -258,10 +263,25 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, String string1 = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); try { - ProfileResult profileResult = ServerLoginPacketListenerImpl.this.server -- .getSessionService() +- .services() +- .sessionService() - .hasJoinedServer(string1, string, this.getAddress()); + // DivineMC start - Player ProfileResult caching + ProfileResult profileResult; @@ -34,13 +35,15 @@ index 20ba45054c243fbb85e50cf0bdf75648730cb0bc..443aebb71b2a55ee9dcd2dd4bf9a30fb + + if (profileResult == null) { + profileResult = ServerLoginPacketListenerImpl.this.server -+ .getSessionService() ++ .services() ++ .sessionService() + .hasJoinedServer(string1, string, this.getAddress()); + playerProfileResultCache.put(string1, profileResult); + } + } else { + profileResult = ServerLoginPacketListenerImpl.this.server -+ .getSessionService() ++ .services() ++ .sessionService() + .hasJoinedServer(string1, string, this.getAddress()); + } + // DivineMC end - Player ProfileResult caching diff --git a/patches/todo/minecraft-patches/0048-Clump-experience-orbs.patch b/divinemc-server/minecraft-patches/features/0041-Clump-experience-orbs.patch similarity index 99% rename from patches/todo/minecraft-patches/0048-Clump-experience-orbs.patch rename to divinemc-server/minecraft-patches/features/0041-Clump-experience-orbs.patch index 9a4c5dc..caff17a 100644 --- a/patches/todo/minecraft-patches/0048-Clump-experience-orbs.patch +++ b/divinemc-server/minecraft-patches/features/0041-Clump-experience-orbs.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Clump experience orbs diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java -index 66ae0b340c7e9ebccfeaee786577e27916ace38c..c3144a0e2a839c0d8ae2d1c450213fa6a56a58c4 100644 +index 850da365c388801f2083fd1471cc32ce86297de0..1c02152f1761476b19ac36e367d945c111854c0a 100644 --- a/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java @@ -50,6 +50,10 @@ public class ExperienceOrb extends Entity { diff --git a/patches/todo/minecraft-patches/0042-Dynamic-Activation-of-Brain.patch b/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch similarity index 85% rename from patches/todo/minecraft-patches/0042-Dynamic-Activation-of-Brain.patch rename to divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch index 6551e6c..aaea614 100644 --- a/patches/todo/minecraft-patches/0042-Dynamic-Activation-of-Brain.patch +++ b/divinemc-server/minecraft-patches/features/0042-Dynamic-Activation-of-Brain.patch @@ -31,10 +31,10 @@ index ca21597263cb430e2a5ae07e8cecfb0d53a270d2..226088405c019922085285ba5d04d7c1 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 421b59b24bda3d03dea8fd0fc6237a71900e1cdc..78bf3365b426e7090182af84630111d410a2460e 100644 +index 2f09f9c02e63563828dd7000352baf2723a0ac59..e1497f28b870e014e89ec6b189ee7989b07bb933 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -802,6 +802,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -829,6 +829,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.entityTickList .forEach( entity -> { @@ -43,10 +43,10 @@ index 421b59b24bda3d03dea8fd0fc6237a71900e1cdc..78bf3365b426e7090182af84630111d4 if (!tickRateManager.isEntityFrozen(entity)) { entity.checkDespawn(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 8808424481bf0c1f89f67d25ba502014d55ebc49..9e53b4297fa786ee863d0cf1855aa0ebd9afc221 100644 +index b5004de3ca8951a5884a3b62b129aa2588a67af7..6724ef32e4d0de6ca0965b8b96430b68179b4bd7 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -365,6 +365,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -367,6 +367,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name public boolean fixedPose = false; // Paper - Expand Pose API private final int despawnTime; // Paper - entity despawn time limit public int totalEntityAge; // Paper - age-like counter for all entities @@ -56,10 +56,10 @@ index 8808424481bf0c1f89f67d25ba502014d55ebc49..9e53b4297fa786ee863d0cf1855aa0eb // Paper start - EAR 2 public final boolean defaultActivationState; diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java -index 9950fccc0a708e701b81fcabc9e8f370e6d3a19d..0159627e2c9a540d062073faf9018f5215e10866 100644 +index c7544cad07293a504204cfa8bf9d8322ef16118c..e680780a0e46e9e5f9126bd11a20b918e8c36066 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1085,6 +1085,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -1192,6 +1192,7 @@ public class EntityType implements FeatureElement, EntityTypeT private final boolean canSpawnFarFromPlayer; private final int clientTrackingRange; private final int updateInterval; @@ -68,10 +68,10 @@ index 9950fccc0a708e701b81fcabc9e8f370e6d3a19d..0159627e2c9a540d062073faf9018f52 @Nullable private Component description; diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index 74bd00f5f8ab628d3f35d0f2e39fb1dbf7045c23..faf29073db00f8e10136e03dc877dcfb38f795d0 100644 +index c3a7a41b399590e2c004fda4e97b1935575c4972..dd25b049615c4465c1bf9ea0004dd649f5c55c5f 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java -@@ -210,10 +210,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -220,10 +220,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void inactiveTick() { super.inactiveTick(); @@ -84,7 +84,7 @@ index 74bd00f5f8ab628d3f35d0f2e39fb1dbf7045c23..faf29073db00f8e10136e03dc877dcfb this.targetSelector.tick(); } } -@@ -773,13 +773,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -784,13 +784,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab // Paper end - Allow nerfed mobs to jump and float this.sensing.tick(); int i = this.tickCount + this.getId(); @@ -147,10 +147,10 @@ index 653c58c7637c46c8b46a5082f671324a2221d431..a4328a427636aa845d6627ecb75a9efe public boolean hasTasks() { for (WrappedGoal task : this.availableGoals) { diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index dd10b0535baf48aea47020d890f102800b0af11a..e0c4dc78c669fd53e0c03c3013eb439e4a07c690 100644 +index 3a2451bfa5e59de51d703eac8a536284e1d3348b..2422895ca4a2939f52f119384f498bd23bf9b7cc 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -113,6 +113,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -112,6 +112,7 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS private float spinningAnimationTicks0; public boolean forceDancing = false; // CraftBukkit private org.purpurmc.purpur.controller.FlyingMoveControllerWASD purpurController; // Purpur - Ridables @@ -158,11 +158,11 @@ index dd10b0535baf48aea47020d890f102800b0af11a..e0c4dc78c669fd53e0c03c3013eb439e public Allay(EntityType entityType, Level level) { super(entityType, level); -@@ -267,10 +268,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS +@@ -266,10 +267,13 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - AllayAi.updateActivity(this); - super.customServerAiStep(level); @@ -177,10 +177,10 @@ index dd10b0535baf48aea47020d890f102800b0af11a..e0c4dc78c669fd53e0c03c3013eb439e @Override diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index deb2fdea7be9dda1c4b267ac25326bb9b05ae739..ab13d9c2aedda17c8cbc911e678aac8b6b28801d 100644 +index 1927f8be451258d9f0f8eec1617d103a4140e1e7..781ce63ff615d718cdf14bf6c3a4c742f628a920 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -112,6 +112,7 @@ public class Axolotl extends Animal implements Bucketable { +@@ -111,6 +111,7 @@ public class Axolotl extends Animal implements Bucketable { public final BinaryAnimator onGroundAnimator = new BinaryAnimator(10, Mth::easeInOutSine); public final BinaryAnimator movingAnimator = new BinaryAnimator(10, Mth::easeInOutSine); private static final int REGEN_BUFF_BASE_DURATION = 100; @@ -188,11 +188,11 @@ index deb2fdea7be9dda1c4b267ac25326bb9b05ae739..ab13d9c2aedda17c8cbc911e678aac8b public Axolotl(EntityType entityType, Level level) { super(entityType, level); -@@ -373,13 +374,16 @@ public class Axolotl extends Animal implements Bucketable { +@@ -372,13 +373,16 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - AxolotlAi.updateActivity(this); - if (!this.isNoAi()) { @@ -212,10 +212,10 @@ index deb2fdea7be9dda1c4b267ac25326bb9b05ae739..ab13d9c2aedda17c8cbc911e678aac8b public static AttributeSupplier.Builder createAttributes() { diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index f67d18f32f73e0e6be35939781bd0bd0188cdfbd..f526a426d02f8fb1ce6c1b16e0ed3edae8ab5271 100644 +index 1a504e30602d7d8feaf7a9180adf6382596aae02..9656c1bf22b1b6c945a8ba5603742261db650fd5 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -106,6 +106,7 @@ public class Frog extends Animal { +@@ -105,6 +105,7 @@ public class Frog extends Animal { public final AnimationState swimIdleAnimationState = new AnimationState(); private org.purpurmc.purpur.controller.MoveControllerWASD purpurLandController; // Purpur - Ridables private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurWaterController; // Purpur - Ridables @@ -223,11 +223,11 @@ index f67d18f32f73e0e6be35939781bd0bd0188cdfbd..f526a426d02f8fb1ce6c1b16e0ed3eda public Frog(EntityType entityType, Level level) { super(entityType, level); -@@ -259,10 +260,13 @@ public class Frog extends Animal { +@@ -258,10 +259,13 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - FrogAi.updateActivity(this); - super.customServerAiStep(level); @@ -242,10 +242,10 @@ index f67d18f32f73e0e6be35939781bd0bd0188cdfbd..f526a426d02f8fb1ce6c1b16e0ed3eda @Override diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index c25cfd8f176819efd64e5ce45632b0cc1b69d420..f654228b59950e1f866d8decf208eb4f1a5ff603 100644 +index 8312a0d5229043fd84125db809c4346bb80f2bc0..1a437d3e09484f4bacc4ef22b3e5f1c3c58ca42f 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -65,6 +65,7 @@ public class Tadpole extends AbstractFish { +@@ -64,6 +64,7 @@ public class Tadpole extends AbstractFish { ); public boolean ageLocked; // Paper private org.purpurmc.purpur.controller.WaterMoveControllerWASD purpurController; // Purpur - Ridables @@ -253,11 +253,11 @@ index c25cfd8f176819efd64e5ce45632b0cc1b69d420..f654228b59950e1f866d8decf208eb4f public Tadpole(EntityType entityType, Level level) { super(entityType, level); -@@ -135,10 +136,13 @@ public class Tadpole extends AbstractFish { +@@ -134,10 +135,13 @@ public class Tadpole extends AbstractFish { @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - TadpoleAi.updateActivity(this); - super.customServerAiStep(level); @@ -272,10 +272,10 @@ index c25cfd8f176819efd64e5ce45632b0cc1b69d420..f654228b59950e1f866d8decf208eb4f public static AttributeSupplier.Builder createAttributes() { diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index 934853721c000186e4a97b05ad26c59d7e84dd55..4913e44112da5c43b36e4e4e456ccebecc8e7cc3 100644 +index 73fe7a8c216aed7dc2274fd53fb126d85ec5137d..d4de51a8fd1f2adfc35eb6e23cda6905bd376515 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -94,6 +94,7 @@ public class Goat extends Animal { +@@ -93,6 +93,7 @@ public class Goat extends Animal { private static final boolean DEFAULT_HAS_RIGHT_HORN = true; private boolean isLoweringHead; private int lowerHeadTick; @@ -283,11 +283,11 @@ index 934853721c000186e4a97b05ad26c59d7e84dd55..4913e44112da5c43b36e4e4e456ccebe public Goat(EntityType entityType, Level level) { super(entityType, level); -@@ -233,10 +234,13 @@ public class Goat extends Animal { +@@ -232,10 +233,13 @@ public class Goat extends Animal { @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - GoatAi.updateActivity(this); - super.customServerAiStep(level); @@ -302,10 +302,10 @@ index 934853721c000186e4a97b05ad26c59d7e84dd55..4913e44112da5c43b36e4e4e456ccebe @Override diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 952fba6d141576089e563e829cae4a177f19d639..ba0ec0eb69742df84435102f6871cf1ab94b3aca 100644 +index b22519a6d39bd52381fa6c17b9a415944374368b..10e36ec8d5e3ee44400e916632771a9cc1381664 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -@@ -88,6 +88,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -87,6 +87,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { MemoryModuleType.PACIFIED, MemoryModuleType.IS_PANICKING ); @@ -313,11 +313,11 @@ index 952fba6d141576089e563e829cae4a177f19d639..ba0ec0eb69742df84435102f6871cf1a public Hoglin(EntityType entityType, Level level) { super(entityType, level); -@@ -206,18 +207,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -205,18 +206,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - HoglinAi.updateActivity(this); - if (this.isConverting()) { @@ -346,10 +346,10 @@ index 952fba6d141576089e563e829cae4a177f19d639..ba0ec0eb69742df84435102f6871cf1a @Override diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index 03b6640c95c86ea9f6219d6e39feffa4643dd648..74e753a9a2b4e4132558c39d3d8a5424d819e78b 100644 +index dea7c211a2d2ee8f1833eaad49513b3690b06c55..e2b467cfc19dfcf1fb617e57251451aa88de727d 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -129,6 +129,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -128,6 +128,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento private static final com.mojang.serialization.Codec> ITEM_SET_CODEC = net.minecraft.core.registries.BuiltInRegistries.ITEM .byNameCodec().listOf().xmap(java.util.HashSet::new, List::copyOf); // CraftBukkit end @@ -357,11 +357,11 @@ index 03b6640c95c86ea9f6219d6e39feffa4643dd648..74e753a9a2b4e4132558c39d3d8a5424 public Piglin(EntityType entityType, Level level) { super(entityType, level); -@@ -357,10 +358,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -345,10 +346,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - PiglinAi.updateActivity(this); - super.customServerAiStep(level); @@ -376,10 +376,10 @@ index 03b6640c95c86ea9f6219d6e39feffa4643dd648..74e753a9a2b4e4132558c39d3d8a5424 @Override diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index 091b9cc338e37efbecdd4187a9824dae7bff2af9..808661fdefacfffa65ebde1aa3193a82497706b7 100644 +index ac7691a2a3e4c9db040408d1ecba780a89dea50e..e3478244e430faa614f23c288019303bd6bb0e04 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -108,6 +108,7 @@ public class Warden extends Monster implements VibrationSystem { +@@ -107,6 +107,7 @@ public class Warden extends Monster implements VibrationSystem { private final VibrationSystem.User vibrationUser; private VibrationSystem.Data vibrationData; AngerManagement angerManagement = new AngerManagement(this::canTargetEntity, Collections.emptyList()); @@ -387,11 +387,11 @@ index 091b9cc338e37efbecdd4187a9824dae7bff2af9..808661fdefacfffa65ebde1aa3193a82 public Warden(EntityType entityType, Level level) { super(entityType, level); -@@ -301,19 +302,22 @@ public class Warden extends Monster implements VibrationSystem { +@@ -300,19 +301,22 @@ public class Warden extends Monster implements VibrationSystem { @Override protected void customServerAiStep(ServerLevel level) { -- if ((getRider() == null || !this.isControllable())) // Purpur - only use brain if no rider +- if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); - super.customServerAiStep(level); - if ((this.tickCount + this.getId()) % 120 == 0) { @@ -422,7 +422,7 @@ index 091b9cc338e37efbecdd4187a9824dae7bff2af9..808661fdefacfffa65ebde1aa3193a82 @Override diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index db5c287161c50bafd672b9cb439b3a06b1ff16d7..c2c6f5e8837ae2ac685b56562686b552b3e1bd8f 100644 +index 3bcd3b7c9f7ad408d66fad5b1b70ebee96a61b43..94424c01b0c4a28c7eafd5c02d068b9c41e451e2 100644 --- a/net/minecraft/world/entity/npc/Villager.java +++ b/net/minecraft/world/entity/npc/Villager.java @@ -178,6 +178,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler @@ -434,12 +434,12 @@ index db5c287161c50bafd672b9cb439b3a06b1ff16d7..c2c6f5e8837ae2ac685b56562686b552 public Villager(EntityType entityType, Level level) { this(entityType, level, VillagerType.PLAINS); -@@ -399,7 +401,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +@@ -398,7 +400,7 @@ public class Villager extends AbstractVillager implements ReputationEventHandler + } else { this.isLobotomized = false; } - // Purpur end - Lobotomize stuck villagers - if (!inactive && (getRider() == null || !this.isControllable())) { // Purpur - Ridables + if (!inactive && this.behaviorTick++ % this.activatedPriority == 0 && (getRider() == null || !this.isControllable())) { // Purpur - Ridables // DivineMC - Dynamic Activation of Brain this.getBrain().tick(level, this); // Paper - EAR 2 } - else if (this.isLobotomized && shouldRestock()) restock(); // Purpur - Lobotomize stuck villagers + else if (this.isLobotomized && shouldRestock()) restock(); diff --git a/patches/todo/minecraft-patches/0041-Implement-Secure-Seed.patch b/divinemc-server/minecraft-patches/features/0043-Implement-Secure-Seed.patch similarity index 89% rename from patches/todo/minecraft-patches/0041-Implement-Secure-Seed.patch rename to divinemc-server/minecraft-patches/features/0043-Implement-Secure-Seed.patch index 6ff2812..c5ca6d9 100644 --- a/patches/todo/minecraft-patches/0041-Implement-Secure-Seed.patch +++ b/divinemc-server/minecraft-patches/features/0043-Implement-Secure-Seed.patch @@ -29,10 +29,10 @@ index 7c1e18d8362be5ae885c32b05e98b9ef45942d93..a414de3768972157d3031222fd160556 })); } diff --git a/net/minecraft/server/dedicated/DedicatedServerProperties.java b/net/minecraft/server/dedicated/DedicatedServerProperties.java -index b286dc17cda16fca3af9374d2a4a8bd137c24450..b42ad5b411af2a52daac040347647fa37460022b 100644 +index a9cd61f0a7bde931e59f1496191f1f8d465aec5e..7711cc269b97811836f1b1dafd0f38eac5cdc7d3 100644 --- a/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -116,7 +116,17 @@ public class DedicatedServerProperties extends Settings GsonHelper.parse(!property.isEmpty() ? property : "{}"), new JsonObject()), this.get("level-type", property -> property.toLowerCase(Locale.ROOT), WorldPresets.NORMAL.location().toString()) diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 25150731bb3f3d04b248ebc47fc9b453e49a705e..75c8ce32e68f92e20201e9c243f46f2be716eac8 100644 +index 301b45e375dafeefed56eb0db5dd51eea4c97459..65607de63f6ea900599660485861860b71e1aef3 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -619,6 +619,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -614,6 +614,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } public ChunkGenerator getGenerator() { @@ -64,10 +64,10 @@ index 25150731bb3f3d04b248ebc47fc9b453e49a705e..75c8ce32e68f92e20201e9c243f46f2b } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 85c4d709b6d04e8f43baf7b900ee59eae5d98fe0..421b59b24bda3d03dea8fd0fc6237a71900e1cdc 100644 +index e1497f28b870e014e89ec6b189ee7989b07bb933..b240c7f2579e25d520fbc0ab08e801028bc15192 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -629,6 +629,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -655,6 +655,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe chunkGenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkGenerator, gen); } // CraftBukkit end @@ -76,10 +76,10 @@ index 85c4d709b6d04e8f43baf7b900ee59eae5d98fe0..421b59b24bda3d03dea8fd0fc6237a71 DataFixer fixerUpper = server.getFixerUpper(); // Paper - rewrite chunk system diff --git a/net/minecraft/world/entity/monster/Slime.java b/net/minecraft/world/entity/monster/Slime.java -index b299fc08fe900b4d48ce3e6986bcea000253053e..4dc68a03f607cacbf7f1bf9c08a4cbc1edf86ace 100644 +index 970105d598964194e167ad243f6e2fc2a19fba08..74893d67a3fb6fd906afe9253f191f0e635f3277 100644 --- a/net/minecraft/world/entity/monster/Slime.java +++ b/net/minecraft/world/entity/monster/Slime.java -@@ -413,7 +413,11 @@ public class Slime extends Mob implements Enemy { +@@ -408,7 +408,11 @@ public class Slime extends Mob implements Enemy { } ChunkPos chunkPos = new ChunkPos(pos); @@ -93,10 +93,10 @@ index b299fc08fe900b4d48ce3e6986bcea000253053e..4dc68a03f607cacbf7f1bf9c08a4cbc1 final double maxHeightSlimeChunk = level.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; if (random.nextInt(10) == 0 && flag && pos.getY() < maxHeightSlimeChunk) { diff --git a/net/minecraft/world/level/chunk/ChunkAccess.java b/net/minecraft/world/level/chunk/ChunkAccess.java -index 81511de113c292549fe5fe720a15bf3e0497ca84..19f74518923783d8d5560b526a1f267dabd23156 100644 +index 2457247d2bc1c3e3b042a091c3a8290d55203da8..97b17c07b86f188e04cf747770be37b530f1dc61 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -83,6 +83,10 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -82,6 +82,10 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh public final Map blockEntities = new Object2ObjectOpenHashMap<>(); protected final LevelHeightAccessor levelHeightAccessor; protected final LevelChunkSection[] sections; @@ -107,7 +107,7 @@ index 81511de113c292549fe5fe720a15bf3e0497ca84..19f74518923783d8d5560b526a1f267d // CraftBukkit start - SPIGOT-6814: move to IChunkAccess to account for 1.17 to 1.18 chunk upgrading. private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); public org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.DirtyCraftPersistentDataContainer(ChunkAccess.DATA_TYPE_REGISTRY); -@@ -193,6 +197,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -190,6 +194,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh return GameEventListenerRegistry.NOOP; } @@ -126,10 +126,10 @@ index 81511de113c292549fe5fe720a15bf3e0497ca84..19f74518923783d8d5560b526a1f267d @Nullable diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java -index 854578c7880dc124980142941ee471072668c8e2..ef59461d9685fc33bd9b98a5c3fc5ec17b57841f 100644 +index 213fd45bd70d347a91c46244b61d8b77f11bf6fb..30cb24503fb2e1e3743e6d19634d77cd7de48e13 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -342,7 +342,11 @@ public abstract class ChunkGenerator { +@@ -346,7 +346,11 @@ public abstract class ChunkGenerator { Registry registry = level.registryAccess().lookupOrThrow(Registries.STRUCTURE); Map> map = registry.stream().collect(Collectors.groupingBy(structure1 -> structure1.step().ordinal())); List list = this.featuresPerStep.get(); @@ -142,29 +142,29 @@ index 854578c7880dc124980142941ee471072668c8e2..ef59461d9685fc33bd9b98a5c3fc5ec1 long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ()); Set> set = new ObjectArraySet<>(); ChunkPos.rangeClosed(sectionPos.chunk(), 1).forEach(chunkPos -> { -@@ -551,8 +555,18 @@ public abstract class ChunkGenerator { - } else { - ArrayList list1 = new ArrayList<>(list.size()); - list1.addAll(list); -- WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); -- worldgenRandom.setLargeFeatureSeed(structureState.getLevelSeed(), pos.x, pos.z); -+ // DivineMC start - Implement Secure Seed -+ WorldgenRandom worldgenRandom; -+ if (org.bxteam.divinemc.config.DivineConfig.MiscCategory.enableSecureSeed) { -+ worldgenRandom = new su.plo.matter.WorldgenCryptoRandom( -+ pos.x, pos.z, su.plo.matter.Globals.Salt.GENERATE_FEATURE, 0 -+ ); -+ } else { -+ worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); +@@ -561,8 +565,18 @@ public abstract class ChunkGenerator { + } else { + ArrayList list1 = new ArrayList<>(list.size()); + list1.addAll(list); +- WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); +- worldgenRandom.setLargeFeatureSeed(structureState.getLevelSeed(), pos.x, pos.z); ++ // DivineMC start - Implement Secure Seed ++ WorldgenRandom worldgenRandom; ++ if (org.bxteam.divinemc.config.DivineConfig.MiscCategory.enableSecureSeed) { ++ worldgenRandom = new su.plo.matter.WorldgenCryptoRandom( ++ pos.x, pos.z, su.plo.matter.Globals.Salt.GENERATE_FEATURE, 0 ++ ); ++ } else { ++ worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); + -+ worldgenRandom.setLargeFeatureSeed(structureState.getLevelSeed(), pos.x, pos.z); -+ } -+ // DivineMC end - Implement Secure Seed - int i = 0; ++ worldgenRandom.setLargeFeatureSeed(structureState.getLevelSeed(), pos.x, pos.z); ++ } ++ // DivineMC end - Implement Secure Seed + int i = 0; - for (StructureSet.StructureSelectionEntry structureSelectionEntry1 : list1) { + for (StructureSet.StructureSelectionEntry structureSelectionEntry1 : list1) { diff --git a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java -index 619b98e42e254c0c260c171a26a2472ddf59b885..7c110c3ab9b659fb26afddbe3541eb4e45503e4a 100644 +index b7762440bfd4f5ac105c22e5ded56cc6a1b2815a..8f57ff050356bd53f46eeeacd39c0fd39c5d1d70 100644 --- a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -205,14 +205,21 @@ public class ChunkGeneratorStructureState { @@ -388,13 +388,13 @@ index ee0d9dddb36b6879fa113299e24f1aa3b2b151cc..3af3bf800215ef78b98a4866df572f3b int i3 = this.spreadType.evaluate(worldgenRandom, i2); int i4 = this.spreadType.evaluate(worldgenRandom, i2); diff --git a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java -index f2eb0572b9d97d97bc847082461515a852310dfc..2d046320457de81a47b7e0be5134d54b8013ac7e 100644 +index 26b1b448c95ab38a449843a0ce929a008019b151..5660c6b1a60f78faa3a0e15f8317fea68ced7c83 100644 --- a/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java +++ b/net/minecraft/world/level/levelgen/structure/placement/StructurePlacement.java @@ -119,8 +119,17 @@ public abstract class StructurePlacement { public abstract StructurePlacementType type(); - private static boolean probabilityReducer(long levelSeed, int regionX, int regionZ, int salt, float probability, @org.jetbrains.annotations.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here + private static boolean probabilityReducer(long levelSeed, int regionX, int regionZ, int salt, float probability, @javax.annotation.Nullable Integer saltOverride) { // Paper - Add missing structure set seed configs; ignore here - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); - worldgenRandom.setLargeFeatureWithSalt(levelSeed, regionX, regionZ, salt); + // DivineMC start - Implement Secure Seed @@ -412,7 +412,7 @@ index f2eb0572b9d97d97bc847082461515a852310dfc..2d046320457de81a47b7e0be5134d54b } diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index cd3b24a760053dcd650a1a263b3c0093a0cbb175..e4ca880b5d16ae30676ec25c39c3d5b5f6cb3c24 100644 +index 3b66b16612b8328eaea786cc8ba3a59fd67900e4..fc31c2419fc895942391bbace8323791e0c7bf38 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java @@ -66,7 +66,11 @@ public class JigsawPlacement { diff --git a/patches/todo/minecraft-patches/0053-C2ME-Limit-NBT-cache.patch b/divinemc-server/minecraft-patches/features/0044-C2ME-Limit-NBT-cache.patch similarity index 100% rename from patches/todo/minecraft-patches/0053-C2ME-Limit-NBT-cache.patch rename to divinemc-server/minecraft-patches/features/0044-C2ME-Limit-NBT-cache.patch diff --git a/patches/todo/minecraft-patches/0043-Petal-Async-Pathfinding.patch b/divinemc-server/minecraft-patches/features/0045-Petal-Async-Pathfinding.patch similarity index 93% rename from patches/todo/minecraft-patches/0043-Petal-Async-Pathfinding.patch rename to divinemc-server/minecraft-patches/features/0045-Petal-Async-Pathfinding.patch index 55f7d5b..c855fdd 100644 --- a/patches/todo/minecraft-patches/0043-Petal-Async-Pathfinding.patch +++ b/divinemc-server/minecraft-patches/features/0045-Petal-Async-Pathfinding.patch @@ -9,10 +9,10 @@ You can find the original code on https://github.com/Bloom-host/Petal Makes most pathfinding-related work happen asynchronously diff --git a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index b0ca555cc3b565a8be8d01fe10b139ed27a2a2c3..47169b95032f10bf64ec5af5faf69edf8df19b8c 100644 +index 21046cde1bd1ede8e7851eb4ea414e33628aa4a9..9fd3b55dc640e96de05c149b90dcbb459b414f4b 100644 --- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -@@ -94,21 +94,18 @@ public class AcquirePoi { +@@ -93,21 +93,18 @@ public class AcquirePoi { } } // Paper end - optimise POI access @@ -24,7 +24,7 @@ index b0ca555cc3b565a8be8d01fe10b139ed27a2a2c3..47169b95032f10bf64ec5af5faf69edf - memoryAccessor.set(GlobalPos.of(level.dimension(), target)); - entityEventId.ifPresent(id -> level.broadcastEntityEvent(mob, id)); - map.clear(); -- DebugPackets.sendPoiTicketCountPacket(level, target); +- level.debugSynchronizers().updatePoi(target); + // DivineMC start - Async path processing + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.asyncPathfinding) { + Path possiblePath = findPathToPois(mob, set); @@ -43,7 +43,7 @@ index b0ca555cc3b565a8be8d01fe10b139ed27a2a2c3..47169b95032f10bf64ec5af5faf69edf return true; } -@@ -120,6 +117,34 @@ public class AcquirePoi { +@@ -119,6 +116,34 @@ public class AcquirePoi { : BehaviorBuilder.create(instance -> instance.group(instance.absent(existingAbsentMemory)).apply(instance, memoryAccessor -> oneShot)); } @@ -65,7 +65,7 @@ index b0ca555cc3b565a8be8d01fe10b139ed27a2a2c3..47169b95032f10bf64ec5af5faf69edf + memoryAccessor.set(GlobalPos.of(level.dimension(), target)); + entityEventId.ifPresent(id -> level.broadcastEntityEvent(mob, id)); + map.clear(); -+ DebugPackets.sendPoiTicketCountPacket(level, target); ++ level.debugSynchronizers().updatePoi(target); + }); + } else { + for (Pair, BlockPos> pair : set) { @@ -222,10 +222,10 @@ index 621ba76784f2b92790eca62be4d0688834335ab6..92d8899ff7d42ecc987a7bf2035cc724 private boolean tryComputePath(Mob mob, WalkTarget target, long time) { BlockPos blockPos = target.getTarget().currentBlockPosition(); diff --git a/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java b/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java -index 4f9f3367b1ca3903df03a80fa2b01a3d24e6e77d..48b7e91191192266d57f4d4692d1865cbddae5c0 100644 +index 348ff9ef8595fa9324d41ec1328f8d7a503d1d13..55b57381008deeb4965ecaa29932ae168a201dbb 100644 --- a/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java +++ b/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java -@@ -60,17 +60,18 @@ public class SetClosestHomeAsWalkTarget { +@@ -59,17 +59,18 @@ public class SetClosestHomeAsWalkTarget { poi -> poi.is(PoiTypes.HOME), predicate, mob.blockPosition(), 48, PoiManager.Occupancy.ANY ) .collect(Collectors.toSet()); @@ -235,7 +235,7 @@ index 4f9f3367b1ca3903df03a80fa2b01a3d24e6e77d..48b7e91191192266d57f4d4692d1865c - Optional> type = poiManager.getType(target); - if (type.isPresent()) { - walkTarget.set(new WalkTarget(target, speedModifier, 1)); -- DebugPackets.sendPoiTicketCountPacket(level, target); +- level.debugSynchronizers().updatePoi(target); - } - } else if (mutableInt.getValue() < 5) { - map.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < mutableLong.getValue()); @@ -254,7 +254,7 @@ index 4f9f3367b1ca3903df03a80fa2b01a3d24e6e77d..48b7e91191192266d57f4d4692d1865c return true; } else { -@@ -81,4 +82,26 @@ public class SetClosestHomeAsWalkTarget { +@@ -80,4 +81,26 @@ public class SetClosestHomeAsWalkTarget { ) ); } @@ -273,7 +273,7 @@ index 4f9f3367b1ca3903df03a80fa2b01a3d24e6e77d..48b7e91191192266d57f4d4692d1865c + Optional> type = poiManager.getType(target); + if (type.isPresent()) { + walkTarget.set(new WalkTarget(target, speedModifier, 1)); -+ DebugPackets.sendPoiTicketCountPacket(level, target); ++ level.debugSynchronizers().updatePoi(target); + } + } else if (mutableInt.getValue() < 5) { + map.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < mutableLong.getValue()); @@ -325,10 +325,10 @@ index 458ceec68ca138b0aa9b70d6c934473c01d468f4..ff06ba3ede2f2e40aae8f9a0b997150c } diff --git a/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java b/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java -index 077863b758fbc3e51f25bcf842d00a2cc07c6a2f..b544685d191af2dcf3742abe45693b1eab0507e8 100644 +index e21a79f77b6775764816ec45fc9023f52a00af84..2e82b6b884ff6296b2affa29e7b3ce0551372265 100644 --- a/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/FlyingPathNavigation.java -@@ -16,9 +16,25 @@ public class FlyingPathNavigation extends PathNavigation { +@@ -15,9 +15,25 @@ public class FlyingPathNavigation extends PathNavigation { super(mob, level); } @@ -354,7 +354,7 @@ index 077863b758fbc3e51f25bcf842d00a2cc07c6a2f..b544685d191af2dcf3742abe45693b1e return new PathFinder(this.nodeEvaluator, maxVisitedNodes); } -@@ -48,6 +64,7 @@ public class FlyingPathNavigation extends PathNavigation { +@@ -47,6 +63,7 @@ public class FlyingPathNavigation extends PathNavigation { if (this.hasDelayedRecomputation) { this.recomputePath(); } @@ -363,10 +363,10 @@ index 077863b758fbc3e51f25bcf842d00a2cc07c6a2f..b544685d191af2dcf3742abe45693b1e if (!this.isDone()) { if (this.canUpdatePath()) { diff --git a/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -index 86fccf3617a32f3791b03d8067e2eaf6b8d8bebb..348fe5b7f8f3d7c87891704115d911a271e8882a 100644 +index f2f07146a3638fe07f4814abd22a9bf815507fd2..2ee4c8f02bd62c67bacb1d817b3aed24a79dc050 100644 --- a/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -@@ -24,9 +24,25 @@ public class GroundPathNavigation extends PathNavigation { +@@ -25,9 +25,25 @@ public class GroundPathNavigation extends PathNavigation { super(mob, level); } @@ -393,10 +393,10 @@ index 86fccf3617a32f3791b03d8067e2eaf6b8d8bebb..348fe5b7f8f3d7c87891704115d911a2 } diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 24dd92449f70144c79f25bf24942ebd666655ed2..90035d61f705094507e1738a77bd624bcab3d235 100644 +index 1f45b389553cd5782972193537ce7adcd9c7c600..777b3ccce23b0ffd84176b12207a1bbc4beda379 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -167,6 +167,10 @@ public abstract class PathNavigation { +@@ -173,6 +173,10 @@ public abstract class PathNavigation { return null; } else if (!this.canUpdatePath()) { return null; @@ -407,7 +407,7 @@ index 24dd92449f70144c79f25bf24942ebd666655ed2..90035d61f705094507e1738a77bd624b } else if (this.path != null && !this.path.isDone() && targets.contains(this.targetPos)) { return this.path; } else { -@@ -191,11 +195,29 @@ public abstract class PathNavigation { +@@ -197,11 +201,29 @@ public abstract class PathNavigation { int i = (int)(followRange + regionOffset); PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, targets, followRange, accuracy, this.maxVisitedNodesMultiplier); @@ -441,7 +441,7 @@ index 24dd92449f70144c79f25bf24942ebd666655ed2..90035d61f705094507e1738a77bd624b return path; } -@@ -246,8 +268,8 @@ public abstract class PathNavigation { +@@ -252,8 +274,8 @@ public abstract class PathNavigation { if (this.isDone()) { return false; } else { @@ -452,7 +452,7 @@ index 24dd92449f70144c79f25bf24942ebd666655ed2..90035d61f705094507e1738a77bd624b return false; } else { this.speedModifier = speed; -@@ -270,6 +292,7 @@ public abstract class PathNavigation { +@@ -276,6 +298,7 @@ public abstract class PathNavigation { if (this.hasDelayedRecomputation) { this.recomputePath(); } @@ -460,7 +460,7 @@ index 24dd92449f70144c79f25bf24942ebd666655ed2..90035d61f705094507e1738a77bd624b if (!this.isDone()) { if (this.canUpdatePath()) { -@@ -299,6 +322,7 @@ public abstract class PathNavigation { +@@ -304,6 +327,7 @@ public abstract class PathNavigation { } protected void followThePath() { @@ -468,7 +468,7 @@ index 24dd92449f70144c79f25bf24942ebd666655ed2..90035d61f705094507e1738a77bd624b Vec3 tempMobPos = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; Vec3i nextNodePos = this.path.getNextNodePos(); -@@ -455,7 +479,7 @@ public abstract class PathNavigation { +@@ -460,7 +484,7 @@ public abstract class PathNavigation { public boolean shouldRecomputePath(BlockPos pos) { if (this.hasDelayedRecomputation) { return false; @@ -557,10 +557,10 @@ index 1f96fd5085bacb4c584576c7cb9f51e7898e9b03..d975b89c7bb57562852596751a4ff881 + // DivineMC end - async pathfinding } diff --git a/net/minecraft/world/entity/animal/Bee.java b/net/minecraft/world/entity/animal/Bee.java -index 7573f1be88ca23096e02efe2fa933429fa4421ba..e5f4520afa2d396ab0e88aa282c408b272279e7d 100644 +index a520052f0feae97c5ed8eb4af4fb48cdf56d6550..127840b75b39ec6a68e504396948c3c523535fd9 100644 --- a/net/minecraft/world/entity/animal/Bee.java +++ b/net/minecraft/world/entity/animal/Bee.java -@@ -937,7 +937,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -944,7 +944,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } else { Bee.this.pathfindRandomlyTowards(Bee.this.hivePos); } @@ -569,7 +569,7 @@ index 7573f1be88ca23096e02efe2fa933429fa4421ba..e5f4520afa2d396ab0e88aa282c408b2 boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos); if (!flag) { this.dropAndBlacklistHive(); -@@ -991,7 +991,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -998,7 +998,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { return true; } else { Path path = Bee.this.navigation.getPath(); @@ -579,10 +579,10 @@ index 7573f1be88ca23096e02efe2fa933429fa4421ba..e5f4520afa2d396ab0e88aa282c408b2 } } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index f526a426d02f8fb1ce6c1b16e0ed3edae8ab5271..59693b73138ebd64d05d6ea5e94a15c7b1a760c0 100644 +index 9656c1bf22b1b6c945a8ba5603742261db650fd5..be75453e5426d2d2819983b17014e0e8675961bd 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -487,6 +487,17 @@ public class Frog extends Animal { +@@ -480,6 +480,17 @@ public class Frog extends Animal { super(mob, level); } @@ -600,7 +600,7 @@ index f526a426d02f8fb1ce6c1b16e0ed3edae8ab5271..59693b73138ebd64d05d6ea5e94a15c7 @Override public boolean canCutCorner(PathType pathType) { return pathType != PathType.WATER_BORDER && super.canCutCorner(pathType); -@@ -495,6 +506,11 @@ public class Frog extends Animal { +@@ -488,6 +499,11 @@ public class Frog extends Animal { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new Frog.FrogNodeEvaluator(true); @@ -613,10 +613,10 @@ index f526a426d02f8fb1ce6c1b16e0ed3edae8ab5271..59693b73138ebd64d05d6ea5e94a15c7 } } diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 2a13332ebabf2e63a8f51a5d794fab3d66c7a1db..d4e7fc0a5bda4f44bcfed3d1adae7cdaf815784b 100644 +index 12650e3981fe48ab0cb4398e021e768eea03bd60..63e6fbcdead96fb98a527b8c6ba76d49c9d3eb66 100644 --- a/net/minecraft/world/entity/monster/Drowned.java +++ b/net/minecraft/world/entity/monster/Drowned.java -@@ -309,7 +309,7 @@ public class Drowned extends Zombie implements RangedAttackMob { +@@ -304,7 +304,7 @@ public class Drowned extends Zombie implements RangedAttackMob { protected boolean closeToNextPos() { Path path = this.getNavigation().getPath(); @@ -626,7 +626,7 @@ index 2a13332ebabf2e63a8f51a5d794fab3d66c7a1db..d4e7fc0a5bda4f44bcfed3d1adae7cda if (target != null) { double d = this.distanceToSqr(target.getX(), target.getY(), target.getZ()); diff --git a/net/minecraft/world/entity/monster/Strider.java b/net/minecraft/world/entity/monster/Strider.java -index fe31c4a45afd61be8b74efe9d0858ccd0aced075..e2e42bbdba1daf6783d10a62aa4c4b1bcf138fe6 100644 +index 592095f4c78866c53745786a615f1681dcaf6bf6..06a6bc22e408ab4366715fb57edfede37a9e5117 100644 --- a/net/minecraft/world/entity/monster/Strider.java +++ b/net/minecraft/world/entity/monster/Strider.java @@ -560,9 +560,25 @@ public class Strider extends Animal implements ItemSteerable { @@ -656,10 +656,10 @@ index fe31c4a45afd61be8b74efe9d0858ccd0aced075..e2e42bbdba1daf6783d10a62aa4c4b1b } diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index 808661fdefacfffa65ebde1aa3193a82497706b7..1c08e246dc1ae139befbdca1c4ed66dd26fc07a1 100644 +index e3478244e430faa614f23c288019303bd6bb0e04..862a7d464e1045e543049523d771bf79e8da7541 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -579,6 +579,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -572,6 +572,16 @@ public class Warden extends Monster implements VibrationSystem { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new WalkNodeEvaluator(); @@ -677,10 +677,10 @@ index 808661fdefacfffa65ebde1aa3193a82497706b7..1c08e246dc1ae139befbdca1c4ed66dd @Override protected float distance(Node first, Node second) { diff --git a/net/minecraft/world/level/pathfinder/Path.java b/net/minecraft/world/level/pathfinder/Path.java -index d6d3c8f5e5dd4a8cab0d3fcc131c3a59f06130c6..839653a997f1e10970fa2956fadaf493808cb206 100644 +index d8d086b54f07a855cf312b6f742802e267dfd034..42bf9d4d4a66c1de99ac1ad5b24210f17ec6c0ad 100644 --- a/net/minecraft/world/level/pathfinder/Path.java +++ b/net/minecraft/world/level/pathfinder/Path.java -@@ -26,6 +26,17 @@ public class Path { +@@ -28,6 +28,17 @@ public final class Path { this.reached = reached; } @@ -698,22 +698,22 @@ index d6d3c8f5e5dd4a8cab0d3fcc131c3a59f06130c6..839653a997f1e10970fa2956fadaf493 public void advance() { this.nextNodeIndex++; } -@@ -99,6 +110,7 @@ public class Path { +@@ -101,6 +112,7 @@ public final class Path { + } + + public boolean sameAs(@Nullable Path pathEntity) { ++ if (pathEntity == this) return true; // DivineMC - async path processing + return pathEntity != null && this.nodes.equals(pathEntity.nodes); } - public boolean sameAs(@Nullable Path pathentity) { -+ if (pathentity == this) return true; // DivineMC - async path processing - if (pathentity == null) { - return false; - } else if (pathentity.nodes.size() != this.nodes.size()) { diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java -index c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe..38c8019f3cdfa351c120e80e312219416b157e6d 100644 +index 98abda72d88fb38a5427a15cc59094f3a7db30dc..d829ed8c15779d2c8f2df51d2136f206c79fd2bf 100644 --- a/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -22,11 +22,19 @@ public class PathFinder { +@@ -23,11 +23,19 @@ public class PathFinder { public final NodeEvaluator nodeEvaluator; - private static final boolean DEBUG = false; private final BinaryHeap openSet = new BinaryHeap(); + private BooleanSupplier captureDebug = () -> false; + private final @Nullable org.bxteam.divinemc.async.pathfinding.NodeEvaluatorGenerator nodeEvaluatorGenerator; // DivineMC - we use this later to generate an evaluator - public PathFinder(NodeEvaluator nodeEvaluator, int maxVisitedNodes) { @@ -729,9 +729,9 @@ index c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe..38c8019f3cdfa351c120e80e31221941 } + // DivineMC end - support nodeEvaluatorgenerators - public void setMaxVisitedNodes(int maxVisitedNodes) { - this.maxVisitedNodes = maxVisitedNodes; -@@ -34,26 +42,63 @@ public class PathFinder { + public void setCaptureDebug(BooleanSupplier captureDebug) { + this.captureDebug = captureDebug; +@@ -39,26 +47,63 @@ public class PathFinder { @Nullable public Path findPath(PathNavigationRegion region, Mob mob, Set targetPositions, float maxRange, int accuracy, float searchDepthMultiplier) { @@ -799,11 +799,11 @@ index c2baadcdceb1df6a881d6f73aa4eb4dd264bcdfe..38c8019f3cdfa351c120e80e31221941 + private synchronized @org.jetbrains.annotations.NotNull Path processPath(NodeEvaluator nodeEvaluator, Node node, List> positions, float maxRange, int accuracy, float searchDepthMultiplier) { // sync to only use the caching functions in this class on a single thread + org.apache.commons.lang3.Validate.isTrue(!positions.isEmpty()); // ensure that we have at least one position, which means we'll always return a path + // DivineMC end - split pathfinding into the original sync method for compat and processing for delaying - // Set set = targetPositions.keySet(); // Paper + // Set set = targetPositions.keySet(); // Paper - unused node.g = 0.0F; node.h = this.getBestH(node, positions); // Paper - optimize collection -@@ -89,7 +134,7 @@ public class PathFinder { - } +@@ -96,7 +141,7 @@ public class PathFinder { + if (!(node1.distanceTo(node) >= maxRange)) { - int neighbors = this.nodeEvaluator.getNeighbors(this.neighbors, node1); diff --git a/patches/todo/minecraft-patches/0045-Pufferfish-Optimize-mob-spawning.patch b/divinemc-server/minecraft-patches/features/0046-Pufferfish-Optimize-mob-spawning.patch similarity index 89% rename from patches/todo/minecraft-patches/0045-Pufferfish-Optimize-mob-spawning.patch rename to divinemc-server/minecraft-patches/features/0046-Pufferfish-Optimize-mob-spawning.patch index cb46564..2e25f27 100644 --- a/patches/todo/minecraft-patches/0045-Pufferfish-Optimize-mob-spawning.patch +++ b/divinemc-server/minecraft-patches/features/0046-Pufferfish-Optimize-mob-spawning.patch @@ -9,34 +9,35 @@ Original project: https://github.com/pufferfish-gg/Pufferfish This patch reduces the main-thread impact of mob spawning by moving spawning work to other threads diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 1877ee1431b0f858b6a5da7347d72fe90374e27a..dddcde2716bbdca1240bd60bc5ca17aeb1999d57 100644 +index a876c7c47788218a86cef53330b2c07f7008b0b0..b65e35cd5bf7f3af8826cb9e9e2696921a951a62 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop S spin(Function threadFunction) { - ca.spottedleaf.dataconverter.minecraft.datatypes.MCTypeRegistry.init(); // Paper - rewrite data converter system + // Paper start - improve tick loop + public final ca.spottedleaf.moonrise.common.time.TickData tickTimes1s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(1L)); + public final ca.spottedleaf.moonrise.common.time.TickData tickTimes5s = new ca.spottedleaf.moonrise.common.time.TickData(java.util.concurrent.TimeUnit.SECONDS.toNanos(5L)); diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 46adbe6ccf1e4291e33a52a6612f624558c18f96..d90341ff814bb2b14867b7d9a401ae9672076f5b 100644 +index f9ec63ed7feb67e558abed99746726c10e9e10f4..78f831bf369906396860a73b9aaff5dc67bcfa09 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -367,6 +367,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -452,7 +452,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface org.purpurmc.purpur.task.BossBarTask.startAll(); // Purpur - Implement TPSBar if (org.purpurmc.purpur.PurpurConfig.beeCountPayload) org.purpurmc.purpur.task.BeehiveTask.instance().register(); // Purpur - Give bee counts in beehives to Purpur clients +- + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableAsyncSpawning) mobSpawnExecutor.start(); // DivineMC - Pufferfish: Optimize mob spawning + this.notificationManager().serverStarted(); return true; } - } diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 75c8ce32e68f92e20201e9c243f46f2be716eac8..bf680624bc6c618dfa0eeeb74c103ff6716fd27e 100644 +index 65607de63f6ea900599660485861860b71e1aef3..0a32c1106d3eebb8b4aa75b27b489169052897db 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -182,6 +182,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -183,6 +183,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - chunk tick iteration optimisations @@ -47,7 +48,7 @@ index 75c8ce32e68f92e20201e9c243f46f2be716eac8..bf680624bc6c618dfa0eeeb74c103ff6 public ServerChunkCache( ServerLevel level, -@@ -506,6 +510,47 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -501,6 +505,47 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.broadcastChangedChunks(); } @@ -95,7 +96,7 @@ index 75c8ce32e68f92e20201e9c243f46f2be716eac8..bf680624bc6c618dfa0eeeb74c103ff6 } private void broadcastChangedChunks() { -@@ -523,27 +568,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -518,27 +563,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns NaturalSpawner.SpawnState spawnState; @@ -141,7 +142,7 @@ index 75c8ce32e68f92e20201e9c243f46f2be716eac8..bf680624bc6c618dfa0eeeb74c103ff6 boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); List filteredSpawningCategories; -@@ -557,7 +606,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -552,7 +601,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } // Paper end - PlayerNaturallySpawnCreaturesEvent boolean flag = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getLevelData().getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit @@ -150,7 +151,7 @@ index 75c8ce32e68f92e20201e9c243f46f2be716eac8..bf680624bc6c618dfa0eeeb74c103ff6 } else { filteredSpawningCategories = List.of(); } -@@ -572,7 +621,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -567,7 +616,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // Paper end - chunk tick iteration optimisation for (LevelChunk levelChunk : list) { @@ -159,7 +160,7 @@ index 75c8ce32e68f92e20201e9c243f46f2be716eac8..bf680624bc6c618dfa0eeeb74c103ff6 } } finally { list.clear(); -@@ -591,11 +640,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -586,11 +635,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.level.tickThunder(chunk); } diff --git a/patches/todo/minecraft-patches/0055-Copper-Bulb-1gt-delay.patch b/divinemc-server/minecraft-patches/features/0047-Copper-Bulb-1gt-delay.patch similarity index 93% rename from patches/todo/minecraft-patches/0055-Copper-Bulb-1gt-delay.patch rename to divinemc-server/minecraft-patches/features/0047-Copper-Bulb-1gt-delay.patch index 194d085..1644586 100644 --- a/patches/todo/minecraft-patches/0055-Copper-Bulb-1gt-delay.patch +++ b/divinemc-server/minecraft-patches/features/0047-Copper-Bulb-1gt-delay.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Copper Bulb 1gt delay diff --git a/net/minecraft/world/level/block/CopperBulbBlock.java b/net/minecraft/world/level/block/CopperBulbBlock.java -index 25caeb117d9a49fa00f46ec895a35dee8242aacd..3a2b751b150e7930817fd07d50a3baeecb44f7d1 100644 +index 54511c27d8d85f1a9702d899f1f7c7dda201cdfa..1a9b785b1a0b06dcc9f4b9520303eab33e092db0 100644 --- a/net/minecraft/world/level/block/CopperBulbBlock.java +++ b/net/minecraft/world/level/block/CopperBulbBlock.java -@@ -32,16 +32,36 @@ public class CopperBulbBlock extends Block { +@@ -33,16 +33,36 @@ public class CopperBulbBlock extends Block { @Override protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { if (oldState.getBlock() != state.getBlock() && level instanceof ServerLevel serverLevel) { diff --git a/patches/todo/minecraft-patches/0044-Petal-Multithreaded-Tracker.patch b/divinemc-server/minecraft-patches/features/0048-Petal-Multithreaded-Tracker.patch similarity index 92% rename from patches/todo/minecraft-patches/0044-Petal-Multithreaded-Tracker.patch rename to divinemc-server/minecraft-patches/features/0048-Petal-Multithreaded-Tracker.patch index a70d626..1960364 100644 --- a/patches/todo/minecraft-patches/0044-Petal-Multithreaded-Tracker.patch +++ b/divinemc-server/minecraft-patches/features/0048-Petal-Multithreaded-Tracker.patch @@ -37,7 +37,7 @@ index 1b8193587814225c2ef2c5d9e667436eb50ff6c5..93272808d94e81d31af728ebe85df9a2 { for (int i = 0; i < this.directByChunk.length; ++i) { diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index c4a1e3908cf8e1b0614ff6c3a0f5f6708a7667e5..fef167837e05d6e80246d4fccd037cc1c9500f97 100644 +index ea3d63856ed487c4d23b0448c97169c230932832..646bd06468bdd7a7ebc5ecc7e876617ad0fc6c05 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java @@ -345,7 +345,11 @@ public final class RegionizedPlayerChunkLoader { @@ -66,10 +66,10 @@ index 9c0c99b936b4a82ebfe924866e53ec71f7bbe9ad..01ed1e3572e9c2ccfd19df117cda0d5c .add( new ClientboundUpdateAttributesPacket.AttributeSnapshot( diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f7ca32321 100644 +index 6251e7dc5bbe7eee18b0c5a8979d9218fee728d0..5b16dad04bf4540df750ce06c18af4b1d80d8648 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -255,9 +255,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -253,9 +253,19 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } final ServerPlayer[] backingSet = inRange.getRawDataUnchecked(); @@ -91,7 +91,7 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f } // Paper start - per player mob count backoff -@@ -1013,6 +1023,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1021,6 +1031,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // Paper end - optimise entity tracker protected void tick() { @@ -105,7 +105,7 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f // Paper start - optimise entity tracker if (true) { this.newTrackerTick(); -@@ -1135,7 +1152,44 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1172,7 +1189,44 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final Entity entity; private final int range; SectionPos lastSectionPos; @@ -151,7 +151,7 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f // Paper start - optimise entity tracker private long lastChunkUpdate = -1L; -@@ -1162,22 +1216,92 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1199,23 +1253,93 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.lastTrackedChunk = chunk; final ServerPlayer[] playersRaw = players.getRawDataUnchecked(); @@ -173,16 +173,16 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f if (!players.contains(player)) { - this.removePlayer(player); + removed |= this.removePlayerMulti(player); -+ } -+ } + } + } + + if (removed) { + this.seenByUpdated(); + } + // DivineMC end - Multithreaded tracker -+ } -+ } -+ + } + } + + // DivineMC start - Multithreaded tracker + public final @Nullable Runnable tickCompact(final ca.spottedleaf.moonrise.common.misc.NearbyPlayers.TrackedChunk chunk) { + if (chunk == null) { @@ -228,8 +228,8 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f + } + if (removed) { + this.seenByUpdated(); - } - } ++ } ++ } + }; + + // Only update asynchronously for real player, and sync update for fake players @@ -241,13 +241,14 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f + } else { + updatePlayerTasks.run(); + return null; - } - } ++ } ++ } + // DivineMC end - Multithreaded tracker - ++ @Override public final void moonrise$removeNonTickThreadPlayers() { -@@ -1193,12 +1317,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + boolean foundToRemove = false; +@@ -1230,12 +1354,13 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider return; } @@ -263,7 +264,7 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f } @Override -@@ -1208,10 +1333,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1245,10 +1370,11 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider if (this.seenBy.isEmpty()) { return; } @@ -277,16 +278,25 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f } @Override -@@ -1238,7 +1364,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - } +@@ -1276,7 +1402,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - public void broadcast(Packet packet) { + @Override + public void sendToTrackingPlayers(Packet packet) { - for (ServerPlayerConnection serverPlayerConnection : this.seenBy) { -+ for (ServerPlayerConnection serverPlayerConnection : this.seenBy()) { // DivineMC - Multithreaded tracker ++ for (ServerPlayerConnection serverPlayerConnection : this.seenBy()) { // DivineMC - Multithreaded tracker // TODO: verify serverPlayerConnection.send(packet); } } -@@ -1259,21 +1385,32 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1291,7 +1417,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider + + @Override + public void sendToTrackingPlayersFiltered(Packet packet, Predicate filter) { +- for (ServerPlayerConnection serverPlayerConnection : this.seenBy) { ++ for (ServerPlayerConnection serverPlayerConnection : this.seenBy()) { // DivineMC - Multithreaded tracker // TODO: verify + if (filter.test(serverPlayerConnection.getPlayer())) { + serverPlayerConnection.send(packet); + } +@@ -1299,24 +1425,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider } public void broadcastRemoved() { @@ -311,6 +321,9 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f - org.spigotmc.AsyncCatcher.catchOp("player tracker clear"); // Spigot if (this.seenBy.remove(player.connection)) { this.serverEntity.removePairing(player); + if (this.seenBy.isEmpty()) { + ChunkMap.this.level.debugSynchronizers().dropEntity(this.entity); + } } + this.seenByUpdated(); // DivineMC - Multithreaded tracker } @@ -322,7 +335,7 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f // Paper start - remove allocation of Vec3D here // Vec3 vec3 = player.position().subtract(this.entity.position()); double vec3_dx = player.getX() - this.entity.getX(); -@@ -1301,6 +1438,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1344,6 +1481,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider // CraftBukkit end if (flag) { if (this.seenBy.add(player.connection)) { @@ -330,12 +343,12 @@ index c0d996fb99f053863ce623889add3feb70d7137d..7ca147cf9da67c399806056e5092841f // Paper start - entity tracking events if (io.papermc.paper.event.player.PlayerTrackEntityEvent.getHandlerList().getRegisteredListeners().length == 0 || new io.papermc.paper.event.player.PlayerTrackEntityEvent(player.getBukkitEntity(), this.entity.getBukkitEntity()).callEvent()) { this.serverEntity.addPairing(player); -@@ -1309,6 +1447,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1357,6 +1495,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider this.serverEntity.onPlayerAdd(); // Paper - fix desync when a player is added to the tracker } - } else if (this.seenBy.remove(player.connection)) { -+ this.seenByUpdated(); // DivineMC - Multithreaded tracker - this.serverEntity.removePairing(player); + } else { ++ this.seenByUpdated(); // DivineMC - Multithreaded tracker // TODO: check this + this.removePlayer(player); } } diff --git a/net/minecraft/server/level/ServerBossEvent.java b/net/minecraft/server/level/ServerBossEvent.java @@ -356,10 +369,10 @@ index f106373ef3ac4a8685c2939c9e8361688a285913..b844b6dd89bc53b74c0d1bdbf4657c11 public boolean visible = true; diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index 0868189fee30d40dfb82ae39592a65b510e96b54..39e28ad0cbb4617a80d7f197723233d4bdc1eed5 100644 +index 737a6ff0bfec9b555fa425619d97b80ef95cb3e6..cfa2c3aa357a0dbb7edf7f0c8cebea5ed2f31cbc 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java -@@ -134,7 +134,7 @@ public class ServerEntity { +@@ -122,7 +122,7 @@ public class ServerEntity { MapId mapId = itemFrame.cachedMapId; // Paper - Perf: Cache map ids on item frames MapItemSavedData savedData = MapItem.getSavedData(mapId, this.level); if (savedData != null) { @@ -368,9 +381,9 @@ index 0868189fee30d40dfb82ae39592a65b510e96b54..39e28ad0cbb4617a80d7f197723233d4 final ServerPlayer serverPlayer = connection.getPlayer(); // Paper savedData.tickCarriedBy(serverPlayer, item); Packet updatePacket = savedData.getUpdatePacket(mapId, serverPlayer); -@@ -428,8 +428,6 @@ public class ServerEntity { +@@ -409,8 +409,6 @@ public class ServerEntity { // CraftBukkit end - this.broadcastAndSend(new ClientboundUpdateAttributesPacket(this.entity.getId(), attributesToSync)); + this.synchronizer.sendToTrackingPlayersAndSelf(new ClientboundUpdateAttributesPacket(this.entity.getId(), attributesToSync)); } - - attributesToSync.clear(); @@ -378,10 +391,10 @@ index 0868189fee30d40dfb82ae39592a65b510e96b54..39e28ad0cbb4617a80d7f197723233d4 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 78bf3365b426e7090182af84630111d410a2460e..3c1795eb56900cd80cfec38bd1d922d566463ecb 100644 +index b240c7f2579e25d520fbc0ab08e801028bc15192..01ad6566c236bac2141f75fa9cf37844e3d97637 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -2517,7 +2517,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2579,7 +2579,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public LevelEntityGetter getEntities() { @@ -389,7 +402,7 @@ index 78bf3365b426e7090182af84630111d410a2460e..3c1795eb56900cd80cfec38bd1d922d5 return this.moonrise$getEntityLookup(); // Paper - rewrite chunk system } -@@ -2784,7 +2783,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2858,7 +2857,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } map.carriedByPlayers.remove(player); @@ -399,10 +412,10 @@ index 78bf3365b426e7090182af84630111d410a2460e..3c1795eb56900cd80cfec38bd1d922d5 } } diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2d3200834e46a24156659a32170aa4974caf8060..4d37b16adc5491db24fce1ce656f6cde575e10f4 100644 +index 2638343fcccbaf81d19dcd4fd09534b2e7bee796..e5ece51effaddeb49b689f897da5172958360d5f 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1936,7 +1936,6 @@ public class ServerGamePacketListenerImpl +@@ -1942,7 +1942,6 @@ public class ServerGamePacketListenerImpl } public void internalTeleport(PositionMoveRotation posMoveRotation, Set relatives) { @@ -411,10 +424,10 @@ index 2d3200834e46a24156659a32170aa4974caf8060..4d37b16adc5491db24fce1ce656f6cde if (this.player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 76a7898c040cd46df6a889535b1d77c8e6de5a91..e903e60c8914899d9be14cce9fdef9cc33ee71d5 100644 +index 49f83d3dedc16d977f7904971af13cc17ed32882..86370c9f6e83e5815922080c10336d394075b4e9 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -1353,13 +1353,13 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -1359,13 +1359,13 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin } private void refreshDirtyAttributes() { @@ -648,7 +661,7 @@ index 325ec57df2885f5e81b8a6b61e3a9fed9484b30f..1796f0a6f647c94b0943a6003a130779 @Override diff --git a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index ebb0b7e5047efa65e8b6986f12dd5a7d6c0e9613..a77665abefdf653e65393cc6908506a5812b5596 100644 +index 00c7fe0419fa44736b971b684adfe1b963e24bd5..581486ad49945d1658cb070d9f418f7a2fc9196d 100644 --- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -212,6 +212,7 @@ public class MapItemSavedData extends SavedData { @@ -657,5 +670,5 @@ index ebb0b7e5047efa65e8b6986f12dd5a7d6c0e9613..a77665abefdf653e65393cc6908506a5 MapItemSavedData.HoldingPlayer holdingPlayer1 = this.carriedBy.get(i); + if (holdingPlayer1 == null) continue; // DivineMC - Multithreaded tracker Player player1 = holdingPlayer1.player; - String string = player1.getName().getString(); + String plainTextName = player1.getPlainTextName(); if (!player1.isRemoved() && (player1.getInventory().contains(predicate) || mapStack.isFramed())) { diff --git a/patches/todo/minecraft-patches/0056-Crafter-1gt-delay.patch b/divinemc-server/minecraft-patches/features/0049-Crafter-1gt-delay.patch similarity index 94% rename from patches/todo/minecraft-patches/0056-Crafter-1gt-delay.patch rename to divinemc-server/minecraft-patches/features/0049-Crafter-1gt-delay.patch index 235cb7b..8305174 100644 --- a/patches/todo/minecraft-patches/0056-Crafter-1gt-delay.patch +++ b/divinemc-server/minecraft-patches/features/0049-Crafter-1gt-delay.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Crafter 1gt delay diff --git a/net/minecraft/world/level/block/CrafterBlock.java b/net/minecraft/world/level/block/CrafterBlock.java -index 38b03c7b02bdfc579e5e126c12de3d878e26d188..c3e68a63f6f7d669dca8a08625a04bd7c8ef0327 100644 +index 6dd3c0f60b04bc690ebd4a33ec57ef806961ee32..dad8035aff94854eadeb454ef60e6c90dbb31d1e 100644 --- a/net/minecraft/world/level/block/CrafterBlock.java +++ b/net/minecraft/world/level/block/CrafterBlock.java @@ -75,7 +75,7 @@ public class CrafterBlock extends BaseEntityBlock { diff --git a/patches/todo/minecraft-patches/0062-Cleanup-dead-code-from-Paper.patch b/divinemc-server/minecraft-patches/features/0050-Cleanup-dead-code-from-Paper.patch similarity index 50% rename from patches/todo/minecraft-patches/0062-Cleanup-dead-code-from-Paper.patch rename to divinemc-server/minecraft-patches/features/0050-Cleanup-dead-code-from-Paper.patch index 5c2e74f..e853db0 100644 --- a/patches/todo/minecraft-patches/0062-Cleanup-dead-code-from-Paper.patch +++ b/divinemc-server/minecraft-patches/features/0050-Cleanup-dead-code-from-Paper.patch @@ -5,78 +5,29 @@ Subject: [PATCH] Cleanup dead code from Paper diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java -index 882a912ba3f23ee8239c24068704d9ec9a7f7c40..8a3e7aff7892140bd6caac2e7f8a29075d50459d 100644 +index 3f85f9e9551b2eed6e66ab8036dbb1f40fb8bbac..78650957bacc0e26d3299a8de7f8bfc57c86627c 100644 --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -610,13 +610,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -602,13 +602,7 @@ public class Connection extends SimpleChannelInboundHandler> { if (!(this.packetListener instanceof net.minecraft.server.network.ServerLoginPacketListenerImpl loginPacketListener) || loginPacketListener.state != net.minecraft.server.network.ServerLoginPacketListenerImpl.State.VERIFYING || Connection.joinAttemptsThisTick++ < MAX_PER_TICK) { - // Paper start - detailed watchdog information -- net.minecraft.network.protocol.PacketUtils.packetProcessing.push(this.packetListener); +- net.minecraft.network.PacketProcessor.packetProcessing.push(this.packetListener); - try { - tickablePacketListener.tick(); - } finally { -- net.minecraft.network.protocol.PacketUtils.packetProcessing.pop(); +- net.minecraft.network.PacketProcessor.packetProcessing.pop(); - } // Paper end - detailed watchdog information + tickablePacketListener.tick(); } // Paper end - Buffer joins to world } -diff --git a/net/minecraft/network/protocol/PacketUtils.java b/net/minecraft/network/protocol/PacketUtils.java -index aa4dd7517e8be167aef1eaf7aa907e3ce7cc0e62..e3d3b062e273fee4a9d3ba3cadc212787096dc54 100644 ---- a/net/minecraft/network/protocol/PacketUtils.java -+++ b/net/minecraft/network/protocol/PacketUtils.java -@@ -21,8 +21,6 @@ public class PacketUtils { - public static void ensureRunningOnSameThread(Packet packet, T processor, BlockableEventLoop executor) throws RunningOnDifferentThreadException { - if (!executor.isSameThread()) { - executor.executeIfPossible(() -> { -- packetProcessing.push(processor); // Paper - detailed watchdog information -- try { // Paper - detailed watchdog information - if (processor instanceof net.minecraft.server.network.ServerCommonPacketListenerImpl serverCommonPacketListener && serverCommonPacketListener.processedDisconnect) return; // Paper - Don't handle sync packets for kicked players - if (processor.shouldHandleMessage(packet)) { - try { -@@ -41,12 +39,6 @@ public class PacketUtils { - } else { - LOGGER.debug("Ignoring packet due to disconnection: {}", packet); - } -- // Paper start - detailed watchdog information -- } finally { -- totalMainThreadPacketsProcessed.getAndIncrement(); -- packetProcessing.pop(); -- } -- // Paper end - detailed watchdog information - }); - throw RunningOnDifferentThreadException.RUNNING_ON_DIFFERENT_THREAD; - } -@@ -73,22 +65,4 @@ public class PacketUtils { - - packetListener.fillCrashReport(crashReport); - } -- -- // Paper start - detailed watchdog information -- public static final java.util.concurrent.ConcurrentLinkedDeque packetProcessing = new java.util.concurrent.ConcurrentLinkedDeque<>(); -- static final java.util.concurrent.atomic.AtomicLong totalMainThreadPacketsProcessed = new java.util.concurrent.atomic.AtomicLong(); -- -- public static long getTotalProcessedPackets() { -- return totalMainThreadPacketsProcessed.get(); -- } -- -- public static java.util.List getCurrentPacketProcessors() { -- java.util.List listeners = new java.util.ArrayList<>(4); -- for (PacketListener listener : packetProcessing) { -- listeners.add(listener); -- } -- -- return listeners; -- } -- // Paper end - detailed watchdog information - } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 0ad18866c323308ad9b87322932e03a283f740b1..386fdc23b35675a7db66d16bf2a8a6dd5b44059a 100644 +index 01ad6566c236bac2141f75fa9cf37844e3d97637..a4a2231f5850269a6003afca8db78fa486cf3a71 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -1349,13 +1349,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1370,13 +1370,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper end - log detailed entity tick information public void tickNonPassenger(Entity entity) { @@ -90,7 +41,7 @@ index 0ad18866c323308ad9b87322932e03a283f740b1..386fdc23b35675a7db66d16bf2a8a6dd entity.setOldPosAndRot(); entity.tickCount++; entity.totalEntityAge++; // Paper - age-like counter for all entities -@@ -1368,13 +1362,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1389,13 +1383,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 } @@ -105,10 +56,10 @@ index 0ad18866c323308ad9b87322932e03a283f740b1..386fdc23b35675a7db66d16bf2a8a6dd private void tickPassenger(Entity ridingEntity, Entity passengerEntity, final boolean isActive) { // Paper - EAR 2 diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index fa48496222ea922204163d48988246c44e09851f..2c7c5dab268625e1328f57ac3ec2a735a82fea42 100644 +index 6724ef32e4d0de6ca0965b8b96430b68179b4bd7..72628fab95b76b67630594611f894a5ecdad5fc3 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1111,29 +1111,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1117,29 +1117,10 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name return this.onGround; } @@ -137,8 +88,8 @@ index fa48496222ea922204163d48988246c44e09851f..2c7c5dab268625e1328f57ac3ec2a735 - // Paper end - detailed watchdog information if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); - } else { -@@ -1248,13 +1229,6 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + this.horizontalCollision = false; +@@ -1260,13 +1241,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); } } @@ -152,23 +103,3 @@ index fa48496222ea922204163d48988246c44e09851f..2c7c5dab268625e1328f57ac3ec2a735 } private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) { -@@ -4969,9 +4943,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - - public void setDeltaMovement(Vec3 deltaMovement) { -- synchronized (this.posLock) { // Paper - detailed watchdog information - this.deltaMovement = deltaMovement; -- } // Paper - detailed watchdog information - } - - public void addDeltaMovement(Vec3 addend) { -@@ -5069,9 +5041,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess - } - // Paper end - Block invalid positions and bounding box - if (this.position.x != x || this.position.y != y || this.position.z != z) { -- synchronized (this.posLock) { // Paper - detailed watchdog information - this.position = new Vec3(x, y, z); -- } // Paper - detailed watchdog information - int floor = Mth.floor(x); - int floor1 = Mth.floor(y); - int floor2 = Mth.floor(z); diff --git a/patches/todo/minecraft-patches/0046-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch b/divinemc-server/minecraft-patches/features/0051-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch similarity index 100% rename from patches/todo/minecraft-patches/0046-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch rename to divinemc-server/minecraft-patches/features/0051-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch diff --git a/patches/todo/minecraft-patches/0063-C2ME-The-End-Biome-Cache.patch b/divinemc-server/minecraft-patches/features/0052-C2ME-The-End-Biome-Cache.patch similarity index 100% rename from patches/todo/minecraft-patches/0063-C2ME-The-End-Biome-Cache.patch rename to divinemc-server/minecraft-patches/features/0052-C2ME-The-End-Biome-Cache.patch diff --git a/patches/todo/minecraft-patches/0064-Euclidean-distance-squared-option.patch b/divinemc-server/minecraft-patches/features/0053-Euclidean-distance-squared-option.patch similarity index 95% rename from patches/todo/minecraft-patches/0064-Euclidean-distance-squared-option.patch rename to divinemc-server/minecraft-patches/features/0053-Euclidean-distance-squared-option.patch index cd42ddf..688a1e4 100644 --- a/patches/todo/minecraft-patches/0064-Euclidean-distance-squared-option.patch +++ b/divinemc-server/minecraft-patches/features/0053-Euclidean-distance-squared-option.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Euclidean distance squared option diff --git a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java -index fef167837e05d6e80246d4fccd037cc1c9500f97..1ef70cc1ca0a47ddae8655e88fa6b74fa7f81dc6 100644 +index 646bd06468bdd7a7ebc5ecc7e876617ad0fc6c05..87b4ccc200e090a8c5149b3bc5ae457932b8e15d 100644 --- a/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java +++ b/ca/spottedleaf/moonrise/patches/chunk_system/player/RegionizedPlayerChunkLoader.java @@ -387,10 +387,19 @@ public final class RegionizedPlayerChunkLoader { diff --git a/patches/todo/minecraft-patches/0065-Do-not-send-spectator-change-packet.patch b/divinemc-server/minecraft-patches/features/0054-Do-not-send-spectator-change-packet.patch similarity index 65% rename from patches/todo/minecraft-patches/0065-Do-not-send-spectator-change-packet.patch rename to divinemc-server/minecraft-patches/features/0054-Do-not-send-spectator-change-packet.patch index 338e241..bada7de 100644 --- a/patches/todo/minecraft-patches/0065-Do-not-send-spectator-change-packet.patch +++ b/divinemc-server/minecraft-patches/features/0054-Do-not-send-spectator-change-packet.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Do not send spectator change packet diff --git a/net/minecraft/server/level/ServerPlayerGameMode.java b/net/minecraft/server/level/ServerPlayerGameMode.java -index 02c02314a4a6a7a6da427f0d064dbc61ce92301d..56efd53d22f6d7338ef7d7cc36d612d410018c89 100644 +index 07dd9b8088e363110ecab24026a20485484710c4..a51d506c4ffe11ac2ad8510a9b35d854b2c0d42c 100644 --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -75,10 +75,7 @@ public class ServerPlayerGameMode { - // CraftBukkit end - this.setGameModeForPlayer(gameModeForPlayer, this.gameModeForPlayer); // Paper - Fix MC-259571 +@@ -86,10 +86,7 @@ public class ServerPlayerGameMode { + } + this.player.onUpdateAbilities(); - this.level - .getServer() @@ -20,7 +20,7 @@ index 02c02314a4a6a7a6da427f0d064dbc61ce92301d..56efd53d22f6d7338ef7d7cc36d612d4 this.level.updateSleepingPlayerList(); if (gameModeForPlayer == GameType.CREATIVE) { this.player.resetCurrentImpulseContext(); -@@ -571,4 +568,17 @@ public class ServerPlayerGameMode { +@@ -595,4 +592,17 @@ public class ServerPlayerGameMode { return false; } // Purpur end - Shift right click to use exp for mending @@ -39,40 +39,39 @@ index 02c02314a4a6a7a6da427f0d064dbc61ce92301d..56efd53d22f6d7338ef7d7cc36d612d4 + // DivineMC end - Do not send spectator change packet } diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 0888ba7853f07909e9915d35f706d39a1c6cf307..48a02a25c4fa6f3bacefaccd122694156da1a331 100644 +index c8e68bbb210457366822f2c4a01afb49693035ac..1a280122b4ff661c2d2fad359ddfb671a1d8f324 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -356,6 +356,8 @@ public abstract class PlayerList { - // CraftBukkit start - sendAll above replaced with this loop - ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player)); // Paper - Add Listing API for Player +@@ -255,6 +255,7 @@ public abstract class PlayerList { -+ ClientboundPlayerInfoUpdatePacket modifiedPacket = this.createSpectatorFilteredPacket(packet); // DivineMC - Do not send spectator change packet -+ - final List onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - Use single player info update packet on join - for (int i = 0; i < this.players.size(); ++i) { - ServerPlayer entityplayer1 = (ServerPlayer) this.players.get(i); -@@ -364,7 +366,7 @@ public abstract class PlayerList { + // CraftBukkit start - sendAll above replaced with this loop + ClientboundPlayerInfoUpdatePacket packet = ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(List.of(player)); // Paper - Add Listing API for Player ++ ClientboundPlayerInfoUpdatePacket modifiedPacket = this.createSpectatorFilteredPacket(packet); // DivineMC - Do not send spectator change packet + + final List onlinePlayers = Lists.newArrayListWithExpectedSize(this.players.size() - 1); // Paper - Use single player info update packet on join + for (int i = 0; i < this.players.size(); ++i) { +@@ -264,7 +265,7 @@ public abstract class PlayerList { + // Paper start - Add Listing API for Player + if (entityplayer1.getBukkitEntity().isListed(bukkitPlayer)) { + // Paper end - Add Listing API for Player +- entityplayer1.connection.send(packet); ++ this.sendPlayerInfoPacket(entityplayer1, player, packet, modifiedPacket); // DivineMC - Do not send spectator change packet // Paper start - Add Listing API for Player - if (entityplayer1.getBukkitEntity().isListed(bukkitPlayer)) { - // Paper end - Add Listing API for Player -- entityplayer1.connection.send(packet); -+ this.sendPlayerInfoPacket(entityplayer1, player, packet, modifiedPacket); // DivineMC - Do not send spectator change packet - // Paper start - Add Listing API for Player - } else { - entityplayer1.connection.send(ClientboundPlayerInfoUpdatePacket.createSinglePlayerInitializing(player, false)); -@@ -380,7 +382,10 @@ public abstract class PlayerList { - } - // Paper start - Use single player info update packet on join - if (!onlinePlayers.isEmpty()) { -- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers, player)); // Paper - Add Listing API for Player -+ // DivineMC start - Do not send spectator change packet -+ ClientboundPlayerInfoUpdatePacket updatePacket = this.createFilteredPlayerListPacket(onlinePlayers, player); -+ player.connection.send(updatePacket); // Paper - Add Listing API for Player -+ // DivineMC end - Do not send spectator change packet - } - // Paper end - Use single player info update packet on join - player.sentListPacket = true; -@@ -1468,4 +1473,69 @@ public abstract class PlayerList { + } else { + entityplayer1.connection.send(ClientboundPlayerInfoUpdatePacket.createSinglePlayerInitializing(player, false)); +@@ -280,7 +281,10 @@ public abstract class PlayerList { + } + // Paper start - Use single player info update packet on join + if (!onlinePlayers.isEmpty()) { +- player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(onlinePlayers, player)); // Paper - Add Listing API for Player ++ // DivineMC start - Do not send spectator change packet ++ ClientboundPlayerInfoUpdatePacket updatePacket = this.createFilteredPlayerListPacket(onlinePlayers, player); ++ player.connection.send(updatePacket); // Paper - Add Listing API for Player ++ // DivineMC end - Do not send spectator change packet + } + // Paper end - Use single player info update packet on join + player.sentListPacket = true; +@@ -1389,4 +1393,69 @@ public abstract class PlayerList { public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; } diff --git a/divinemc-server/minecraft-patches/features/0055-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/divinemc-server/minecraft-patches/features/0055-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch new file mode 100644 index 0000000..6964d8e --- /dev/null +++ b/divinemc-server/minecraft-patches/features/0055-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch @@ -0,0 +1,33 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> +Date: Sun, 20 Jul 2025 16:09:38 +0300 +Subject: [PATCH] Paper PR: Fire ServerListPingEvent for secondary motd send + +Original license: GPLv3 +Original project: https://github.com/PaperMC/Paper +Paper pull request: https://github.com/PaperMC/Paper/pull/8074 + +diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java +index 1a280122b4ff661c2d2fad359ddfb671a1d8f324..c8ce9e591475df1485227d34316fc02c3ec33f3e 100644 +--- a/net/minecraft/server/players/PlayerList.java ++++ b/net/minecraft/server/players/PlayerList.java +@@ -208,10 +208,15 @@ public abstract class PlayerList { + mutableComponent.withStyle(ChatFormatting.YELLOW); + Component joinMessage = mutableComponent; // Paper - Adventure + serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); +- ServerStatus status = this.server.getStatus(); +- if (status != null && !cookie.transferred()) { +- player.sendServerStatus(status); +- } ++ // DivineMC start - Paper PR: Fire ServerListPingEvent for secondary motd send ++ if (!cookie.transferred()) { ++ io.papermc.paper.util.MCUtil.scheduleAsyncTask(() -> { ++ if (player.hasDisconnected()) return; ++ net.minecraft.network.protocol.status.ServerStatus status = com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.getEventResponse(this.server, player.connection.connection); ++ if (status != null) player.sendServerStatus(status); ++ }); ++ } ++ // DivineMC end - Paper PR: Fire ServerListPingEvent for secondary motd send + + // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below + this.players.add(player); diff --git a/patches/todo/minecraft-patches/0067-Configurable-player-spawn-tracking-range.patch b/divinemc-server/minecraft-patches/features/0056-Configurable-player-spawn-tracking-range.patch similarity index 92% rename from patches/todo/minecraft-patches/0067-Configurable-player-spawn-tracking-range.patch rename to divinemc-server/minecraft-patches/features/0056-Configurable-player-spawn-tracking-range.patch index bf8e91f..12fb0c2 100644 --- a/patches/todo/minecraft-patches/0067-Configurable-player-spawn-tracking-range.patch +++ b/divinemc-server/minecraft-patches/features/0056-Configurable-player-spawn-tracking-range.patch @@ -18,10 +18,10 @@ index 6d1fe8028739145b11fce98ad62b2f8044299548..9f086ded18d1fc8850877c6be113d880 // note: vanilla does not subtract 0.5 but the result is (luckily!) the same public static final int NARROW_SPAWN_TRACK_RANGE = (int)Math.floor(((double)PLAYER_SPAWN_TRACK_RANGE / Math.sqrt(2.0)) - 0.5); diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index a6bf257ca93e4b3819b65b4ef4ba71d9e2b40933..de7800b46f7e8c68f24de8476032f2179edc4797 100644 +index 5b16dad04bf4540df750ce06c18af4b1d80d8648..5fb9a4cebf7407b8166ea5716c48a68e658d68d3 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -822,10 +822,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -830,10 +830,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider final ServerPlayer[] raw = players.getRawDataUnchecked(); final int len = players.size(); @@ -35,7 +35,7 @@ index a6bf257ca93e4b3819b65b4ef4ba71d9e2b40933..de7800b46f7e8c68f24de8476032f217 if (ret == null) { ret = new ArrayList<>(len - i); ret.add(player); -@@ -1220,6 +1220,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1257,6 +1257,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider for (int i = 0; i < playersLength; ++i) { // DivineMC - Multithreaded tracker final ServerPlayer player = playersRaw[i]; diff --git a/patches/todo/minecraft-patches/0068-Optimize-collections.patch b/divinemc-server/minecraft-patches/features/0057-Optimize-collections.patch similarity index 85% rename from patches/todo/minecraft-patches/0068-Optimize-collections.patch rename to divinemc-server/minecraft-patches/features/0057-Optimize-collections.patch index de71ba3..f043c2c 100644 --- a/patches/todo/minecraft-patches/0068-Optimize-collections.patch +++ b/divinemc-server/minecraft-patches/features/0057-Optimize-collections.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize collections diff --git a/net/minecraft/core/NonNullList.java b/net/minecraft/core/NonNullList.java -index 8c0d8f4e8f8c4cbf0a0b771c1bd99e54877b4944..b88a8663bb4ebd8bf2c541402ded6fd6e9a97589 100644 +index feefe51469843707afb2ecd4aaa3c9da2e089eb5..c7e418e5f7ca7f177df4e9432a0963f89b972a61 100644 --- a/net/minecraft/core/NonNullList.java +++ b/net/minecraft/core/NonNullList.java @@ -14,23 +14,23 @@ public class NonNullList extends AbstractList { @@ -22,7 +22,7 @@ index 8c0d8f4e8f8c4cbf0a0b771c1bd99e54877b4944..b88a8663bb4ebd8bf2c541402ded6fd6 } public static NonNullList withSize(int size, E defaultValue) { - Validate.notNull(defaultValue); + Objects.requireNonNull(defaultValue); Object[] objects = new Object[size]; Arrays.fill(objects, defaultValue); - return new NonNullList<>(Arrays.asList((E[])objects), defaultValue); @@ -37,11 +37,11 @@ index 8c0d8f4e8f8c4cbf0a0b771c1bd99e54877b4944..b88a8663bb4ebd8bf2c541402ded6fd6 protected NonNullList(List list, @Nullable E defaultValue) { diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index de7800b46f7e8c68f24de8476032f2179edc4797..3ca2f56cb31d41e88eb2a3e59c3749fbdef7c85e 100644 +index 5fb9a4cebf7407b8166ea5716c48a68e658d68d3..304ff53e2c21c6153ff8f04436eae66b0406d32a 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java @@ -132,8 +132,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider - public final AtomicInteger tickingGenerated = new AtomicInteger(); // Paper - public + public final ChunkMap.DistanceManager distanceManager; private final String storageName; private final PlayerMap playerMap = new PlayerMap(); - public final Int2ObjectMap entityMap = new Int2ObjectOpenHashMap<>(); @@ -54,10 +54,10 @@ index de7800b46f7e8c68f24de8476032f2179edc4797..3ca2f56cb31d41e88eb2a3e59c3749fb public int serverViewDistance; public final WorldGenContext worldGenContext; // Paper - public diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 66ba223dacefb3531c46b144c4499b2b2285eafe..0b7f9af0c4e43115878769043ebd06a09ccdf059 100644 +index b94b946986258fed3c6d68d9972a657e176d08a4..f3110b736764a36abe5778c8a6bbf50f7349016c 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -253,7 +253,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -258,7 +258,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public final List getEntitiesOfClass(final Class entityClass, final AABB boundingBox, final Predicate predicate) { @@ -66,7 +66,7 @@ index 66ba223dacefb3531c46b144c4499b2b2285eafe..0b7f9af0c4e43115878769043ebd06a0 ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getEntities(entityClass, null, boundingBox, ret, predicate); -@@ -262,7 +262,7 @@ public abstract class Level implements LevelAccessor, UUIDLookup, AutoCl +@@ -267,7 +267,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public final List moonrise$getHardCollidingEntities(final Entity entity, final AABB box, final Predicate predicate) { @@ -76,10 +76,10 @@ index 66ba223dacefb3531c46b144c4499b2b2285eafe..0b7f9af0c4e43115878769043ebd06a0 ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); diff --git a/net/minecraft/world/level/chunk/ProtoChunk.java b/net/minecraft/world/level/chunk/ProtoChunk.java -index aa085d8a78a3fb40a214e4b152ab04d9a409f76f..5ed1a8b6ac025d03fdeb408a6eaa00320087f690 100644 +index 4846ab41592014e45cd6e4f5ff12dbd6eb17e8cc..4155d63aa304d9624613eb81ba9d12457a3385ed 100644 --- a/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -46,7 +46,7 @@ public class ProtoChunk extends ChunkAccess { +@@ -45,7 +45,7 @@ public class ProtoChunk extends ChunkAccess { @Nullable private volatile LevelLightEngine lightEngine; private volatile ChunkStatus status = ChunkStatus.EMPTY; diff --git a/patches/todo/minecraft-patches/0069-Optimize-level-ticking.patch b/divinemc-server/minecraft-patches/features/0058-Optimize-level-ticking.patch similarity index 96% rename from patches/todo/minecraft-patches/0069-Optimize-level-ticking.patch rename to divinemc-server/minecraft-patches/features/0058-Optimize-level-ticking.patch index b5cc125..5720193 100644 --- a/patches/todo/minecraft-patches/0069-Optimize-level-ticking.patch +++ b/divinemc-server/minecraft-patches/features/0058-Optimize-level-ticking.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize level ticking diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 386fdc23b35675a7db66d16bf2a8a6dd5b44059a..4934ce03ac533d9c60674632cdac6621e62f6b44 100644 +index a4a2231f5850269a6003afca8db78fa486cf3a71..f3eafbdc06e32788c5ae08279b45feea3b100555 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -908,9 +908,10 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -929,9 +929,10 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper start - optimise random ticking private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(net.minecraft.world.level.levelgen.RandomSupport.generateUniqueSeed()); @@ -20,7 +20,7 @@ index 386fdc23b35675a7db66d16bf2a8a6dd5b44059a..4934ce03ac533d9c60674632cdac6621 final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294(); -@@ -919,42 +920,38 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -940,42 +941,38 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe final int offsetZ = cpos.z << 4; for (int sectionIndex = 0, sectionsLen = sections.length; sectionIndex < sectionsLen; sectionIndex++) { @@ -73,10 +73,10 @@ index 386fdc23b35675a7db66d16bf2a8a6dd5b44059a..4934ce03ac533d9c60674632cdac6621 public void tickChunk(LevelChunk chunk, int randomTickSpeed) { diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 306590a29f8b6db6c0c68814f3fa28f3f26e448b..3dcdafe18085fc8fff9eb5bb50392ba13a27b066 100644 +index 3a9843c30f685d2e1f0cd54ace5dddfa9e2314fa..ae58d4978d2f8c0f61b5c743282f7241bd29b747 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -75,7 +75,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -84,7 +84,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot return ""; } }; diff --git a/patches/todo/minecraft-patches/0071-lithium-combined_heightmap_update.patch b/divinemc-server/minecraft-patches/features/0059-lithium-combined_heightmap_update.patch similarity index 90% rename from patches/todo/minecraft-patches/0071-lithium-combined_heightmap_update.patch rename to divinemc-server/minecraft-patches/features/0059-lithium-combined_heightmap_update.patch index 5870d61..6b4b067 100644 --- a/patches/todo/minecraft-patches/0071-lithium-combined_heightmap_update.patch +++ b/divinemc-server/minecraft-patches/features/0059-lithium-combined_heightmap_update.patch @@ -10,10 +10,10 @@ As part of: Lithium (https://github.com/CaffeineMC/lithium) Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 3dcdafe18085fc8fff9eb5bb50392ba13a27b066..9cd2a05683d879f56b6e62dfd49ac30341deeb06 100644 +index ae58d4978d2f8c0f61b5c743282f7241bd29b747..ef98a02b982fd9e0992e0a40879d8cf498417cbf 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -380,10 +380,13 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -388,10 +388,13 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot return null; } else { Block block = state.getBlock(); @@ -32,7 +32,7 @@ index 3dcdafe18085fc8fff9eb5bb50392ba13a27b066..9cd2a05683d879f56b6e62dfd49ac303 if (hasOnlyAir != hasOnlyAir1) { this.level.getChunkSource().getLightEngine().updateSectionStatus(pos, hasOnlyAir1); diff --git a/net/minecraft/world/level/levelgen/Heightmap.java b/net/minecraft/world/level/levelgen/Heightmap.java -index 5fc80f67cd76bb557e2f629d91b5c6538b660d28..28681630564fa4c4527280537e334c9e62c274a7 100644 +index b53853c2b8ec79a4dcdf66f7995540e59ddee356..e30f24788adc8160739a714e3519acb0ae7ee3b5 100644 --- a/net/minecraft/world/level/levelgen/Heightmap.java +++ b/net/minecraft/world/level/levelgen/Heightmap.java @@ -123,6 +123,12 @@ public class Heightmap { diff --git a/patches/todo/paper-patches/0003-Delete-timings.patch b/divinemc-server/paper-patches/features/0003-Delete-timings.patch similarity index 100% rename from patches/todo/paper-patches/0003-Delete-timings.patch rename to divinemc-server/paper-patches/features/0003-Delete-timings.patch diff --git a/patches/todo/paper-patches/0004-Delete-ReloadCommand.patch b/divinemc-server/paper-patches/features/0004-Delete-ReloadCommand.patch similarity index 85% rename from patches/todo/paper-patches/0004-Delete-ReloadCommand.patch rename to divinemc-server/paper-patches/features/0004-Delete-ReloadCommand.patch index bf684d0..99971fb 100644 --- a/patches/todo/paper-patches/0004-Delete-ReloadCommand.patch +++ b/divinemc-server/paper-patches/features/0004-Delete-ReloadCommand.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Delete ReloadCommand diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3ce12d384561fc36ad957c4a298eb9701ed8c977..4ae2ede15d7b69ce3ba7a920ecb7c2c84952de0f 100644 +index 916cca90459831c12b988ca10a0f53cb1befc058..ac2e91d00fb0320f0c9a049ab980f6e2f5124dd9 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1023,11 +1023,6 @@ public final class CraftServer implements Server { +@@ -970,11 +970,6 @@ public final class CraftServer implements Server { @Override public void reload() { diff --git a/patches/todo/paper-patches/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch b/divinemc-server/paper-patches/features/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch similarity index 89% rename from patches/todo/paper-patches/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch rename to divinemc-server/paper-patches/features/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch index 2b1f569..fa4ecec 100644 --- a/patches/todo/paper-patches/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch +++ b/divinemc-server/paper-patches/features/0005-Paper-PR-Add-FillBottleEvents-for-player-and-dispens.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Paper PR: Add FillBottleEvents for player and dispenser diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b4ee0f809c1524c74eca74ee6bc471a3051d92a6..7725870545b4c87dc5e7536d04c710999ea6932b 100644 +index 60350a65c8073bef3acb8432e41334430eab01cd..782cfca296cd0f5cced549d29ce6eb94ec74319c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -2125,4 +2125,18 @@ public class CraftEventFactory { - - return disconnectReason; +@@ -2133,4 +2133,18 @@ public class CraftEventFactory { + event.callEvent(); + return event.isAllowed(); } + + // DivineMC start - Paper PR: Add FillBottleEvents for player and dispenser diff --git a/patches/todo/paper-patches/0006-Paper-PR-Player-standing-on-position-API.patch b/divinemc-server/paper-patches/features/0006-Paper-PR-Player-standing-on-position-API.patch similarity index 89% rename from patches/todo/paper-patches/0006-Paper-PR-Player-standing-on-position-API.patch rename to divinemc-server/paper-patches/features/0006-Paper-PR-Player-standing-on-position-API.patch index cf3951c..98b5548 100644 --- a/patches/todo/paper-patches/0006-Paper-PR-Player-standing-on-position-API.patch +++ b/divinemc-server/paper-patches/features/0006-Paper-PR-Player-standing-on-position-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Paper PR: Player standing on position API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 476eefebace887064b728f08af40c746b6f70787..93d03f99db85fc0415bc4d83ce019927bc9b33ce 100644 +index 11c1a0abad4efb65547c5b42869ec06bb74b4d59..939f0a74f0956e73488dea68c3e0b5846fcac68b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1353,6 +1353,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1356,6 +1356,20 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return this.entity.get(io.papermc.paper.datacomponent.PaperDataComponentType.bukkitToMinecraft(type)) != null; } diff --git a/patches/todo/paper-patches/0007-Paper-PR-Throttle-failed-spawn-attempts.patch b/divinemc-server/paper-patches/features/0007-Paper-PR-Throttle-failed-spawn-attempts.patch similarity index 95% rename from patches/todo/paper-patches/0007-Paper-PR-Throttle-failed-spawn-attempts.patch rename to divinemc-server/paper-patches/features/0007-Paper-PR-Throttle-failed-spawn-attempts.patch index 3fa023b..7f79209 100644 --- a/patches/todo/paper-patches/0007-Paper-PR-Throttle-failed-spawn-attempts.patch +++ b/divinemc-server/paper-patches/features/0007-Paper-PR-Throttle-failed-spawn-attempts.patch @@ -22,7 +22,7 @@ Example config in paper-world-defaults.yml: ``` diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index bd1f0ba488ff9f12de4b85c97617638592bab09c..827ae27210a5da342041fa355ac58708ca370961 100644 +index 6877056ddfe58910c0fa859105f3c7223a1b00c9..e65e3068ca11836bde554a3be2540760aeb25aff 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -184,6 +184,17 @@ public class WorldConfiguration extends ConfigurationPart { diff --git a/patches/todo/paper-patches/0008-Optimize-default-values-for-configs.patch b/divinemc-server/paper-patches/features/0008-Optimize-default-values-for-configs.patch similarity index 98% rename from patches/todo/paper-patches/0008-Optimize-default-values-for-configs.patch rename to divinemc-server/paper-patches/features/0008-Optimize-default-values-for-configs.patch index 1eb5c6f..8658016 100644 --- a/patches/todo/paper-patches/0008-Optimize-default-values-for-configs.patch +++ b/divinemc-server/paper-patches/features/0008-Optimize-default-values-for-configs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimize default values for configs diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 3f5e76e4df8ff8152060449f89b522910adee834..4eb45775c7ada4fd4137c87104580314f888bc50 100644 +index 81553c3f08bfac855b914997fb6a4e7cf2241272..6c23b24477dd24ed43932d0c5ae5d97f80d968f6 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -349,8 +349,8 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -332,8 +332,8 @@ public class GlobalConfiguration extends ConfigurationPart { @Constraints.Min(4) public int regionFileCacheSize = 256; @Comment("See https://luckformula.emc.gs") @@ -20,7 +20,7 @@ index 3f5e76e4df8ff8152060449f89b522910adee834..4eb45775c7ada4fd4137c87104580314 public IntOr.Default compressionLevel = IntOr.Default.USE_DEFAULT; @Comment("Defines the leniency distance added on the server to the interaction range of a player when validating interact packets.") diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -index 827ae27210a5da342041fa355ac58708ca370961..963c6749363c0d88d01a7c2b261c9b6e6c9e849f 100644 +index e65e3068ca11836bde554a3be2540760aeb25aff..3e4381a8a76385ba9dc9bef0d8d16fce36f3647b 100644 --- a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java @@ -149,8 +149,10 @@ public class WorldConfiguration extends ConfigurationPart { diff --git a/patches/todo/paper-patches/0009-Configurable-files-locations-and-plugin-loading.patch b/divinemc-server/paper-patches/features/0009-Configurable-files-locations-and-plugin-loading.patch similarity index 97% rename from patches/todo/paper-patches/0009-Configurable-files-locations-and-plugin-loading.patch rename to divinemc-server/paper-patches/features/0009-Configurable-files-locations-and-plugin-loading.patch index fc906ff..dab1e1e 100644 --- a/patches/todo/paper-patches/0009-Configurable-files-locations-and-plugin-loading.patch +++ b/divinemc-server/paper-patches/features/0009-Configurable-files-locations-and-plugin-loading.patch @@ -43,7 +43,7 @@ index 70413fddd23ca1165cb5090cce4fddcb1bbca93f..ae70b84e6473fa2ed94416bf4bef8849 @SuppressWarnings("unchecked") java.util.List files = ((java.util.List) optionSet.valuesOf("add-plugin")).stream().map(File::toPath).toList(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index d8fbc4348951b4e9363b16ca00c1ba371503031e..0108422e8974d8091ba6ecee1f1897a142a02b67 100644 +index 4cf0a09594e72193a452215c50ed1cce309d5cc7..efab2b8715988ad87f08e79d77fa46f1fc31aada 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -180,6 +180,52 @@ public class Main { @@ -100,7 +100,7 @@ index d8fbc4348951b4e9363b16ca00c1ba371503031e..0108422e8974d8091ba6ecee1f1897a1 .withRequiredArg() .ofType(String.class) diff --git a/src/main/java/org/bukkit/craftbukkit/help/HelpYamlReader.java b/src/main/java/org/bukkit/craftbukkit/help/HelpYamlReader.java -index b345a4973ea4aec58830e7d9aa5e1b5e78a2a4b7..f3d3b6e4caff9e16503cb04383876e84da7a30a3 100644 +index a659e06c4cff1c17333703881c36fed78f61efce..3026662462475ad73465655be0a6eb2141f61f95 100644 --- a/src/main/java/org/bukkit/craftbukkit/help/HelpYamlReader.java +++ b/src/main/java/org/bukkit/craftbukkit/help/HelpYamlReader.java @@ -25,7 +25,7 @@ public class HelpYamlReader { diff --git a/patches/todo/paper-patches/0010-Smooth-teleport-API.patch b/divinemc-server/paper-patches/features/0010-Smooth-teleport-API.patch similarity index 87% rename from patches/todo/paper-patches/0010-Smooth-teleport-API.patch rename to divinemc-server/paper-patches/features/0010-Smooth-teleport-API.patch index cd59101..0ce50ec 100644 --- a/patches/todo/paper-patches/0010-Smooth-teleport-API.patch +++ b/divinemc-server/paper-patches/features/0010-Smooth-teleport-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Smooth teleport API diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4e24a177aed7eda0899b4a1a1e308f02a16c5718..f62e0cd8f7910444439ff3285f2455eb928d4c03 100644 +index 4eb7d90f38e744b51c11d334a44dacb0a9ac6956..f0065fd83dbe3bd0552251b6e01f2a051a9e4ab9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -1405,6 +1405,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa +@@ -1371,6 +1371,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa // Paper end - Teleportation API } diff --git a/patches/todo/paper-patches/0011-SparklyPaper-Optimize-canSee-checks.patch b/divinemc-server/paper-patches/features/0011-SparklyPaper-Optimize-canSee-checks.patch similarity index 93% rename from patches/todo/paper-patches/0011-SparklyPaper-Optimize-canSee-checks.patch rename to divinemc-server/paper-patches/features/0011-SparklyPaper-Optimize-canSee-checks.patch index e184f3d..573e0f3 100644 --- a/patches/todo/paper-patches/0011-SparklyPaper-Optimize-canSee-checks.patch +++ b/divinemc-server/paper-patches/features/0011-SparklyPaper-Optimize-canSee-checks.patch @@ -14,10 +14,10 @@ This seems stupid, but it does seem that it improves the performance a bit, and We also create a "canSee" method tailored for "ChunkMap#updatePlayer()", a method without the equals check (the "updatePlayer()" already checks if the entity is the same entity) because the CraftPlayer's `equals()` check is a *bit* expensive compared to only checking the object's identity, and because the identity has already been check, we don't need to check it twice. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index f62e0cd8f7910444439ff3285f2455eb928d4c03..8d967f179e7b36517ecc6f29381bf69e57eb7a85 100644 +index f0065fd83dbe3bd0552251b6e01f2a051a9e4ab9..6b8841a1a84f6316b89b052328bbb549b4acbe21 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -220,7 +220,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa +@@ -227,7 +227,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa private long lastPlayed = 0; private boolean hasPlayedBefore = false; private final ConversationTracker conversationTracker = new ConversationTracker(); @@ -26,7 +26,7 @@ index f62e0cd8f7910444439ff3285f2455eb928d4c03..8d967f179e7b36517ecc6f29381bf69e private final Set unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player private static final WeakHashMap> pluginWeakReferences = new WeakHashMap<>(); private int hash = 0; -@@ -2304,9 +2304,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa +@@ -2250,9 +2250,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player, PluginMessa @Override public boolean canSee(org.bukkit.entity.Entity entity) { diff --git a/patches/todo/paper-patches/0012-Virtual-Threads.patch b/divinemc-server/paper-patches/features/0012-Virtual-Threads.patch similarity index 90% rename from patches/todo/paper-patches/0012-Virtual-Threads.patch rename to divinemc-server/paper-patches/features/0012-Virtual-Threads.patch index 80f48f8..f216930 100644 --- a/patches/todo/paper-patches/0012-Virtual-Threads.patch +++ b/divinemc-server/paper-patches/features/0012-Virtual-Threads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Virtual Threads diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index 8492a06883e2ff597bbbdaa74fe5e5cdd0a0a1b1..862e49f510720f3546c339f5c4cf1945303dd8c9 100644 +index e3138cd673789328514da91bd07484172cd8ae4d..982b9f3b7e546b7e8a0aad883e9a29bb772ddc81 100644 --- a/src/main/java/io/papermc/paper/util/MCUtil.java +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -37,7 +37,7 @@ public final class MCUtil { +@@ -38,7 +38,7 @@ public final class MCUtil { run.run(); } }; @@ -18,7 +18,7 @@ index 8492a06883e2ff597bbbdaa74fe5e5cdd0a0a1b1..862e49f510720f3546c339f5c4cf1945 .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(MinecraftServer.LOGGER)) .build() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java -index 0ca279fb71d39c81b1f608e0ee9ba3e498d55fa3..8f82c034de320af7b65bad1602ebb561dd844e59 100644 +index 27562fd66ae9d091837cab74057706c8a6b6521c..69fad4fcfa7f3692dedeb8e76402b6de39d82560 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java @@ -31,14 +31,18 @@ import java.util.ArrayList; @@ -39,7 +39,7 @@ index 0ca279fb71d39c81b1f608e0ee9ba3e498d55fa3..8f82c034de320af7b65bad1602ebb561 + ? Executors.newVirtualThreadPerTaskExecutor() + : new ThreadPoolExecutor( + // DivineMC end - Virtual Threads - 4, Integer.MAX_VALUE,30L, TimeUnit.SECONDS, new SynchronousQueue<>(), + 4, Integer.MAX_VALUE, 30L, TimeUnit.SECONDS, new SynchronousQueue<>(), new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %1$d").build()); private final Executor management = Executors.newSingleThreadExecutor(new ThreadFactoryBuilder() @@ -47,8 +51,12 @@ public class CraftAsyncScheduler extends CraftScheduler { diff --git a/patches/todo/paper-patches/0013-Implement-Secure-Seed.patch b/divinemc-server/paper-patches/features/0013-Implement-Secure-Seed.patch similarity index 89% rename from patches/todo/paper-patches/0013-Implement-Secure-Seed.patch rename to divinemc-server/paper-patches/features/0013-Implement-Secure-Seed.patch index 2ff1191..c8283dc 100644 --- a/patches/todo/paper-patches/0013-Implement-Secure-Seed.patch +++ b/divinemc-server/paper-patches/features/0013-Implement-Secure-Seed.patch @@ -7,10 +7,10 @@ Original license: GPLv3 Original project: https://github.com/plasmoapp/matter diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 400e632208d133a3f49fc7f14bceb48a1026769b..a1c7ba0fdb505d09407cca94e890dedd2d9cb313 100644 +index 09baa8c13a56e0f503815a436042b7b79b1698e4..eb182ae056d7f17f0a49e3e7d1de3d6d79f40f4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -@@ -196,7 +196,12 @@ public class CraftChunk implements Chunk { +@@ -193,7 +193,12 @@ public class CraftChunk implements Chunk { @Override public boolean isSlimeChunk() { // 987234911L is taken from Slime when seeing if a slime can spawn in a chunk @@ -25,10 +25,10 @@ index 400e632208d133a3f49fc7f14bceb48a1026769b..a1c7ba0fdb505d09407cca94e890dedd @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4ae2ede15d7b69ce3ba7a920ecb7c2c84952de0f..c70526274391debfa694dbd82ed613d99bca37d1 100644 +index ac2e91d00fb0320f0c9a049ab980f6e2f5124dd9..d66c80582f66ccc7f7eada0eba28c19ef22c8ced 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1349,7 +1349,11 @@ public final class CraftServer implements Server { +@@ -1255,7 +1255,11 @@ public final class CraftServer implements Server { registryAccess = levelDataAndDimensions.dimensions().dimensionsRegistryAccess(); } else { LevelSettings levelSettings; diff --git a/patches/todo/paper-patches/0019-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/divinemc-server/paper-patches/features/0014-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch similarity index 96% rename from patches/todo/paper-patches/0019-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch rename to divinemc-server/paper-patches/features/0014-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch index e89431b..e65b802 100644 --- a/patches/todo/paper-patches/0019-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch +++ b/divinemc-server/paper-patches/features/0014-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch @@ -8,7 +8,7 @@ Original project: https://github.com/PaperMC/Paper Paper pull request: https://github.com/PaperMC/Paper/pull/8074 diff --git a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java -index 30a19d10869f73d67b794e8e4c035bc5c10209e6..95acdc0e849c4bb36bab33ee8bc9a9d4e8667829 100644 +index b40b79beb3115b80150d1aa4455ebb7a2a055574..326510e9a8213937bbfa1e2e75be9f08ce8ac925 100644 --- a/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java +++ b/src/main/java/com/destroystokyo/paper/network/StandardPaperServerListPingEventImpl.java @@ -64,13 +64,24 @@ public final class StandardPaperServerListPingEventImpl extends PaperServerListP diff --git a/patches/todo/paper-patches/0016-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch b/divinemc-server/paper-patches/features/0015-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch similarity index 100% rename from patches/todo/paper-patches/0016-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch rename to divinemc-server/paper-patches/features/0015-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch diff --git a/divinemc-server/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java b/divinemc-server/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java index ea53ef3..901d5ba 100644 --- a/divinemc-server/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java +++ b/divinemc-server/src/main/java/net/caffeinemc/mods/lithium/common/world/chunk/LithiumHashPalette.java @@ -21,30 +21,24 @@ import static it.unimi.dsi.fastutil.Hash.FAST_LOAD_FACTOR; /** * Generally provides better performance over the vanilla {@link net.minecraft.world.level.chunk.HashMapPalette} when calling - * {@link LithiumHashPalette#idFor(Object)} through using a faster backing map and reducing pointer chasing. + * {@link LithiumHashPalette#idFor(Object, PaletteResize)} through using a faster backing map and reducing pointer chasing. */ public class LithiumHashPalette implements Palette { private static final int ABSENT_VALUE = -1; - - private final IdMap idList; - private final PaletteResize resizeHandler; private final int indexBits; - private final Reference2IntOpenHashMap table; private T[] entries; private int size = 0; - private LithiumHashPalette(IdMap idList, PaletteResize resizeHandler, int indexBits, T[] entries, Reference2IntOpenHashMap table, int size) { - this.idList = idList; - this.resizeHandler = resizeHandler; + private LithiumHashPalette(int indexBits, T[] entries, Reference2IntOpenHashMap table, int size) { this.indexBits = indexBits; this.entries = entries; this.table = table; this.size = size; } - public LithiumHashPalette(IdMap idList, int bits, PaletteResize resizeHandler, List list) { - this(idList, bits, resizeHandler); + public LithiumHashPalette(int bits, List list) { + this(bits); for (T t : list) { this.addEntry(t); @@ -52,10 +46,8 @@ public class LithiumHashPalette implements Palette { } @SuppressWarnings("unchecked") - public LithiumHashPalette(IdMap idList, int bits, PaletteResize resizeHandler) { - this.idList = idList; + public LithiumHashPalette(int bits) { this.indexBits = bits; - this.resizeHandler = resizeHandler; int capacity = 1 << bits; @@ -65,11 +57,11 @@ public class LithiumHashPalette implements Palette { } @Override - public int idFor(@NotNull T obj) { + public int idFor(@NotNull T obj, @NotNull PaletteResize resizeHandler) { int id = this.table.getInt(obj); if (id == ABSENT_VALUE) { - id = this.computeEntry(obj); + id = this.computeEntry(obj, resizeHandler); } return id; @@ -86,14 +78,14 @@ public class LithiumHashPalette implements Palette { return false; } - private int computeEntry(T obj) { + private int computeEntry(T obj, PaletteResize resizeHandler) { int id = this.addEntry(obj); if (id >= 1 << this.indexBits) { - if (this.resizeHandler == null) { + if (resizeHandler == null) { throw new IllegalStateException("Cannot grow"); } else { - id = this.resizeHandler.onResize(this.indexBits + 1, obj); + id = resizeHandler.onResize(this.indexBits + 1, obj); } } @@ -149,32 +141,32 @@ public class LithiumHashPalette implements Palette { } @Override - public void read(FriendlyByteBuf buf) { + public void read(FriendlyByteBuf buf, @NotNull IdMap idMap) { this.clear(); int entryCount = buf.readVarInt(); for (int i = 0; i < entryCount; ++i) { - this.addEntry(this.idList.byIdOrThrow(buf.readVarInt())); + this.addEntry(idMap.byIdOrThrow(buf.readVarInt())); } } @Override - public void write(FriendlyByteBuf buf) { + public void write(FriendlyByteBuf buf, @NotNull IdMap idMap) { int size = this.size; buf.writeVarInt(size); for (int i = 0; i < size; ++i) { - buf.writeVarInt(this.idList.getId(this.valueFor(i))); + buf.writeVarInt(idMap.getId(this.valueFor(i))); } } @Override - public int getSerializedSize() { + public int getSerializedSize(@NotNull IdMap idMap) { int size = VarInt.getByteSize(this.size); for (int i = 0; i < this.size; ++i) { - size += VarInt.getByteSize(this.idList.getId(this.valueFor(i))); + size += VarInt.getByteSize(idMap.getId(this.valueFor(i))); } return size; @@ -186,8 +178,8 @@ public class LithiumHashPalette implements Palette { } @Override - public @NotNull Palette copy(@NotNull PaletteResize resizeHandler) { - return new LithiumHashPalette<>(this.idList, resizeHandler, this.indexBits, this.entries.clone(), this.table.clone(), this.size); + public @NotNull Palette copy() { + return new LithiumHashPalette<>(this.indexBits, this.entries.clone(), this.table.clone(), this.size); } private void clear() { @@ -201,7 +193,7 @@ public class LithiumHashPalette implements Palette { return Arrays.asList(copy); } - public static Palette create(int bits, IdMap idList, PaletteResize listener, List list) { - return new LithiumHashPalette<>(idList, bits, listener, list); + public static Palette create(int bits, List list) { + return new LithiumHashPalette<>(bits, list); } } diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/config/DivineConfig.java b/divinemc-server/src/main/java/org/bxteam/divinemc/config/DivineConfig.java index 4546be1..ba79347 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/config/DivineConfig.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/config/DivineConfig.java @@ -216,11 +216,6 @@ public class DivineConfig { public static int asyncEntityTrackerKeepalive = 60; public static int asyncEntityTrackerQueueSize = 0; - // Async Join Thread settings - public static boolean asyncJoinEnabled = false; - public static int asyncJoinThreadCount = 1; - public static boolean asyncJoinUseVirtualThreads = false; - // Async chunk sending settings public static boolean asyncChunkSendingEnabled = true; public static int asyncChunkSendingMaxThreads = 1; @@ -233,7 +228,6 @@ public class DivineConfig { regionizedChunkTicking(); asyncPathfinding(); multithreadedTracker(); - asyncJoinSettings(); asyncChunkSending(); asyncMobSpawning(); } @@ -327,18 +321,6 @@ public class DivineConfig { if (asyncEntityTrackerQueueSize <= 0) asyncEntityTrackerQueueSize = asyncEntityTrackerMaxThreads * 384; } - private static void asyncJoinSettings() { - asyncJoinEnabled = getBoolean(ConfigCategory.ASYNC.key("join-thread.enabled"), asyncJoinEnabled, - "Enables async join thread, which offloads player setup and connection tasks to a separate thread", - "This can significantly improve MSPT when multiple players are joining simultaneously"); - asyncJoinThreadCount = getInt(ConfigCategory.ASYNC.key("join-thread.thread-count"), asyncJoinThreadCount, - "Number of threads to use for async join operations"); - asyncJoinUseVirtualThreads = getBoolean(ConfigCategory.ASYNC.key("join-thread.use-virtual-threads"), asyncJoinUseVirtualThreads, - "Whether to use virtual threads for async join operations (requires Java 21+)"); - - AsyncJoinHandler.init(asyncJoinEnabled, asyncJoinThreadCount); - } - private static void asyncChunkSending() { asyncChunkSendingEnabled = getBoolean(ConfigCategory.ASYNC.key("chunk-sending.enable"), asyncChunkSendingEnabled, "Makes chunk sending asynchronous, which can significantly reduce main thread load when many players are loading chunks."); @@ -408,7 +390,6 @@ public class DivineConfig { public static boolean virtualTabCompleteScheduler = false; public static boolean virtualAsyncExecutor = false; public static boolean virtualCommandBuilderScheduler = false; - public static boolean virtualProfileLookupPool = false; public static boolean virtualServerTextFilterPool = false; public static void load() { @@ -548,8 +529,6 @@ public class DivineConfig { "Uses virtual threads for the MCUtil async executor."); virtualCommandBuilderScheduler = getBoolean(ConfigCategory.PERFORMANCE.key("virtual-threads.command-builder-scheduler"), virtualCommandBuilderScheduler, "Uses virtual threads for the Async Command Builder Thread Pool."); - virtualProfileLookupPool = getBoolean(ConfigCategory.PERFORMANCE.key("virtual-threads.profile-lookup-pool"), virtualProfileLookupPool, - "Uses virtual threads for the Profile Lookup Pool, that is used for fetching player profiles."); virtualServerTextFilterPool = getBoolean(ConfigCategory.PERFORMANCE.key("virtual-threads.server-text-filter-pool"), virtualServerTextFilterPool, "Uses virtual threads for the server text filter pool."); } diff --git a/patches/todo/minecraft-patches/0058-Async-Join-Thread.patch b/patches/removed/1.21.10/server/0058-Async-Join-Thread.patch similarity index 98% rename from patches/todo/minecraft-patches/0058-Async-Join-Thread.patch rename to patches/removed/1.21.10/server/0058-Async-Join-Thread.patch index 3b46ff8..cc91854 100644 --- a/patches/todo/minecraft-patches/0058-Async-Join-Thread.patch +++ b/patches/removed/1.21.10/server/0058-Async-Join-Thread.patch @@ -3,6 +3,7 @@ From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Wed, 11 Jun 2025 20:15:37 +0300 Subject: [PATCH] Async Join Thread +Duplicates MC's authenticatorPool functionality without performance benefits diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java index 443aebb71b2a55ee9dcd2dd4bf9a30fbb8da9e49..6cec77e483d51771c602bbdb537c62c893043c08 100644 diff --git a/patches/todo/minecraft-patches/0039-Command-block-parse-results-caching.patch b/patches/todo/minecraft-patches/0039-Command-block-parse-results-caching.patch deleted file mode 100644 index cb69659..0000000 --- a/patches/todo/minecraft-patches/0039-Command-block-parse-results-caching.patch +++ /dev/null @@ -1,83 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sat, 15 Mar 2025 22:01:08 +0300 -Subject: [PATCH] Command block parse results caching - - -diff --git a/net/minecraft/world/level/BaseCommandBlock.java b/net/minecraft/world/level/BaseCommandBlock.java -index 13950339598f4ec705c54275342fa17ff2e74ca9..5791910babe010d3bdc00a5dd4486f00358df14f 100644 ---- a/net/minecraft/world/level/BaseCommandBlock.java -+++ b/net/minecraft/world/level/BaseCommandBlock.java -@@ -34,6 +34,10 @@ public abstract class BaseCommandBlock implements CommandSource { - private String command = ""; - @Nullable - private Component customName; -+ // DivineMC start - Caching command block parse results -+ private String lastExecutedCommand; -+ private com.mojang.brigadier.ParseResults parseResultsCache; -+ // DivineMC end - Caching command block parse results - // CraftBukkit start - @Override - public abstract org.bukkit.command.CommandSender getBukkitSender(CommandSourceStack wrapper); -@@ -113,13 +117,41 @@ public abstract class BaseCommandBlock implements CommandSource { - this.successCount++; - } - }); -- // Paper start - ServerCommandEvent -- org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), net.minecraft.commands.Commands.trimOptionalPrefix(this.command)); -- if (!event.callEvent()) { -- return true; -+ // DivineMC start - Command block parse results caching -+ if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.commandBlockParseResultsCaching) { -+ String commandCache = this.command; -+ // noinspection DuplicatedCode -+ com.google.common.base.Joiner joiner = com.google.common.base.Joiner.on(" "); -+ -+ if (commandCache.startsWith("/")) { -+ commandCache = commandCache.substring(1); -+ } -+ -+ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), commandCache); -+ org.bukkit.Bukkit.getPluginManager().callEvent(event); -+ if (!event.isCancelled()) { -+ commandCache = event.getCommand(); -+ String[] args = commandCache.split(" "); -+ -+ if (args.length != 0) { -+ String newCommand = joiner.join(args); -+ if (!newCommand.equals(lastExecutedCommand) || parseResultsCache == null) { -+ MinecraftServer.LOGGER.info("Recompiling parse results cache for command block at ({}, {}, {})", this.getPosition().x, this.getPosition().y, this.getPosition().z); -+ this.cache(server.getCommands().getDispatcher(), commandSourceStack, newCommand); -+ } -+ server.getCommands().performCommand(parseResultsCache, newCommand); -+ } -+ } -+ } else { -+ // Paper start - ServerCommandEvent -+ org.bukkit.event.server.ServerCommandEvent event = new org.bukkit.event.server.ServerCommandEvent(commandSourceStack.getBukkitSender(), net.minecraft.commands.Commands.trimOptionalPrefix(this.command)); -+ if (!event.callEvent()) { -+ return true; -+ } -+ server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); -+ // Paper end - ServerCommandEvent - } -- server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); -- // Paper end - ServerCommandEvent -+ // DivineMC end - Command block parse results caching - } catch (Throwable var6) { - CrashReport crashReport = CrashReport.forThrowable(var6, "Executing command block"); - CrashReportCategory crashReportCategory = crashReport.addCategory("Command to be executed"); -@@ -139,6 +171,13 @@ public abstract class BaseCommandBlock implements CommandSource { - } - } - -+ // DivineMC start - Command block parse results caching -+ private void cache(com.mojang.brigadier.CommandDispatcher dispatcher, CommandSourceStack commandSourceStack, String commandCache) { -+ this.parseResultsCache = dispatcher.parse(commandCache, commandSourceStack); -+ this.lastExecutedCommand = commandCache; -+ } -+ // DivineMC end - Command block parse results caching -+ - public Component getName() { - return this.customName != null ? this.customName : DEFAULT_NAME; - } diff --git a/patches/todo/minecraft-patches/0066-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/patches/todo/minecraft-patches/0066-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch deleted file mode 100644 index 2a75254..0000000 --- a/patches/todo/minecraft-patches/0066-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 20 Jul 2025 16:09:38 +0300 -Subject: [PATCH] Paper PR: Fire ServerListPingEvent for secondary motd send - -Original license: GPLv3 -Original project: https://github.com/PaperMC/Paper -Paper pull request: https://github.com/PaperMC/Paper/pull/8074 - -diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 48a02a25c4fa6f3bacefaccd122694156da1a331..a0d45f72e7c35883996214a2c5420d6a996a58aa 100644 ---- a/net/minecraft/server/players/PlayerList.java -+++ b/net/minecraft/server/players/PlayerList.java -@@ -304,10 +304,15 @@ public abstract class PlayerList { - mutableComponent.withStyle(ChatFormatting.YELLOW); - Component joinMessage = mutableComponent; // Paper - Adventure - serverGamePacketListenerImpl.teleport(player.getX(), player.getY(), player.getZ(), player.getYRot(), player.getXRot()); -- ServerStatus status = this.server.getStatus(); -- if (status != null && !cookie.transferred()) { -- player.sendServerStatus(status); -+ // DivineMC start - Paper PR: Fire ServerListPingEvent for secondary motd send -+ if (!cookie.transferred()) { -+ io.papermc.paper.util.MCUtil.scheduleAsyncTask(() -> { -+ if (player.hasDisconnected()) return; -+ net.minecraft.network.protocol.status.ServerStatus status = com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.getEventResponse(this.server, player.connection.connection); -+ if (status != null) player.sendServerStatus(status); -+ }); - } -+ // DivineMC end - Paper PR: Fire ServerListPingEvent for secondary motd send - - // player.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below - this.players.add(player);