From 776898e6096c0e5d25520e60b7cebc99dd67f031 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Thu, 11 Dec 2025 16:32:33 +0300 Subject: [PATCH] finish applying all patches --- .../features/0001-Rebrand.patch | 18 +- .../features/0002-Configuration.patch | 8 +- ...03-Completely-remove-Mojang-profiler.patch | 751 +++++++++--------- ...lBottleEvents-for-player-and-dispens.patch | 8 +- ...er-PR-Throttle-failed-spawn-attempts.patch | 52 +- ...06-Raytrace-AntiXray-SDK-integration.patch | 8 +- ...ket-on-player-join-to-avoid-chunk-lo.patch | 6 +- .../features/0008-lithium-fast_util.patch | 6 +- .../0009-C2ME-Optimize-world-gen-math.patch | 12 +- ...-Carpet-Fixes-RecipeManager-Optimize.patch | 6 +- .../0013-C2ME-optimize-noise-generation.patch | 4 +- .../0014-Use-Java-s-Math-functions.patch | 6 +- .../features/0015-Disable-leaf-decay.patch | 4 +- .../features/0016-Optimize-entities.patch | 42 +- ...p-distanceToSqr-call-in-ServerEntity.patch | 4 +- ...0019-Carpet-Fixes-Sheep-Optimization.patch | 6 +- ...MS-Addition-Optimized-dragon-respawn.patch | 24 +- ...22-Option-to-disable-disconnect.spam.patch | 12 +- ...able-saving-of-snowball-and-firework.patch | 12 +- .../0024-Snowball-and-Egg-knockback.patch | 16 +- .../0026-Reduce-chunk-loading-lookups.patch | 4 +- ...igurable-movement-speed-for-entities.patch | 52 +- ...weird-movement-and-disable-teleporti.patch | 10 +- .../features/0029-Optimize-Raids.patch | 32 +- .../features/0032-Optimize-Fluids.patch | 6 +- .../0033-Optimize-Structure-Generation.patch | 61 +- .../0034-Implement-NoChatReports.patch | 20 +- .../features/0035-Lag-compensation.patch | 94 +-- .../features/0036-Virtual-Threads.patch | 14 +- ...-Command-block-parse-results-caching.patch | 32 +- .../0039-Player-ProfileResult-caching.patch | 6 +- .../features/0040-Implement-Secure-Seed.patch | 74 +- .../0041-Dynamic-Activation-of-Brain.patch | 74 +- .../0042-Petal-Async-Pathfinding.patch | 132 ++- .../0043-Petal-Multithreaded-Tracker.patch | 95 ++- ...044-Pufferfish-Optimize-mob-spawning.patch | 44 +- ...er-ShapelessRecipes-comparison-for-V.patch | 14 +- .../0046-C2ME-Density-Function-Compiler.patch | 67 +- .../features/0047-Clump-experience-orbs.patch | 20 +- ...-SparklyPaper-Parallel-world-ticking.patch | 224 +++--- .../0049-MSPT-Tracking-for-each-world.patch | 8 +- .../0050-Catch-update-suppressors.patch | 10 +- .../0051-Regionized-Chunk-Ticking.patch | 68 +- .../features/0052-C2ME-Limit-NBT-cache.patch | 4 +- ...C2ME-Optimize-Aquifer-and-Beardifier.patch | 38 +- .../features/0055-Crafter-1gt-delay.patch | 6 +- .../0056-Raytrace-Entity-Tracker.patch | 24 +- .../features/0057-Leaves-Protocol-Core.patch | 32 +- ...PR-Optimise-non-flush-packet-sending.patch | 8 +- .../0059-Linear-region-file-format.patch | 42 +- .../0060-Cleanup-dead-code-from-Paper.patch | 30 +- .../0061-C2ME-The-End-Biome-Cache.patch | 2 +- ...-Do-not-send-spectator-change-packet.patch | 16 +- ...rverListPingEvent-for-secondary-motd.patch | 4 +- ...igurable-player-spawn-tracking-range.patch | 6 +- .../features/0066-Optimize-collections.patch | 26 +- .../0067-Optimize-level-ticking.patch | 37 +- .../features/0068-Optimize-Moonrise.patch | 20 +- ...69-lithium-combined_heightmap_update.patch | 4 +- .../0071-lithium-sleeping_block_entity.patch | 198 ++--- .../0072-lithium-equipment_tracking.patch | 12 +- .../0073-Configurable-Files-Locations.patch | 6 +- ...-Cache-climbing-check-for-activation.patch | 6 +- ...EntityCollisionContext-a-live-repres.patch | 13 +- ...er-checking-for-useless-move-packets.patch | 4 +- .../world/entity/LivingEntity.java.patch | 2 +- .../pufferfish/util/AsyncExecutor.java | 2 +- .../async/rct/RegionizedChunkTicking.java | 4 +- .../divinemc/command/DivineCommand.java | 2 +- .../bxteam/divinemc/config/DivineConfig.java | 6 +- .../divinemc/util/structure/GeneralUtils.java | 3 +- .../leaves/protocol/AppleSkinProtocol.java | 18 +- .../leaves/protocol/XaeroMapProtocol.java | 14 +- .../protocol/core/LeavesCustomPayload.java | 4 +- .../protocol/core/LeavesProtocolManager.java | 22 +- .../leaves/protocol/core/ProtocolUtils.java | 10 +- .../MinecraftRegisterInvokerHolder.java | 6 +- .../leaves/protocol/jade/JadeProtocol.java | 16 +- .../jade/payload/ClientHandshakePayload.java | 6 +- .../jade/payload/ReceiveDataPayload.java | 4 +- .../jade/payload/RequestBlockPayload.java | 6 +- .../protocol/jade/provider/IJadeProvider.java | 4 +- .../jade/provider/ItemStorageProvider.java | 12 +- .../jade/provider/block/BeehiveProvider.java | 8 +- .../provider/block/BlockNameProvider.java | 8 +- .../provider/block/BrewingStandProvider.java | 6 +- .../jade/provider/block/CampfireProvider.java | 6 +- .../provider/block/CommandBlockProvider.java | 6 +- .../jade/provider/block/FurnaceProvider.java | 6 +- .../provider/block/HopperLockProvider.java | 8 +- .../jade/provider/block/JukeboxProvider.java | 6 +- .../jade/provider/block/LecternProvider.java | 6 +- .../block/MobSpawnerCooldownProvider.java | 6 +- .../jade/provider/block/RedstoneProvider.java | 6 +- .../provider/entity/AnimalOwnerProvider.java | 6 +- .../provider/entity/MobBreedingProvider.java | 6 +- .../provider/entity/MobGrowthProvider.java | 6 +- .../entity/NextEntityDropProvider.java | 6 +- .../provider/entity/PetArmorProvider.java | 6 +- .../entity/ZombieVillagerProvider.java | 2 +- .../protocol/jade/util/HierarchyLookup.java | 8 +- .../protocol/jade/util/IHierarchyLookup.java | 6 +- .../jade/util/PairHierarchyLookup.java | 6 +- .../syncmatica/exchange/Exchange.java | 6 +- .../syncmatica/exchange/ExchangeTarget.java | 4 +- gradle.properties | 3 +- 106 files changed, 1459 insertions(+), 1523 deletions(-) diff --git a/divinemc-server/minecraft-patches/features/0001-Rebrand.patch b/divinemc-server/minecraft-patches/features/0001-Rebrand.patch index b01cd28..192bf15 100644 --- a/divinemc-server/minecraft-patches/features/0001-Rebrand.patch +++ b/divinemc-server/minecraft-patches/features/0001-Rebrand.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Rebrand diff --git a/net/minecraft/CrashReport.java b/net/minecraft/CrashReport.java -index 394443d00e661715439be1e56dddc129947699a4..480ad57a6b7b74e6b83e9c6ceb69ea1feacca106 100644 +index 704ede68e582f19ab3d1fca142a942da283f332e..a863868fd002b02b7f397c20dde5a923b9d7a818 100644 --- a/net/minecraft/CrashReport.java +++ b/net/minecraft/CrashReport.java @@ -30,7 +30,7 @@ public class CrashReport { @@ -31,11 +31,11 @@ index 97844ec1ccc986eb3d3a185d78a03ceeca49fc1a..5e40ec3fbe6e6d5f98ad98df7d4c27d6 @Override diff --git a/net/minecraft/server/Main.java b/net/minecraft/server/Main.java -index 42841fdc7e64311ba9217789a3dc758a351cf674..036c3931f4c1e453892f32e59085be702721f016 100644 +index 272e2871aca8d283229cc5618e3051146db56681..e5d78f6a8a2ef2a197b3d327ca48679feb012601 100644 --- a/net/minecraft/server/Main.java +++ b/net/minecraft/server/Main.java -@@ -67,36 +67,29 @@ public class Main { - ) +@@ -65,36 +65,29 @@ public class Main { + @SuppressForbidden(reason = "System.out needed before bootstrap") @DontObfuscate public static void main(final OptionSet optionSet) { // CraftBukkit - replaces main(String[] args) + // DivineMC start - Rebrand @@ -90,7 +90,7 @@ index 42841fdc7e64311ba9217789a3dc758a351cf674..036c3931f4c1e453892f32e59085be70 Path path = (Path) optionSet.valueOf("pidFile"); // CraftBukkit if (path != null) { writePidFile(path); -@@ -122,8 +115,6 @@ public class Main { +@@ -120,8 +113,6 @@ public class Main { DedicatedServerSettings dedicatedServerSettings = new DedicatedServerSettings(optionSet); // CraftBukkit - CLI argument support dedicatedServerSettings.forceSave(); RegionFileVersion.configure(dedicatedServerSettings.getProperties().regionFileComression); @@ -99,7 +99,7 @@ index 42841fdc7e64311ba9217789a3dc758a351cf674..036c3931f4c1e453892f32e59085be70 // Paper start - load config files early for access below if needed org.bukkit.configuration.file.YamlConfiguration bukkitConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("bukkit-settings")); org.bukkit.configuration.file.YamlConfiguration spigotConfiguration = io.papermc.paper.configuration.PaperConfigurations.loadLegacyConfigFile((File) optionSet.valueOf("spigot-settings")); -@@ -146,19 +137,6 @@ public class Main { +@@ -144,19 +135,6 @@ public class Main { return; } @@ -120,10 +120,10 @@ index 42841fdc7e64311ba9217789a3dc758a351cf674..036c3931f4c1e453892f32e59085be70 String awtException = io.papermc.paper.util.ServerEnvironment.awtDependencyCheck(); if (awtException != null) { diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 8a9e97f3b92def14f40c246ca0ff713ed8192b08..f29cee41258a8220256bf6b3b5b04f79c142cc19 100644 +index e3561303df02b5c769dd039ad45c684062e04bd5..990b50a5ec6d578924cae12031a6ab467f0f1287 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1277,6 +1277,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop contextChain = finishParsing(parseResults, command, commandSourceStack); try { -@@ -402,8 +398,6 @@ public class Commands { +@@ -412,8 +408,6 @@ public class Commands { commandSourceStack.sendFailure(Component.literal(Util.describeError(var12))); LOGGER.error("'/{}' threw an exception", command, var12); } @@ -49,17 +49,17 @@ index 9aa09e11032f539952edeeed119f7705c330db0a..9a7a40c1dcea57ba674d8431077d2477 } } -@@ -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); +@@ -471,7 +465,7 @@ public class Commands { + int max = Math.max(1, gameRules.get(GameRules.MAX_COMMAND_SEQUENCE_LENGTH)); + int i = gameRules.get(GameRules.MAX_COMMAND_FORKS); -- try (ExecutionContext executionContext1 = new ExecutionContext<>(max, _int, Profiler.get())) { -+ try (ExecutionContext executionContext1 = new ExecutionContext<>(max, _int)) { +- try (ExecutionContext executionContext1 = new ExecutionContext<>(max, i, Profiler.get())) { ++ try (ExecutionContext executionContext1 = new ExecutionContext<>(max, i)) { CURRENT_EXECUTION_CONTEXT.set(executionContext1); contextConsumer.accept(executionContext1); executionContext1.runCommandQueue(); diff --git a/net/minecraft/commands/execution/ExecutionContext.java b/net/minecraft/commands/execution/ExecutionContext.java -index 952cc09864de5ec147afd2525c70170280393bd6..c54f4e5ff70c40081e8bde054aa35e48cc700849 100644 +index f109be01de8346f6729d30e27784e4cd45cdd48b..c98c4bc7dddb70d25ed3b08ab71ae91fb27286d7 100644 --- a/net/minecraft/commands/execution/ExecutionContext.java +++ b/net/minecraft/commands/execution/ExecutionContext.java @@ -20,7 +20,6 @@ public class ExecutionContext implements AutoCloseable { @@ -67,10 +67,10 @@ index 952cc09864de5ec147afd2525c70170280393bd6..c54f4e5ff70c40081e8bde054aa35e48 private final int commandLimit; private final int forkLimit; - private final ProfilerFiller profiler; - @Nullable - private TraceCallbacks tracer; + private @Nullable TraceCallbacks tracer; private int commandQuota; -@@ -29,10 +28,9 @@ public class ExecutionContext implements AutoCloseable { + private boolean queueOverflow; +@@ -28,10 +27,9 @@ public class ExecutionContext implements AutoCloseable { private final List> newTopCommands = new ObjectArrayList<>(); private int currentFrameDepth; @@ -82,7 +82,7 @@ index 952cc09864de5ec147afd2525c70170280393bd6..c54f4e5ff70c40081e8bde054aa35e48 this.commandQuota = commandQuota; } -@@ -132,7 +130,7 @@ public class ExecutionContext implements AutoCloseable { +@@ -130,7 +128,7 @@ public class ExecutionContext implements AutoCloseable { } public ProfilerFiller profiler() { @@ -203,10 +203,10 @@ index 18071dcc69cc28471dddb7de94e803ec1e5fc2e4..aa25f5ebaf7d1b22825b962b02dcae02 } } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785defff4a1dad 100644 +index 990b50a5ec6d578924cae12031a6ab467f0f1287..c425b6a1f3cb2fb451671c1d5732f9352dac5bcf 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -117,20 +117,9 @@ import net.minecraft.util.TimeUtil; +@@ -120,20 +120,9 @@ import net.minecraft.util.Util; import net.minecraft.util.debug.ServerDebugSubscribers; import net.minecraft.util.debugchart.SampleLogger; import net.minecraft.util.debugchart.TpsDebugDimensions; @@ -227,7 +227,7 @@ index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785def import net.minecraft.util.thread.ReentrantBlockableEventLoop; import net.minecraft.world.Difficulty; import net.minecraft.world.RandomSequences; -@@ -203,13 +192,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop tickables = Lists.newArrayList(); @@ -235,13 +235,12 @@ index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785def - private Consumer onMetricsRecordingStopped = results -> this.stopRecordingMetrics(); - private Consumer onMetricsRecordingFinished = path -> {}; - private boolean willStartRecordingMetrics; -- @Nullable -- private MinecraftServer.TimeProfiler debugCommandProfiler; +- private MinecraftServer.@Nullable TimeProfiler debugCommandProfiler; - private boolean debugCommandProfilerDelayStart; private ServerConnectionListener connection; // Paper - per world load listener - moved LevelLoadListener to ServerLevel - @Nullable -@@ -1018,9 +1000,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 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 -- profilerFiller.popPush("nextTickWait"); +- profilerFiller.push("nextTickWait"); - this.mayHaveDelayedTasks = true; - this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); - this.startMeasuringTaskExecutionTime(); @@ -349,18 +336,7 @@ index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785def - this.logFullTickTime(); - } 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.processPacketsAndTick(flag); + this.mayHaveDelayedTasks = true; + this.delayedTasksMaxNextTickTimeNanos = Math.max(Util.getNanos() + l, this.nextTickTimeNanos); + this.startMeasuringTaskExecutionTime(); @@ -375,15 +351,7 @@ index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785def this.isReady = true; JvmProfiler.INSTANCE.onServerTick(this.smoothedTickTimeMillis); } -@@ -1504,7 +1451,6 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0 && this.tickCount % autosavePeriod == 0; try { this.isSaving = true; -@@ -1679,10 +1622,9 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit // Paper start - optimise Folia entity scheduler -@@ -1790,9 +1726,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 0; // Purpur - Ridables -- profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().location()); +- profilerFiller.push(() -> serverLevel + " " + serverLevel.dimension().identifier()); /* Drop global time updates if (this.tickCount % 20 == 0) { - profilerFiller.push("timeSync"); @@ -477,7 +458,7 @@ index f29cee41258a8220256bf6b3b5b04f79c142cc19..9180e8cdd4bfad33f8dcda0ac8785def try { serverLevel.tick(hasTimeLeft); } catch (Throwable var7) { -@@ -1848,37 +1777,25 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop reloadableServerResources); diff --git a/net/minecraft/server/ServerAdvancementManager.java b/net/minecraft/server/ServerAdvancementManager.java -index a524f5b9aa082ada267c8e20df4ff4d22a76d281..339626862c33bca9cbc34acc520ba5d7831e189f 100644 +index 86e9b9d751c9c1f43e9fec4115773dfec773f163..c5fc43995752318a4adc09c4ec253a98b1803ea4 100644 --- a/net/minecraft/server/ServerAdvancementManager.java +++ b/net/minecraft/server/ServerAdvancementManager.java -@@ -17,7 +17,6 @@ import net.minecraft.resources.ResourceLocation; +@@ -16,7 +16,6 @@ import net.minecraft.resources.Identifier; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; import net.minecraft.util.ProblemReporter; -import net.minecraft.util.profiling.ProfilerFiller; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; - public class ServerAdvancementManager extends SimpleJsonResourceReloadListener { @@ -32,7 +31,7 @@ public class ServerAdvancementManager extends SimpleJsonResourceReloadListener object, ResourceManager resourceManager, ProfilerFiller profiler) { -+ protected void apply(Map object, ResourceManager resourceManager) { - Builder builder = ImmutableMap.builder(); - object.forEach((resourceLocation, advancement) -> { +- protected void apply(Map object, ResourceManager resourceManager, ProfilerFiller profiler) { ++ protected void apply(Map object, ResourceManager resourceManager) { + Builder builder = ImmutableMap.builder(); + object.forEach((identifier, advancement) -> { // Spigot start diff --git a/net/minecraft/server/ServerFunctionManager.java b/net/minecraft/server/ServerFunctionManager.java -index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b803d0c71 100644 +index 747e51132cfddc0c1d619dca81a4dd34605475bd..306bf89d21f6f2dd42710926c13089997d7de39c 100644 --- a/net/minecraft/server/ServerFunctionManager.java +++ b/net/minecraft/server/ServerFunctionManager.java -@@ -14,8 +14,6 @@ import net.minecraft.commands.execution.ExecutionContext; - import net.minecraft.commands.functions.CommandFunction; +@@ -15,8 +15,6 @@ import net.minecraft.commands.functions.CommandFunction; import net.minecraft.commands.functions.InstantiatedFunction; - import net.minecraft.resources.ResourceLocation; + import net.minecraft.resources.Identifier; + import net.minecraft.server.permissions.LevelBasedPermissionSet; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; public class ServerFunctionManager { -@@ -50,19 +48,12 @@ public class ServerFunctionManager { +@@ -51,19 +49,12 @@ public class ServerFunctionManager { } - private void executeTagFunctions(Collection> functionObjects, ResourceLocation identifier) { + private void executeTagFunctions(Collection> functionObjects, Identifier identifier) { - Profiler.get().push(identifier::toString); - for (CommandFunction commandFunction : functionObjects) { @@ -734,7 +715,7 @@ index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b try { InstantiatedFunction instantiatedFunction = function.instantiate(null, this.getDispatcher()); Commands.executeCommandInContext( -@@ -72,8 +63,6 @@ public class ServerFunctionManager { +@@ -73,8 +64,6 @@ public class ServerFunctionManager { } catch (FunctionInstantiationException var9) { } catch (Exception var10) { LOGGER.warn("Failed to execute function {}", function.id(), var10); @@ -745,10 +726,10 @@ index e3cb5d9cd0332c32df82fa6aef37401c523e8af0..10c79570432491bfb2bbfedf0491ab2b diff --git a/net/minecraft/server/commands/DebugCommand.java b/net/minecraft/server/commands/DebugCommand.java deleted file mode 100644 -index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..0000000000000000000000000000000000000000 +index 05fa05111a99e1d4b4f992c2349f43125e8b330f..0000000000000000000000000000000000000000 --- a/net/minecraft/server/commands/DebugCommand.java +++ /dev/null -@@ -1,277 +0,0 @@ +@@ -1,278 +0,0 @@ -package net.minecraft.server.commands; - -import com.mojang.brigadier.CommandDispatcher; @@ -766,7 +747,6 @@ index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..00000000000000000000000000000000 -import java.nio.file.Path; -import java.util.Collection; -import java.util.Locale; --import net.minecraft.Util; -import net.minecraft.commands.CommandResultCallback; -import net.minecraft.commands.CommandSource; -import net.minecraft.commands.CommandSourceStack; @@ -783,9 +763,11 @@ index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..00000000000000000000000000000000 -import net.minecraft.commands.functions.CommandFunction; -import net.minecraft.commands.functions.InstantiatedFunction; -import net.minecraft.network.chat.Component; --import net.minecraft.resources.ResourceLocation; +-import net.minecraft.resources.Identifier; -import net.minecraft.server.MinecraftServer; +-import net.minecraft.server.permissions.LevelBasedPermissionSet; -import net.minecraft.util.TimeUtil; +-import net.minecraft.util.Util; -import net.minecraft.util.profiling.ProfileResults; -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; @@ -802,12 +784,12 @@ index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..00000000000000000000000000000000 - public static void register(CommandDispatcher dispatcher) { - dispatcher.register( - Commands.literal("debug") -- .requires(Commands.hasPermission(3)) -- .then(Commands.literal("start").executes(commandContext -> start(commandContext.getSource()))) +- .requires(Commands.hasPermission(Commands.LEVEL_ADMINS)) +- .then(Commands.literal("start").executes(context -> start(context.getSource()))) - .then(Commands.literal("stop").executes(context -> stop(context.getSource()))) - .then( - Commands.literal("function") -- .requires(Commands.hasPermission(3)) +- .requires(Commands.hasPermission(Commands.LEVEL_ADMINS)) - .then( - Commands.argument("name", FunctionArgument.functions()) - .suggests(FunctionCommand.SUGGEST_FUNCTION) @@ -877,7 +859,7 @@ index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..00000000000000000000000000000000 - - for (final CommandFunction commandFunction : functions) { - try { -- CommandSourceStack commandSourceStack = source.withSource(tracer).withMaximumPermission(2); +- CommandSourceStack commandSourceStack = source.withSource(tracer).withMaximumPermission(LevelBasedPermissionSet.GAMEMASTER); - InstantiatedFunction instantiatedFunction = commandFunction.instantiate(null, dispatcher); - executionControl.queueNext((new CallFunction(instantiatedFunction, CommandResultCallback.EMPTY, false) { - @Override @@ -968,7 +950,7 @@ index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..00000000000000000000000000000000 - } - - @Override -- public void onCall(int depth, ResourceLocation function, int commands) { +- public void onCall(int depth, Identifier function, int commands) { - this.newLine(); - this.indentAndSave(depth); - this.output.print("[F] "); @@ -1027,20 +1009,10 @@ index 338b39ee5c9ca1de20a24a07aa3706e0cecdcb86..00000000000000000000000000000000 - } -} diff --git a/net/minecraft/server/commands/PerfCommand.java b/net/minecraft/server/commands/PerfCommand.java -index b10cb4a73df58a5fe64e88868733ba41616f59e4..9f9cbe6056f8a4eeca64c40872d7403bb0ddc600 100644 +index cdb4b00d636ba20e72b00dbb8cc34406819ac1b5..3d10ea9c7902d2e645c2f6fcf956b2c82c01c48a 100644 --- a/net/minecraft/server/commands/PerfCommand.java +++ b/net/minecraft/server/commands/PerfCommand.java -@@ -19,9 +19,6 @@ import net.minecraft.network.chat.Component; - import net.minecraft.server.MinecraftServer; - import net.minecraft.util.FileZipper; - import net.minecraft.util.TimeUtil; --import net.minecraft.util.profiling.EmptyProfileResults; --import net.minecraft.util.profiling.ProfileResults; --import net.minecraft.util.profiling.metrics.storage.MetricsPersister; - import org.apache.commons.io.FileUtils; - import org.slf4j.Logger; - -@@ -42,66 +39,22 @@ public class PerfCommand { +@@ -42,66 +42,22 @@ public class PerfCommand { } private static int startProfilingDedicatedServer(CommandSourceStack source) throws CommandSyntaxException { @@ -1118,10 +1090,10 @@ index b10cb4a73df58a5fe64e88868733ba41616f59e4..9f9cbe6056f8a4eeca64c40872d7403b + // DivineMC end - Completely remove Mojang profiler } diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index 49aa436abf89b16dc5249f37bf27b02b49d9e2e8..6a8f501883a5b5697d3ebf401f6b7aa6145479ea 100644 +index 6c02ab6c4076e8223229626754ed766b16537cfd..684ce31d079a6669028eb7d87628d823066e3da4 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -1045,12 +1045,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -1044,12 +1044,6 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface return this.settings.getProperties().serverResourcePackInfo; } @@ -1135,19 +1107,19 @@ index 49aa436abf89b16dc5249f37bf27b02b49d9e2e8..6a8f501883a5b5697d3ebf401f6b7aa6 public SampleLogger getTickTimeLogger() { return this.tickTimeLogger; diff --git a/net/minecraft/server/level/ChunkGenerationTask.java b/net/minecraft/server/level/ChunkGenerationTask.java -index 4221af18f5087badb5cd8c7cf66ab3312edf0394..e9d861182439eecacfab2ac431726e8adeaab3aa 100644 +index afb82b065b5a7dbffcdb5028b1e92815b9b5f72a..db6bef78f2afdc96ebd3ab15c98f01a22c29e0d6 100644 --- a/net/minecraft/server/level/ChunkGenerationTask.java +++ b/net/minecraft/server/level/ChunkGenerationTask.java -@@ -5,8 +5,6 @@ import java.util.List; +@@ -4,8 +4,6 @@ import java.util.ArrayList; + import java.util.List; import java.util.concurrent.CompletableFuture; - import javax.annotation.Nullable; import net.minecraft.util.StaticCache2D; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.Zone; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.ChunkAccess; import net.minecraft.world.level.chunk.status.ChunkDependencies; -@@ -67,7 +65,6 @@ public class ChunkGenerationTask { +@@ -65,7 +63,6 @@ public class ChunkGenerationTask { chunkStatus = ChunkStatus.getStatusList().get(this.scheduledStatus.getIndex() + 1); } @@ -1155,7 +1127,7 @@ index 4221af18f5087badb5cd8c7cf66ab3312edf0394..e9d861182439eecacfab2ac431726e8a this.scheduledStatus = chunkStatus; } -@@ -112,22 +109,6 @@ public class ChunkGenerationTask { +@@ -110,22 +107,6 @@ public class ChunkGenerationTask { return this.cache.get(this.pos.x, this.pos.z); } @@ -1179,19 +1151,19 @@ index 4221af18f5087badb5cd8c7cf66ab3312edf0394..e9d861182439eecacfab2ac431726e8a ChunkPyramid chunkPyramid = needsGeneration ? ChunkPyramid.GENERATION_PYRAMID : ChunkPyramid.LOADING_PYRAMID; return chunkPyramid.getStepTo(this.targetStatus).getAccumulatedRadiusOf(status); diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index e957ddea7c6cd9685e362a4b1adc09fdd3bfd359..188a62f00bd541f27adaaa4250b56276565f0d74 100644 +index 21738241221f4fc1504678f76851702fea84a70b..82e08606f04564de296cb224cfd9d07b586ba928 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -64,8 +64,6 @@ import net.minecraft.util.CsvOutput; - import net.minecraft.util.Mth; - import net.minecraft.util.StaticCache2D; +@@ -67,8 +67,6 @@ import net.minecraft.util.StaticCache2D; import net.minecraft.util.TriState; + import net.minecraft.util.Util; + import net.minecraft.util.datafix.DataFixTypes; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.thread.BlockableEventLoop; import net.minecraft.util.thread.ConsecutiveExecutor; import net.minecraft.world.entity.Entity; -@@ -413,15 +411,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -415,15 +413,10 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP } protected void tick(BooleanSupplier hasMoreTime) { @@ -1208,19 +1180,19 @@ index e957ddea7c6cd9685e362a4b1adc09fdd3bfd359..188a62f00bd541f27adaaa4250b56276 public boolean hasWork() { diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df981671e2 100644 +index 6106e79cdb3dc77b4848d1536801a40ec7f8991e..d58f05a6ffd7d445cdeae35bbe81fed9d52ee9f5 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -27,8 +27,6 @@ import net.minecraft.network.protocol.Packet; - import net.minecraft.network.protocol.game.ClientGamePacketListener; - import net.minecraft.server.MinecraftServer; +@@ -26,8 +26,6 @@ import net.minecraft.server.MinecraftServer; + import net.minecraft.util.FileUtil; + import net.minecraft.util.Util; import net.minecraft.util.VisibleForDebug; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.util.thread.BlockableEventLoop; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.MobCategory; -@@ -467,37 +465,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -461,37 +459,28 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // CraftBukkit start - modelled on below public void purgeUnload() { if (true) return; // Paper - rewrite chunk system @@ -1258,7 +1230,7 @@ index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df this.clearCache(); } -@@ -506,22 +495,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -500,22 +489,15 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon long l = gameTime - this.lastInhabitedUpdate; this.lastInhabitedUpdate = gameTime; if (!this.level.isDebug()) { @@ -1284,7 +1256,7 @@ index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df for (ChunkHolder chunkHolder : this.chunkHoldersToBroadcast) { LevelChunk tickingChunk = chunkHolder.getChunkToSend(); // Paper - rewrite chunk system if (tickingChunk != null) { -@@ -530,11 +512,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -524,11 +506,9 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } this.chunkHoldersToBroadcast.clear(); @@ -1297,7 +1269,7 @@ index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df int naturalSpawnChunkCount = this.distanceManager.getNaturalSpawnChunkCount(); // Paper start - Optional per player mob spawns NaturalSpawner.SpawnState spawnState; -@@ -580,16 +560,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -574,16 +554,13 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon List list = this.spawningChunks; try { @@ -1314,13 +1286,13 @@ index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df for (LevelChunk levelChunk : list) { this.tickSpawningChunk(levelChunk, timeInhabited, filteredSpawningCategories, spawnState); -@@ -598,14 +575,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -592,14 +569,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon list.clear(); } - profiler.popPush("tickTickingChunks"); - this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations - if (_boolean) { + this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimizations + if (flag) { - profiler.popPush("customSpawners"); this.level.tickCustomSpawners(this.spawnEnemies); } @@ -1329,7 +1301,7 @@ index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df } private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List spawnCategories, NaturalSpawner.SpawnState spawnState) { -@@ -826,7 +799,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -819,7 +792,6 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon @Override protected void doRunTask(Runnable task) { @@ -1338,10 +1310,10 @@ index d4858fe6a195acd17aea098401a5ee7baa5ad4d1..3aa09ea7498fb0d790cc47c66a8e89df } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb48e5a26b1 100644 +index c99ba8c3eba14efcf7906fe2b42e4db1c73c90fe..857a1ac427644a1f24a8564041ba3f41da540ef4 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -77,8 +77,6 @@ import net.minecraft.util.RandomSource; +@@ -75,8 +75,6 @@ import net.minecraft.util.Util; import net.minecraft.util.datafix.DataFixTypes; import net.minecraft.util.debug.DebugSubscriptions; import net.minecraft.util.debug.LevelDebugSynchronizers; @@ -1350,7 +1322,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 import net.minecraft.util.random.WeightedList; import net.minecraft.util.valueproviders.IntProvider; import net.minecraft.util.valueproviders.UniformInt; -@@ -753,16 +751,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -768,16 +766,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } public void tick(BooleanSupplier hasTimeLeft) { @@ -1366,8 +1338,8 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 - profilerFiller.pop(); } - int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); -@@ -796,30 +790,22 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + int i = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE); +@@ -811,30 +805,22 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.tickTime(); } @@ -1398,7 +1370,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 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 +@@ -845,11 +831,8 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } if (this.emptyTime < 300) { @@ -1410,7 +1382,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 } io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR -@@ -843,9 +826,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -858,9 +841,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity -> { if (!entity.isRemoved()) { if (!tickRateManager.isEntityFrozen(entity)) { @@ -1420,7 +1392,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 if (true) { // Paper - rewrite chunk system Entity vehicle = entity.getVehicle(); if (vehicle != null) { -@@ -856,23 +837,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -871,23 +852,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe entity.stopRiding(); } @@ -1444,25 +1416,25 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 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 +@@ -896,7 +870,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } this.debugSynchronizers.tick(this.server.debugSubscribers()); - profilerFiller.pop(); + this.environmentAttributes().invalidateTickCache(); } - @Override -@@ -896,9 +869,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -912,9 +885,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (this.tickTime) { long l = this.levelData.getGameTime() + 1L; this.serverLevelData.setGameTime(l); - Profiler.get().push("scheduledFunctions"); this.serverLevelData.getScheduledEvents().tick(this.server, l); - Profiler.get().pop(); - if (this.serverLevelData.getGameRules().getBoolean(GameRules.RULE_DAYLIGHT)) { + if (this.getGameRules().get(GameRules.ADVANCE_TIME)) { // Purpur start - Configurable daylight cycle int incrementTicks = isBrightOutside() ? this.purpurConfig.daytimeTicks : this.purpurConfig.nighttimeTicks; -@@ -998,8 +969,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1018,8 +989,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ChunkPos pos = chunk.getPos(); int minBlockX = pos.getMinBlockX(); int minBlockZ = pos.getMinBlockZ(); @@ -1471,7 +1443,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 if (!this.paperConfig().environment.disableIceAndSnow) { // Paper - Option to disable ice and snow for (int i = 0; i < randomTickSpeed; i++) { -@@ -1009,12 +978,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1029,12 +998,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } // Paper - Option to disable ice and snow @@ -1484,7 +1456,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 } public void tickThunder(LevelChunk chunk) { -@@ -1022,8 +988,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1042,8 +1008,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe boolean isRaining = this.isRaining(); int minBlockX = pos.getMinBlockX(); int minBlockZ = pos.getMinBlockZ(); @@ -1493,7 +1465,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 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)) { -@@ -1057,8 +1021,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1077,8 +1041,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } } } @@ -1502,7 +1474,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 } @VisibleForTesting -@@ -1402,17 +1364,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1440,17 +1402,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } // Paper end - log detailed entity tick information entity.setOldPosAndRot(); @@ -1520,7 +1492,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 -@@ -1433,9 +1391,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1471,9 +1429,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe passengerEntity.setOldPosAndRot(); passengerEntity.tickCount++; passengerEntity.totalEntityAge++; // Paper - age-like counter for all entities @@ -1530,7 +1502,7 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 // Paper start - EAR 2 if (isActive) { passengerEntity.rideTick(); -@@ -1447,7 +1402,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1485,7 +1440,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ridingEntity.positionRider(passengerEntity); } // Paper end - EAR 2 @@ -1539,19 +1511,19 @@ index 80492a11d5cc30d93a553a47bafda879c71ceab2..a7580688febcb5afaca90320101dadb4 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 6fd0803b266982daf12096cfab2ee92347d72e8a..b1667ed08c417daf292e092ca0d2ab9848ac8d61 100644 +index bf27843ac3a1b914aea602abeeee0c780e6e7c30..e662869de396db5d2481b86146096e0b262ab94f 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -110,8 +110,6 @@ import net.minecraft.util.Mth; - import net.minecraft.util.ProblemReporter; +@@ -105,8 +105,6 @@ import net.minecraft.util.ProblemReporter; import net.minecraft.util.Unit; + import net.minecraft.util.Util; 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; -@@ -1569,20 +1567,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1567,20 +1565,15 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc this.portalProcess = null; // SPIGOT-7785: there is no need to carry this over as it contains the old world/location and we might run into trouble if there is a portal in the same spot in both worlds serverLevel.removePlayerImmediately(this, Entity.RemovalReason.CHANGED_DIMENSION); this.unsetRemoved(); @@ -1573,17 +1545,17 @@ index 6fd0803b266982daf12096cfab2ee92347d72e8a..b1667ed08c417daf292e092ca0d2ab98 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 e98400719a4ab43dc0ce90cdca19ba86e4849720..4a333e87af17bd5b673b57c0fa0d3a239fb8db59 100644 +index 02c6733ce1de543dab3bf558148879039e501257..9b7dc6b3b1037fb2aa285c33537e9b5c342cdb39 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -27,7 +27,6 @@ import net.minecraft.server.MinecraftServer; - import net.minecraft.server.level.ClientInformation; +@@ -26,7 +26,6 @@ import net.minecraft.server.level.ClientInformation; import net.minecraft.server.players.NameAndId; + import net.minecraft.util.Util; import net.minecraft.util.VisibleForDebug; -import net.minecraft.util.profiling.Profiler; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; - public abstract class ServerCommonPacketListenerImpl implements ServerCommonPacketListener { @@ -284,7 +283,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack } @@ -1602,13 +1574,13 @@ index e98400719a4ab43dc0ce90cdca19ba86e4849720..4a333e87af17bd5b673b57c0fa0d3a23 private boolean checkIfClosed(long time) { diff --git a/net/minecraft/server/packs/resources/ProfiledReloadInstance.java b/net/minecraft/server/packs/resources/ProfiledReloadInstance.java -index 76d57e89c1367c745b031c0bfcb2cf872b383af7..a3fd9fa365340455dbf000ab138a8e3c7a855e25 100644 +index 524a7029b5080e4ec08136cdc40e195a8a8fd8e4..7e63744b6846a719921afc73ef0ac041998be8ca 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; import java.util.concurrent.atomic.AtomicLong; - import net.minecraft.Util; import net.minecraft.util.Unit; + import net.minecraft.util.Util; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; @@ -1653,24 +1625,24 @@ index ea99b9f766dbeeb625523334fb53fb5a9e040497..a5479b67006e0f083078a7af2dde0c3d } diff --git a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java -index 16bab14884a5a7b8d7659379f5b7ea90aa9bd737..a2320c37e4ef495eae7a1978aa7c7dc642aefdf9 100644 +index cac326043f80847d1bb3a9e68536c6dc67f8b1f6..c74243e5ad82f764027930c24c825c0d40fedad1 100644 --- a/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java +++ b/net/minecraft/server/packs/resources/SimpleJsonResourceReloadListener.java @@ -17,7 +17,6 @@ import net.minecraft.resources.FileToIdConverter; + import net.minecraft.resources.Identifier; import net.minecraft.resources.ResourceKey; - import net.minecraft.resources.ResourceLocation; import net.minecraft.util.StrictJsonParser; -import net.minecraft.util.profiling.ProfilerFiller; import org.slf4j.Logger; - public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { + public abstract class SimpleJsonResourceReloadListener extends SimplePreparableReloadListener> { @@ -41,7 +40,7 @@ public abstract class SimpleJsonResourceReloadListener extends SimplePreparab } @Override -- protected Map prepare(ResourceManager resourceManager, ProfilerFiller profiler) { -+ protected Map prepare(ResourceManager resourceManager) { - Map map = new HashMap<>(); +- protected Map prepare(ResourceManager resourceManager, ProfilerFiller profiler) { ++ protected Map prepare(ResourceManager resourceManager) { + Map map = new HashMap<>(); 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 @@ -1704,17 +1676,11 @@ index 6e07a06234b34250087e70e18be22a526417fa80..ff5e508838340ee575d83216e3340072 + protected abstract void apply(T object, ResourceManager resourceManager); } diff --git a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -index f4aa10bbd98f514f27224346b3b9332f2218602d..ff319fa2ddea43d5b3c55897b1aaaf9fe137abbc 100644 +index 49ea56f2238277c0f09cced41d3b4a1f4bf5ac73..da3760683b10701e793d9743cd7eca7ecefce73a 100644 --- a/net/minecraft/util/thread/AbstractConsecutiveExecutor.java +++ b/net/minecraft/util/thread/AbstractConsecutiveExecutor.java -@@ -7,13 +7,9 @@ import java.util.concurrent.Executor; - import java.util.concurrent.RejectedExecutionException; - import java.util.concurrent.atomic.AtomicReference; - import net.minecraft.Util; --import net.minecraft.util.profiling.metrics.MetricCategory; --import net.minecraft.util.profiling.metrics.MetricSampler; --import net.minecraft.util.profiling.metrics.MetricsRegistry; --import net.minecraft.util.profiling.metrics.ProfilerMeasured; +@@ -13,7 +13,7 @@ import net.minecraft.util.profiling.metrics.MetricsRegistry; + import net.minecraft.util.profiling.metrics.ProfilerMeasured; import org.slf4j.Logger; -public abstract class AbstractConsecutiveExecutor implements ProfilerMeasured, TaskScheduler, Runnable { @@ -1722,7 +1688,7 @@ index f4aa10bbd98f514f27224346b3b9332f2218602d..ff319fa2ddea43d5b3c55897b1aaaf9f private static final Logger LOGGER = LogUtils.getLogger(); private final AtomicReference status = new AtomicReference<>(AbstractConsecutiveExecutor.Status.SLEEPING); private final StrictQueue queue; -@@ -24,7 +20,6 @@ public abstract class AbstractConsecutiveExecutor implements +@@ -24,7 +24,6 @@ public abstract class AbstractConsecutiveExecutor implements this.executor = executor; this.queue = queue; this.name = name; @@ -1730,7 +1696,7 @@ index f4aa10bbd98f514f27224346b3b9332f2218602d..ff319fa2ddea43d5b3c55897b1aaaf9f } private boolean canBeScheduled() { -@@ -108,11 +103,6 @@ public abstract class AbstractConsecutiveExecutor implements +@@ -108,11 +107,6 @@ public abstract class AbstractConsecutiveExecutor implements return this.name; } @@ -1743,7 +1709,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 ef29b33db3a665621f35a7480892c65fd9045a5a..e22b658f90d48ef59b5e7b4d0278f2ba7e05ee51 100644 +index cf7dcb2e02a1cc8019bb9380a3cf9ba2a06f4ff0..285e9be79e68b2a2430c9d864dfa17e4df2885dc 100644 --- a/net/minecraft/util/thread/BlockableEventLoop.java +++ b/net/minecraft/util/thread/BlockableEventLoop.java @@ -15,13 +15,9 @@ import java.util.function.Supplier; @@ -1769,7 +1735,7 @@ index ef29b33db3a665621f35a7480892c65fd9045a5a..e22b658f90d48ef59b5e7b4d0278f2ba } // Paper start -@@ -182,11 +177,6 @@ public abstract class BlockableEventLoop implements Profiler +@@ -183,11 +178,6 @@ public abstract class BlockableEventLoop implements Profiler } } @@ -1799,10 +1765,10 @@ index 39a604c9a53930b53d959b1d2eb504aa964e9a58..0d0380e3955836ce125f777841477503 @Override diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313083e9a57 100644 +index d2542c2bd15d274f9844c731a2e2b388a318ee4c..c1fff7f3d74a804d9608e3ff78386f49845b8f59 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -82,8 +82,6 @@ import net.minecraft.util.RandomSource; +@@ -83,8 +83,6 @@ import net.minecraft.util.Util; import net.minecraft.util.debug.DebugEntityBlockIntersection; import net.minecraft.util.debug.DebugSubscriptions; import net.minecraft.util.debug.DebugValueSource; @@ -1811,16 +1777,16 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.Nameable; -@@ -879,8 +877,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -884,8 +882,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name // CraftBukkit end public void baseTick() { - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("entityBaseTick"); if (firstTick && this instanceof net.minecraft.world.entity.NeutralMob neutralMob) neutralMob.tickInitialPersistentAnger(level); // Paper - Prevent entity loading causing async lookups + this.computeSpeed(); this.inBlockState = null; - if (this.isPassenger() && this.getVehicle().isRemoved()) { -@@ -934,8 +930,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -940,8 +936,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name if (this.level() instanceof ServerLevel serverLevelx && this instanceof Leashable) { Leashable.tickLeash(serverLevelx, (Entity & Leashable)this); } @@ -1828,8 +1794,8 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 - profilerFiller.pop(); } - public void setSharedFlagOnFire(boolean isOnFire) { -@@ -1161,8 +1155,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name + protected void computeSpeed() { +@@ -1176,8 +1170,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } } @@ -1838,7 +1804,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 if (this.stuckSpeedMultiplier.lengthSqr() > 1.0E-7) { if (type != MoverType.PISTON) { movement = movement.multiply(this.stuckSpeedMultiplier); -@@ -1174,7 +1166,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1189,7 +1181,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); @@ -1846,7 +1812,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 return; } // Paper end -@@ -1199,8 +1190,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1214,8 +1205,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.setPos(vec33); } @@ -1855,7 +1821,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 boolean flag = !Mth.equal(movement.x, vec3.x); boolean flag1 = !Mth.equal(movement.z, vec3.z); this.horizontalCollision = flag || flag1; -@@ -1223,7 +1212,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1238,7 +1227,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } if (this.isRemoved()) { @@ -1863,7 +1829,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 } else { if (this.horizontalCollision) { Vec3 deltaMovement = this.getDeltaMovement(); -@@ -1267,7 +1255,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1282,7 +1270,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name float blockSpeedFactor = this.getBlockSpeedFactor(); this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); @@ -1871,7 +1837,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 } } // Paper start - detailed watchdog information -@@ -3532,8 +3519,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -3553,8 +3540,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.processPortalCooldown(); if (this.portalProcess != null) { if (this.portalProcess.processPortalTeleportation(serverLevel, this, this.canUsePortal(false))) { @@ -1880,7 +1846,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 this.setPortalCooldown(); TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this); if (portalDestination != null) { -@@ -3543,8 +3528,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -3566,8 +3551,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.teleport(portalDestination); } } @@ -1889,7 +1855,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } -@@ -4111,15 +4094,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4132,15 +4115,12 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name entity.teleport(this.calculatePassengerTransition(teleportTransition, entity)); } @@ -1905,7 +1871,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 return this; } -@@ -4136,11 +4116,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4156,11 +4136,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } } @@ -1917,7 +1883,7 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 return null; } else { // Paper start - Fix item duplication and teleport issues -@@ -4160,7 +4137,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4180,7 +4157,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name newLevel.resetEmptyTime(); teleportTransition.postTeleportTransition().onTransition(entityx); this.teleportSpectators(teleportTransition, oldLevel); @@ -1926,13 +1892,13 @@ index 6093e359be40d8df52e29f63d10aa9629850e826..dc558a32d0cf2d1e2d5cbb09a9377313 } } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e719e05665a 100644 +index 1dccf3208160e8fe531febb6d448fd55777e11c0..c37daba105fec721e39d35fdbb22d06b6af3226f 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -70,8 +70,6 @@ import net.minecraft.tags.FluidTags; - import net.minecraft.tags.ItemTags; - import net.minecraft.tags.TagKey; +@@ -70,8 +70,6 @@ import net.minecraft.tags.TagKey; + import net.minecraft.util.BlockUtil; import net.minecraft.util.Mth; + import net.minecraft.util.Util; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.Difficulty; @@ -1955,7 +1921,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 } protected boolean shouldTakeDrowningDamage() { -@@ -3412,11 +3407,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3487,11 +3482,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin f1 = this.getYRot(); } @@ -1967,7 +1933,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 // Paper start - stop large pitch and yaw changes from crashing the server this.yRotO += Math.round((this.getYRot() - this.yRotO) / 360.0F) * 360.0F; -@@ -3428,7 +3419,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3503,7 +3494,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 @@ -1975,7 +1941,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 if (this.isFallFlying()) { this.fallFlyTicks++; } else { -@@ -3604,21 +3594,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3734,21 +3724,15 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin } this.setDeltaMovement(d, d1, d2); @@ -1997,7 +1963,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 if (this.jumping && this.isAffectedByFluids()) { double fluidHeight; if (this.isInLava()) { -@@ -3647,8 +3631,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3777,8 +3761,6 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin this.noJumpDelay = 0; } @@ -2006,7 +1972,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 if (this.isFallFlying()) { this.updateFallFlying(); } -@@ -3673,9 +3655,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3803,9 +3785,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin this.calculateEntityAnimation(this instanceof FlyingAnimal); } @@ -2016,7 +1982,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 if ((!this.isInPowderSnow || !this.canFreeze()) && !this.freezeLocked) { // Paper - Freeze Tick Lock API this.setTicksFrozen(Math.max(0, this.getTicksFrozen() - 2)); } -@@ -3685,18 +3665,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3815,18 +3795,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); } @@ -2036,7 +2002,7 @@ index 9955a41d21345faad05843ee1b17321c3330f5d0..09987dac80cd031f7af0b63db50f5e71 // 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 9c5336e47757879465679e27faf1f63c07952f56..b2853b6a3bca0ea04c50fedf5e2f5ff633ac2a21 100644 +index 615293655410eeb9b330ec4f0d4d18bb318d33fb..64b12c6617e4a787c614f0c9c1bf2ba704f45d17 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java @@ -31,8 +31,6 @@ import net.minecraft.util.debug.DebugGoalInfo; @@ -2048,7 +2014,7 @@ index 9c5336e47757879465679e27faf1f63c07952f56..b2853b6a3bca0ea04c50fedf5e2f5ff6 import net.minecraft.world.Container; import net.minecraft.world.Difficulty; import net.minecraft.world.DifficultyInstance; -@@ -332,8 +330,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -329,8 +327,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void baseTick() { super.baseTick(); @@ -2057,7 +2023,7 @@ index 9c5336e47757879465679e27faf1f63c07952f56..b2853b6a3bca0ea04c50fedf5e2f5ff6 if (this.isAlive() && this.random.nextInt(1000) < this.ambientSoundTime++) { this.resetAmbientSoundTime(); this.playAmbientSound(); -@@ -341,7 +337,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -338,7 +334,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 @@ -2066,9 +2032,9 @@ index 9c5336e47757879465679e27faf1f63c07952f56..b2853b6a3bca0ea04c50fedf5e2f5ff6 } @@ -550,8 +545,6 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - @Override - public void aiStep() { - super.aiStep(); + this.burnUndead(); + }*/ // Purpur end - implemented in LivingEntity - API for any mob to burn daylight + - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("looting"); if (this.level() instanceof ServerLevel serverLevel @@ -2082,8 +2048,8 @@ index 9c5336e47757879465679e27faf1f63c07952f56..b2853b6a3bca0ea04c50fedf5e2f5ff6 - profilerFiller.pop(); } - protected Vec3i getPickupReach() { -@@ -791,42 +782,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + protected EquipmentSlot sunProtectionSlot() { +@@ -819,42 +810,21 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab return; } // Paper end - Allow nerfed mobs to jump and float @@ -2181,10 +2147,10 @@ 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 05943450baa0a04ac433c39fdbe80e7abd191363..17d2a937ab6f325295c0b5b9b0a681952d4bce85 100644 +index 61c7ca1d262098583d40b78e22db8fa67cf1dec2..9d145a526d797e2fac5a72d376e67c1e2b62573f 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -12,8 +12,6 @@ import net.minecraft.tags.BlockTags; +@@ -11,8 +11,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.debug.DebugSubscriptions; import net.minecraft.util.debug.ServerDebugSubscribers; @@ -2193,7 +2159,7 @@ index 05943450baa0a04ac433c39fdbe80e7abd191363..17d2a937ab6f325295c0b5b9b0a68195 import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.Attributes; -@@ -195,13 +193,10 @@ public abstract class PathNavigation { +@@ -181,13 +179,10 @@ public abstract class PathNavigation { } } // Paper end - EntityPathfindEvent @@ -2231,38 +2197,11 @@ index c569074403b1d8b443aaa98ba9cf9bbd0e98bd2d..b1aa7294f9479f45fcde77c5ea46db9f if (hasLineOfSight) { this.seen.add(id); } else { -diff --git a/net/minecraft/world/entity/animal/HappyGhast.java b/net/minecraft/world/entity/animal/HappyGhast.java -index e85f17f362548f13a414a41f711900add788b2f7..0506db902dab8c15e6460b5049d388f7af561628 100644 ---- a/net/minecraft/world/entity/animal/HappyGhast.java -+++ b/net/minecraft/world/entity/animal/HappyGhast.java -@@ -13,8 +13,6 @@ import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.Mth; --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.damagesource.DamageSource; -@@ -430,13 +428,8 @@ public class HappyGhast extends Animal { - @Override - protected void customServerAiStep(ServerLevel level) { - if (this.isBaby()) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("happyGhastBrain"); - ((Brain)this.brain).tick(level, this); -- profilerFiller.pop(); -- profilerFiller.push("happyGhastActivityUpdate"); - HappyGhastAi.updateActivity(this); -- profilerFiller.pop(); - } - - this.checkRestriction(); diff --git a/net/minecraft/world/entity/animal/allay/Allay.java b/net/minecraft/world/entity/animal/allay/Allay.java -index bbe59d6ab90f1b1274289ef20811f914afa55fd3..c8487029d5707d75b83aebc6fab7c65391f102f9 100644 +index ea7666cc10aee49e13dbdd6e3367fabaa0dcbc17..9e0fe52c81f764843580ebb5fe6a5bd6b2522794 100644 --- a/net/minecraft/world/entity/animal/allay/Allay.java +++ b/net/minecraft/world/entity/animal/allay/Allay.java -@@ -24,8 +24,6 @@ import net.minecraft.tags.GameEventTags; +@@ -23,8 +23,6 @@ import net.minecraft.tags.GameEventTags; import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; @@ -2271,7 +2210,7 @@ index bbe59d6ab90f1b1274289ef20811f914afa55fd3..c8487029d5707d75b83aebc6fab7c653 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) { @@ -2287,10 +2226,10 @@ index bbe59d6ab90f1b1274289ef20811f914afa55fd3..c8487029d5707d75b83aebc6fab7c653 } diff --git a/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index 1ad2b942b3e9ba25c75d41b4cd21a58d43002289..a1cc92829b75200d6a66b52ed6ecc58343e91102 100644 +index 8502205994ecf28b1b791195088d183d7574760f..4bf6144e822e201d9c2e009c1ac8d332ae02518b 100644 --- a/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -22,8 +22,6 @@ import net.minecraft.util.ByIdMap; +@@ -21,8 +21,6 @@ import net.minecraft.util.ByIdMap; import net.minecraft.util.RandomSource; import net.minecraft.util.StringRepresentable; import net.minecraft.util.TimeUtil; @@ -2299,7 +2238,7 @@ index 1ad2b942b3e9ba25c75d41b4cd21a58d43002289..a1cc92829b75200d6a66b52ed6ecc583 import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; import net.minecraft.world.damagesource.DamageSource; -@@ -162,13 +160,8 @@ public class Armadillo extends Animal { +@@ -161,11 +159,7 @@ public class Armadillo extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -2309,24 +2248,13 @@ index 1ad2b942b3e9ba25c75d41b4cd21a58d43002289..a1cc92829b75200d6a66b52ed6ecc583 - profilerFiller.pop(); - profilerFiller.push("armadilloActivityUpdate"); ArmadilloAi.updateActivity(this); -- profilerFiller.pop(); - if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { - this.forceDrops = true; // CraftBukkit - if (this.dropFromGiftLootTable(level, BuiltInLootTables.ARMADILLO_SHED, this::spawnAtLocation)) { + profilerFiller.pop(); + if (this.isAlive() && --this.scuteTime <= 0 && this.shouldDropLoot(level)) { diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index 3cc8ee115e889ced4457596b9c5fce438157e980..a952e78ac0c1fa7a2728fc3036b93e69e2fefb8d 100644 +index e5ac43bf5631254c31d91abb1c5de408807429dd..73ff138007002a6203b6a0df88d34d26f025a827 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -30,8 +30,6 @@ import net.minecraft.util.ByIdMap; - 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.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -374,14 +372,9 @@ public class Axolotl extends Animal implements Bucketable { +@@ -372,14 +372,9 @@ public class Axolotl extends Animal implements Bucketable { @Override protected void customServerAiStep(ServerLevel level) { @@ -2342,10 +2270,10 @@ index 3cc8ee115e889ced4457596b9c5fce438157e980..a952e78ac0c1fa7a2728fc3036b93e69 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 cc71c575a8fb62c41198c6e1f27bd0e88380f5bc..efe34d1510d96f91821abb36ed2957b388dcd7bd 100644 +index 842b20242c323572d4c04d3a2d5fe21a54d53ed4..1f5ab385e780fc4c4242be3559ca36e3da364775 100644 --- a/net/minecraft/world/entity/animal/camel/Camel.java +++ b/net/minecraft/world/entity/animal/camel/Camel.java -@@ -17,8 +17,6 @@ import net.minecraft.tags.BlockTags; +@@ -16,8 +16,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; @@ -2369,39 +2297,11 @@ index cc71c575a8fb62c41198c6e1f27bd0e88380f5bc..efe34d1510d96f91821abb36ed2957b3 super.customServerAiStep(level); } -diff --git a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java -index 739deece6ae077b8fa1694eb6cc6ed9996dff09b..11b0b5fceeb503dbf5605fceddebfc9c08a629ab 100644 ---- a/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java -+++ b/net/minecraft/world/entity/animal/coppergolem/CopperGolem.java -@@ -14,8 +14,6 @@ import net.minecraft.sounds.SoundEvents; - import net.minecraft.sounds.SoundSource; - import net.minecraft.tags.ItemTags; - import net.minecraft.util.RandomSource; --import net.minecraft.util.profiling.Profiler; --import net.minecraft.util.profiling.ProfilerFiller; - import net.minecraft.world.DifficultyInstance; - import net.minecraft.world.InteractionHand; - import net.minecraft.world.InteractionResult; -@@ -245,14 +243,9 @@ public class CopperGolem extends AbstractGolem implements ContainerUser, Shearab - - @Override - protected void customServerAiStep(ServerLevel level) { -- ProfilerFiller profilerFiller = Profiler.get(); -- profilerFiller.push("copperGolemBrain"); - if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider - this.getBrain().tick(level, this); -- profilerFiller.pop(); -- profilerFiller.push("copperGolemActivityUpdate"); - CopperGolemAi.updateActivity(this); -- profilerFiller.pop(); - super.customServerAiStep(level); - } - diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index 78863bd593acaa46f33a49fadbd0cdb025074c11..7643e8d1b89a23354c27395509407c20e3d93b69 100644 +index 7d6dbdef68b25e774b5a83bb8aeb2535246459aa..62de0bd9fce5c6abc168df34f9eda357b789d049 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -27,8 +27,6 @@ import net.minecraft.tags.ItemTags; +@@ -26,8 +26,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -2410,7 +2310,7 @@ index 78863bd593acaa46f33a49fadbd0cdb025074c11..7643e8d1b89a23354c27395509407c20 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.AgeableMob; -@@ -260,14 +258,9 @@ public class Frog extends Animal { +@@ -259,14 +257,9 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -2426,10 +2326,10 @@ index 78863bd593acaa46f33a49fadbd0cdb025074c11..7643e8d1b89a23354c27395509407c20 } diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index 13b44b9560d46b351c4751aab189cc01c61d768d..37b1674c3f89d7ddba054b066df957f3337f4a89 100644 +index ae65292c9be65894532f11833c68e68970dbb257..f712a189107c1bcde82126f96c087b3520cf2dd3 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -11,8 +11,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -10,8 +10,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.ItemTags; @@ -2454,10 +2354,10 @@ index 13b44b9560d46b351c4751aab189cc01c61d768d..37b1674c3f89d7ddba054b066df957f3 } diff --git a/net/minecraft/world/entity/animal/goat/Goat.java b/net/minecraft/world/entity/animal/goat/Goat.java -index a226956bc47c5f6145c0dd4d3f957be43e60272b..674d3d69c797ef3ca5934466806831b2cbcbb93a 100644 +index 64916356de4b9981e04c5befef15b067914f6d75..95ea226cde95155ddfdc87763af368ac11a644e6 100644 --- a/net/minecraft/world/entity/animal/goat/Goat.java +++ b/net/minecraft/world/entity/animal/goat/Goat.java -@@ -19,8 +19,6 @@ import net.minecraft.tags.ItemTags; +@@ -18,8 +18,6 @@ import net.minecraft.tags.ItemTags; import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; @@ -2466,7 +2366,7 @@ index a226956bc47c5f6145c0dd4d3f957be43e60272b..674d3d69c797ef3ca5934466806831b2 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) { @@ -2481,6 +2381,115 @@ index a226956bc47c5f6145c0dd4d3f957be43e60272b..674d3d69c797ef3ca5934466806831b2 super.customServerAiStep(level); } +diff --git a/net/minecraft/world/entity/animal/golem/CopperGolem.java b/net/minecraft/world/entity/animal/golem/CopperGolem.java +index 4f92ac01a6d362a7ef748b74b75773575970859f..bd272670c6b5c51efd057d925086c4fcfc038259 100644 +--- a/net/minecraft/world/entity/animal/golem/CopperGolem.java ++++ b/net/minecraft/world/entity/animal/golem/CopperGolem.java +@@ -13,8 +13,6 @@ import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.RandomSource; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.InteractionHand; + import net.minecraft.world.InteractionResult; +@@ -242,14 +240,9 @@ public class CopperGolem extends AbstractGolem implements ContainerUser, Shearab + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("copperGolemBrain"); + if (getRider() == null || !this.isControllable()) // Purpur - only use brain if no rider + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("copperGolemActivityUpdate"); + CopperGolemAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java +index 8034ce67266b6baab35c72eaebf5ad67fc1a29c6..856ef72aaf9a076609c29bce743c62dbd7edb4d6 100644 +--- a/net/minecraft/world/entity/animal/happyghast/HappyGhast.java ++++ b/net/minecraft/world/entity/animal/happyghast/HappyGhast.java +@@ -12,8 +12,6 @@ import net.minecraft.sounds.SoundEvents; + import net.minecraft.sounds.SoundSource; + import net.minecraft.tags.ItemTags; + import net.minecraft.util.Mth; +-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.damagesource.DamageSource; +@@ -429,13 +427,8 @@ public class HappyGhast extends Animal { + @Override + protected void customServerAiStep(ServerLevel level) { + if (this.isBaby()) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("happyGhastBrain"); + ((Brain)this.brain).tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("happyGhastActivityUpdate"); + HappyGhastAi.updateActivity(this); +- profilerFiller.pop(); + } + + this.checkRestriction(); +diff --git a/net/minecraft/world/entity/animal/nautilus/Nautilus.java b/net/minecraft/world/entity/animal/nautilus/Nautilus.java +index a941cb9843fcf8d008ae846dcab95e32d823a1b2..ae42f77f9beff8ecee778252b52fce995c98e0b7 100644 +--- a/net/minecraft/world/entity/animal/nautilus/Nautilus.java ++++ b/net/minecraft/world/entity/animal/nautilus/Nautilus.java +@@ -4,8 +4,6 @@ import com.mojang.serialization.Dynamic; + import net.minecraft.server.level.ServerLevel; + import net.minecraft.sounds.SoundEvent; + import net.minecraft.sounds.SoundEvents; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AgeableMob; + import net.minecraft.world.entity.EntitySpawnReason; +@@ -56,13 +54,8 @@ public class Nautilus extends AbstractNautilus { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("nautilusBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("nautilusActivityUpdate"); + NautilusAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + +diff --git a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java +index 9e2b703d23a044fecdbc544588079c345fd376c7..80ab49d0e1c705353bb754d9e94dc100093303a3 100644 +--- a/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java ++++ b/net/minecraft/world/entity/animal/nautilus/ZombieNautilus.java +@@ -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; +-import net.minecraft.util.profiling.Profiler; +-import net.minecraft.util.profiling.ProfilerFiller; + import net.minecraft.world.DifficultyInstance; + import net.minecraft.world.damagesource.DamageSource; + import net.minecraft.world.entity.AgeableMob; +@@ -81,13 +79,8 @@ public class ZombieNautilus extends AbstractNautilus { + + @Override + protected void customServerAiStep(ServerLevel level) { +- ProfilerFiller profilerFiller = Profiler.get(); +- profilerFiller.push("zombieNautilusBrain"); + this.getBrain().tick(level, this); +- profilerFiller.pop(); +- profilerFiller.push("zombieNautilusActivityUpdate"); + ZombieNautilusAi.updateActivity(this); +- profilerFiller.pop(); + super.customServerAiStep(level); + } + diff --git a/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/net/minecraft/world/entity/animal/sniffer/Sniffer.java index 7ef3c94f63c8a25d09e69b818ecdf79795803570..6f08f08c53831dd5b68e06a4a6aee95204334a3b 100644 --- a/net/minecraft/world/entity/animal/sniffer/Sniffer.java @@ -2509,10 +2518,10 @@ index 7ef3c94f63c8a25d09e69b818ecdf79795803570..6f08f08c53831dd5b68e06a4a6aee952 } diff --git a/net/minecraft/world/entity/monster/Zoglin.java b/net/minecraft/world/entity/monster/Zoglin.java -index e2bf2bc45e4f8236ab47cf28c270dad748f80b50..2dac039f711d69295a749cd354128cdf8dfdc4c7 100644 +index d6de61ed4415cd00858375406567ea9407030e1e..47c56ae6dc62b0f72d7721ef1685ab279b8db0cb 100644 --- a/net/minecraft/world/entity/monster/Zoglin.java +++ b/net/minecraft/world/entity/monster/Zoglin.java -@@ -13,8 +13,6 @@ import net.minecraft.network.syncher.SynchedEntityData; +@@ -12,8 +12,6 @@ import net.minecraft.network.syncher.SynchedEntityData; import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; @@ -2521,7 +2530,7 @@ index e2bf2bc45e4f8236ab47cf28c270dad748f80b50..2dac039f711d69295a749cd354128cdf 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) { @@ -2534,10 +2543,10 @@ index e2bf2bc45e4f8236ab47cf28c270dad748f80b50..2dac039f711d69295a749cd354128cdf } diff --git a/net/minecraft/world/entity/monster/breeze/Breeze.java b/net/minecraft/world/entity/monster/breeze/Breeze.java -index 405eb5f041bf3a611f8111fd58864ffec30ab0c0..9ef421dfbb2d8d26d4a01d130dcbf3a6708890e9 100644 +index 6f22312d0a5ab38be4a07b93fdb29b7f36f67c71..7980537bed5aff4ef832aa0a4300f9d2cc857383 100644 --- a/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -14,8 +14,6 @@ import net.minecraft.tags.EntityTypeTags; +@@ -13,8 +13,6 @@ import net.minecraft.tags.EntityTypeTags; import net.minecraft.util.debug.DebugBreezeInfo; import net.minecraft.util.debug.DebugSubscriptions; import net.minecraft.util.debug.DebugValueSource; @@ -2561,10 +2570,10 @@ index 405eb5f041bf3a611f8111fd58864ffec30ab0c0..9ef421dfbb2d8d26d4a01d130dcbf3a6 } diff --git a/net/minecraft/world/entity/monster/creaking/Creaking.java b/net/minecraft/world/entity/monster/creaking/Creaking.java -index 6ab590b428e1a694b2538c53fabae9297b58b868..6ea2d7732eaf5eb99484834847f62858226c9879 100644 +index a84edd4953e59daed6816531545a6ec1c914bce6..6faf372eaaf8013e0a69c408ce82392b27c8bb3b 100644 --- a/net/minecraft/world/entity/monster/creaking/Creaking.java +++ b/net/minecraft/world/entity/monster/creaking/Creaking.java -@@ -15,8 +15,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -14,8 +14,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.tags.DamageTypeTags; @@ -2585,10 +2594,10 @@ index 6ab590b428e1a694b2538c53fabae9297b58b868..6ea2d7732eaf5eb99484834847f62858 } diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 72dc725b8cd6a2fca26aae376f91ab3e246a810b..1abc4d0de2ff983fc0c30bbc8a356d78f1c23897 100644 +index 460640f5512be6553f1ec69e20e27c7cc797068b..81cca68abdf5fa2e176d0121785bbdeed44377a7 100644 --- a/net/minecraft/world/entity/monster/hoglin/Hoglin.java +++ b/net/minecraft/world/entity/monster/hoglin/Hoglin.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.RandomSource; @@ -2597,7 +2606,7 @@ index 72dc725b8cd6a2fca26aae376f91ab3e246a810b..1abc4d0de2ff983fc0c30bbc8a356d78 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 { +@@ -209,11 +207,8 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -2610,7 +2619,7 @@ index 72dc725b8cd6a2fca26aae376f91ab3e246a810b..1abc4d0de2ff983fc0c30bbc8a356d78 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 9a1f1b8ff394e4849301508dd82669246eeba2de..b21ca373220f80c81cadab1eda482057d6366caf 100644 +index 49ed463ae7ef65b2630a5b914689e04fa729a40c..5ceca0b60903b6a5a51db009ac7e583eef24d119 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; @@ -2622,7 +2631,7 @@ index 9a1f1b8ff394e4849301508dd82669246eeba2de..b21ca373220f80c81cadab1eda482057 import net.minecraft.world.DifficultyInstance; import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionResult; -@@ -352,11 +350,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -356,11 +354,8 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { @@ -2635,10 +2644,10 @@ index 9a1f1b8ff394e4849301508dd82669246eeba2de..b21ca373220f80c81cadab1eda482057 super.customServerAiStep(level); } diff --git a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -index ebe1b4e0b841906684561151919a5b3f6e206b60..0f1ed8ec352653089106ed8a143ab4ae3f82c3fe 100644 +index 7baccc23f868ac9b8720bfd77b2af6b7dd368820..9cc8b965b5e39265e932e25253a1d5382cfa33c7 100644 --- a/net/minecraft/world/entity/monster/piglin/PiglinBrute.java +++ b/net/minecraft/world/entity/monster/piglin/PiglinBrute.java -@@ -8,8 +8,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -7,8 +7,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.RandomSource; @@ -2647,7 +2656,7 @@ index ebe1b4e0b841906684561151919a5b3f6e206b60..0f1ed8ec352653089106ed8a143ab4ae import net.minecraft.world.DifficultyInstance; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.entity.EntitySpawnReason; -@@ -154,11 +152,8 @@ public class PiglinBrute extends AbstractPiglin { +@@ -153,11 +151,8 @@ public class PiglinBrute extends AbstractPiglin { @Override protected void customServerAiStep(ServerLevel level) { @@ -2660,10 +2669,10 @@ index ebe1b4e0b841906684561151919a5b3f6e206b60..0f1ed8ec352653089106ed8a143ab4ae 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 dede88234fd2b0f55863021446c4c9273f3a14d8..87976d8981f72732899c57a96971e851b86d5123 100644 +index 4f4bf16cfa1390f19a7e8745d86e42e24ffb3bbc..96db45d6885831c290ea6e29400633a502961f01 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -26,8 +26,6 @@ import net.minecraft.tags.TagKey; +@@ -25,8 +25,6 @@ import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.Unit; @@ -2672,7 +2681,7 @@ index dede88234fd2b0f55863021446c4c9273f3a14d8..87976d8981f72732899c57a96971e851 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) { @@ -2684,11 +2693,11 @@ index dede88234fd2b0f55863021446c4c9273f3a14d8..87976d8981f72732899c57a96971e851 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 bfff91e5e252141f887d8965ecf1dd9ff1cebfe3..d99a6ade82bbd01e25137fecfbec5dcef6765e79 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; +diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java +index 996468c21a79d698a8d842189ffd4f2dc86a4302..40fae3fdcd9fc875df1db02d8c0d1f2388e0436a 100644 +--- a/net/minecraft/world/entity/npc/villager/Villager.java ++++ b/net/minecraft/world/entity/npc/villager/Villager.java +@@ -34,8 +34,6 @@ import net.minecraft.stats.Stats; import net.minecraft.tags.ItemTags; import net.minecraft.util.Mth; import net.minecraft.util.SpawnUtil; @@ -2708,17 +2717,17 @@ index bfff91e5e252141f887d8965ecf1dd9ff1cebfe3..d99a6ade82bbd01e25137fecfbec5dce // treat as inactive if lobotomized @@ -408,7 +404,6 @@ public class Villager extends AbstractVillager implements ReputationEventHandler } - else if (this.isLobotomized && shouldRestock()) restock(); + else if (this.isLobotomized && shouldRestock(level)) restock(); // Purpur end - Lobotomize stuck villagers - profilerFiller.pop(); if (this.assignProfessionWhenSpawned) { this.assignProfessionWhenSpawned = false; } diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java -index 07d7c4737635f671f33b8f73001d67928fc75782..f2c82217811712625df594667330a73f8f44e261 100644 +index 4e0b0d630e18bde916a07889bcaf0e7accf064ca..158e42d22da29a184d51c43e3e4ad4a1a41b0506 100644 --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java -@@ -28,7 +28,6 @@ import net.minecraft.server.level.ServerLevel; +@@ -27,7 +27,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.packs.resources.ResourceManager; import net.minecraft.server.packs.resources.SimpleJsonResourceReloadListener; import net.minecraft.server.packs.resources.SimplePreparableReloadListener; @@ -2732,7 +2741,7 @@ index 07d7c4737635f671f33b8f73001d67928fc75782..f2c82217811712625df594667330a73f @Override - protected RecipeMap prepare(ResourceManager resourceManager, ProfilerFiller profiler) { + protected RecipeMap prepare(ResourceManager resourceManager) { - SortedMap> map = new TreeMap<>(); + SortedMap> map = new TreeMap<>(); SimpleJsonResourceReloadListener.scanDirectory( resourceManager, RECIPE_LISTER, this.registries.createSerializationContext(JsonOps.INSTANCE), Recipe.CODEC, map @@ -82,7 +81,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp @@ -2745,17 +2754,17 @@ 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 be10e785bedb3193b1270ae2908824b2af005809..d8b6f1b853609a7fcbd9c2fe6485e5080dece43a 100644 +index 414cb1bd92e082dbe34a5078a4269fc98900e1f3..a2f6fe78fc822634ac5c2db9a88000add60134f4 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -36,7 +36,6 @@ import net.minecraft.util.AbortableIterationConsumer; +@@ -35,7 +35,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.random.WeightedList; - import net.minecraft.world.DifficultyInstance; import net.minecraft.world.TickRateManager; + import net.minecraft.world.attribute.EnvironmentAttributeSystem; @@ -260,7 +259,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override @@ -2772,7 +2781,7 @@ index be10e785bedb3193b1270ae2908824b2af005809..d8b6f1b853609a7fcbd9c2fe6485e508 final List ret = new java.util.ArrayList<>(); ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemLevel)this).moonrise$getEntityLookup().getHardCollidingEntities(entity, box, ret, predicate); -@@ -1736,7 +1733,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1726,7 +1723,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -2780,7 +2789,7 @@ index be10e785bedb3193b1270ae2908824b2af005809..d8b6f1b853609a7fcbd9c2fe6485e508 List list = Lists.newArrayList(); // Paper start - rewrite chunk system -@@ -1765,8 +1761,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1755,8 +1751,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) { @@ -2789,7 +2798,7 @@ index be10e785bedb3193b1270ae2908824b2af005809..d8b6f1b853609a7fcbd9c2fe6485e508 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); -@@ -1851,7 +1845,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1841,7 +1835,6 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl // Paper end - rewrite chunk system public boolean hasEntities(EntityTypeTest entityTypeTest, AABB bounds, Predicate predicate) { @@ -2798,10 +2807,10 @@ index be10e785bedb3193b1270ae2908824b2af005809..d8b6f1b853609a7fcbd9c2fe6485e508 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 4c3fa61566ecabf8eccea32f10aabfa7c961e4c5..1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e 100644 +index 14e21c5439cfdf870feeccf638d6494a0c003d64..24cbfb900eeed9c666334ca178e6bc02abc25a77 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -24,8 +24,6 @@ import net.minecraft.tags.BlockTags; +@@ -23,8 +23,6 @@ import net.minecraft.tags.BlockTags; import net.minecraft.util.Mth; import net.minecraft.util.RandomSource; import net.minecraft.util.VisibleForDebug; @@ -2810,7 +2819,7 @@ index 4c3fa61566ecabf8eccea32f10aabfa7c961e4c5..1b62bc5836fbf0ddc37d8f979b4e7aa6 import net.minecraft.util.random.WeightedList; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EntitySpawnReason; -@@ -154,9 +152,6 @@ public final class NaturalSpawner { +@@ -155,9 +153,6 @@ public final class NaturalSpawner { } public static void spawnForChunk(ServerLevel level, LevelChunk chunk, NaturalSpawner.SpawnState spawnState, List categories) { @@ -2820,7 +2829,7 @@ index 4c3fa61566ecabf8eccea32f10aabfa7c961e4c5..1b62bc5836fbf0ddc37d8f979b4e7aa6 for (MobCategory mobCategory : categories) { // Paper start - Optional per player mob spawns final boolean canSpawn; -@@ -191,8 +186,6 @@ public final class NaturalSpawner { +@@ -192,8 +187,6 @@ public final class NaturalSpawner { // Paper end - Optional per player mob spawns } } @@ -2830,19 +2839,19 @@ index 4c3fa61566ecabf8eccea32f10aabfa7c961e4c5..1b62bc5836fbf0ddc37d8f979b4e7aa6 // Paper start - Add mobcaps commands diff --git a/net/minecraft/world/level/ServerExplosion.java b/net/minecraft/world/level/ServerExplosion.java -index c0c87b7c8e0b6b941fe8a63dc361504e94459d86..3c4de8b43a5658e02ddce7db9f453bfd344703e3 100644 +index efb92720ddfb5f0a95e8552a88dadc495736329a..cd032aee3ccb20b3499eb9770eeb3847a388bd9a 100644 --- a/net/minecraft/world/level/ServerExplosion.java +++ b/net/minecraft/world/level/ServerExplosion.java -@@ -14,8 +14,6 @@ import net.minecraft.core.BlockPos; - import net.minecraft.server.level.ServerLevel; +@@ -13,8 +13,6 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.tags.EntityTypeTags; import net.minecraft.util.Mth; + import net.minecraft.util.Util; -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; -@@ -657,10 +655,7 @@ public class ServerExplosion implements Explosion { +@@ -661,10 +659,7 @@ public class ServerExplosion implements Explosion { List list = this.calculateExplodedPositions(); this.hurtEntities(); if (this.interactsWithBlocks()) { @@ -2854,7 +2863,7 @@ index c0c87b7c8e0b6b941fe8a63dc361504e94459d86..3c4de8b43a5658e02ddce7db9f453bfd if (this.fire) { diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index a403b61e0300ecfff55f10009ecd3ad57f543808..606c33d67fc7612b25ca23fe34769d3b179ebbd6 100644 +index 435695ceef32d106f9b2a0af87a5a2c69cbb78c7..1cea69f07a0b28cf8b112c202c668b915bf1b88f 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java @@ -28,8 +28,6 @@ import net.minecraft.util.ProblemReporter; @@ -2866,7 +2875,7 @@ index a403b61e0300ecfff55f10009ecd3ad57f543808..606c33d67fc7612b25ca23fe34769d3b import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; -@@ -399,12 +397,8 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -397,12 +395,8 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot } if (LightEngine.hasDifferentLightProperties(blockState, state)) { @@ -2879,7 +2888,7 @@ index a403b61e0300ecfff55f10009ecd3ad57f543808..606c33d67fc7612b25ca23fe34769d3b } boolean flag = !blockState.is(block); -@@ -965,8 +959,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -959,8 +953,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot BlockPos blockPos = this.blockEntity.getBlockPos(); if (LevelChunk.this.isTicking(blockPos)) { try { @@ -2888,7 +2897,7 @@ index a403b61e0300ecfff55f10009ecd3ad57f543808..606c33d67fc7612b25ca23fe34769d3b BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { this.ticker.tick(LevelChunk.this.level, this.blockEntity.getBlockPos(), blockState, this.blockEntity); -@@ -980,8 +972,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -974,8 +966,6 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot } // Paper end - Remove the Block Entity if it's invalid } @@ -2898,30 +2907,30 @@ index a403b61e0300ecfff55f10009ecd3ad57f543808..606c33d67fc7612b25ca23fe34769d3b // 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 5894260481ea395c26a5b506e38530f7b2032b33..477446a1bf38efb1e5b5b4513dd85808a5cd8cdb 100644 +index 168b475b38b2872b27c1ab15f6846323ac16dd2c..919769ae40efea904be6adbbb13542bd39bf0291 100644 --- a/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -13,9 +13,6 @@ import java.util.function.Function; +@@ -12,9 +12,6 @@ import java.util.function.BooleanSupplier; + import java.util.function.Function; import java.util.stream.Collectors; - import javax.annotation.Nullable; import net.minecraft.core.BlockPos; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; -import net.minecraft.util.profiling.metrics.MetricCategory; import net.minecraft.world.entity.Mob; import net.minecraft.world.level.PathNavigationRegion; + import org.jspecify.annotations.Nullable; +@@ -60,9 +57,6 @@ public class PathFinder { + } -@@ -62,9 +59,6 @@ public class PathFinder { - - @Nullable - private Path findPath(Node node, List> positions, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { // Paper - optimize collection + private @Nullable Path findPath(Node node, List> positions, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { // Paper - optimize collection - ProfilerFiller profilerFiller = Profiler.get(); - profilerFiller.push("find_path"); - profilerFiller.markForCharting(MetricCategory.PATH_FINDING); // Set set = targetPositions.keySet(); // Paper - unused node.g = 0.0F; node.h = this.getBestH(node, positions); // Paper - optimize collection -@@ -139,7 +133,6 @@ public class PathFinder { +@@ -137,7 +131,6 @@ public class PathFinder { best = path; } } @@ -2930,13 +2939,13 @@ index 5894260481ea395c26a5b506e38530f7b2032b33..477446a1bf38efb1e5b5b4513dd85808 Set set = Sets.newHashSet(); for(Map.Entry entry : positions) { diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java -index 7ea0273018b1a364a5e2b7bf57da840383c8ffa5..c7f9485191dc797de78e6524c5c2c737581ed838 100644 +index b932f32d08ad663cd05910140c861045a9b1f922..a1e2b0c4dca30b32e5bae6f99d38084128127325 100644 --- a/net/minecraft/world/ticks/LevelTicks.java +++ b/net/minecraft/world/ticks/LevelTicks.java -@@ -23,8 +23,6 @@ import net.minecraft.Util; - import net.minecraft.core.BlockPos; +@@ -23,8 +23,6 @@ import net.minecraft.core.BlockPos; import net.minecraft.core.SectionPos; import net.minecraft.core.Vec3i; + import net.minecraft.util.Util; -import net.minecraft.util.profiling.Profiler; -import net.minecraft.util.profiling.ProfilerFiller; import net.minecraft.world.level.ChunkPos; diff --git a/divinemc-server/minecraft-patches/features/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 index e7facc8..8c98c18 100644 --- a/divinemc-server/minecraft-patches/features/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 @@ -23,10 +23,10 @@ index c58b4a5426dc2e502e240e9b9270ead2ef65ecbd..1618e1d985ea798c1d7485b30fad5b45 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 5d0eb3893a0cca99ef53c2095b7b36a145dc15be..077ccddb7d358be352b6d497ed8b4e97b7d09262 100644 +index ff32a89a720676c5a9f34ea7c859f03d47545b72..fc618f97cee829dbd4b0c167c5fe515a58189c37 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -580,13 +580,25 @@ public interface DispenseItemBehavior { +@@ -584,13 +584,25 @@ public interface DispenseItemBehavior { blockStateBase -> blockStateBase.hasProperty(BeehiveBlock.HONEY_LEVEL) && blockStateBase.getBlock() instanceof BeehiveBlock ) && blockState.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) { @@ -55,7 +55,7 @@ index 5d0eb3893a0cca99ef53c2095b7b36a145dc15be..077ccddb7d358be352b6d497ed8b4e97 return super.execute(blockSource, item); } diff --git a/net/minecraft/world/item/BottleItem.java b/net/minecraft/world/item/BottleItem.java -index 105f9166297de2bfa6bdcfa9f6a0ffb00c0242ac..111f43fc5c74577f8f3067a4f84be7a6f96fdfb2 100644 +index 287332788643be2eb9058555456e9058c6ee475b..a10ecc1f2756a10d43ea38a9eaafa22f3ce97023 100644 --- a/net/minecraft/world/item/BottleItem.java +++ b/net/minecraft/world/item/BottleItem.java @@ -35,6 +35,18 @@ public class BottleItem extends Item { @@ -111,7 +111,7 @@ index 105f9166297de2bfa6bdcfa9f6a0ffb00c0242ac..111f43fc5c74577f8f3067a4f84be7a6 } diff --git a/net/minecraft/world/level/block/BeehiveBlock.java b/net/minecraft/world/level/block/BeehiveBlock.java -index 02671ed6ba302c36d15896bd1fb3a0883b6e0940..8e9426784b46f8b988279c1dc4c6d2276f394422 100644 +index 7b24213eb30f60d49c37fc7d1242b52db578e634..68e4991c6b57f6dd15619c9225a3dba9b26f6d2c 100644 --- a/net/minecraft/world/level/block/BeehiveBlock.java +++ b/net/minecraft/world/level/block/BeehiveBlock.java @@ -159,12 +159,26 @@ public class BeehiveBlock extends BaseEntityBlock { diff --git a/divinemc-server/minecraft-patches/features/0005-Paper-PR-Throttle-failed-spawn-attempts.patch b/divinemc-server/minecraft-patches/features/0005-Paper-PR-Throttle-failed-spawn-attempts.patch index 97ef3d1..a7150e0 100644 --- a/divinemc-server/minecraft-patches/features/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 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8adcb17e7ce 100644 +index 24cbfb900eeed9c666334ca178e6bc02abc25a77..ef1d224e9488f437ea198c9362587605b29153c3 100644 --- a/net/minecraft/world/level/NaturalSpawner.java +++ b/net/minecraft/world/level/NaturalSpawner.java -@@ -160,29 +160,52 @@ public final class NaturalSpawner { +@@ -161,29 +161,52 @@ public final class NaturalSpawner { // Copied from getFilteredSpawningCategories int limit = mobCategory.getMaxInstancesPerChunk(); org.bukkit.entity.SpawnCategory spawnCategory = org.bukkit.craftbukkit.util.CraftSpawnCategory.toBukkit(mobCategory); @@ -90,7 +90,7 @@ index 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8ad // Paper end - Optional per player mob spawns } } -@@ -204,14 +227,16 @@ public final class NaturalSpawner { +@@ -205,14 +228,16 @@ public final class NaturalSpawner { // Paper start - Optional per player mob spawns spawnCategoryForChunk(category, level, chunk, filter, callback, Integer.MAX_VALUE, null); } @@ -109,7 +109,7 @@ index 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8ad } @VisibleForDebug -@@ -229,18 +254,17 @@ public final class NaturalSpawner { +@@ -230,18 +255,17 @@ public final class NaturalSpawner { ) { spawnCategoryForPosition(category, level, chunk, pos, filter, callback, Integer.MAX_VALUE, null); } @@ -130,7 +130,7 @@ index 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8ad for (int i1 = 0; i1 < 3; i1++) { int x = pos.getX(); int z = pos.getZ(); -@@ -280,14 +304,14 @@ public final class NaturalSpawner { +@@ -281,14 +305,14 @@ public final class NaturalSpawner { } // Paper end - per player mob count backoff if (doSpawning == PreSpawnStatus.ABORT) { @@ -147,7 +147,7 @@ index 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8ad } mobForSpawn.snapTo(d, y, d1, level.random.nextFloat() * 360.0F, 0.0F); -@@ -310,7 +334,7 @@ public final class NaturalSpawner { +@@ -311,7 +335,7 @@ public final class NaturalSpawner { } // CraftBukkit end if (i >= mobForSpawn.getMaxSpawnClusterSize() || i >= maxSpawns) { // Paper - Optional per player mob spawns @@ -156,7 +156,7 @@ index 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8ad } if (mobForSpawn.isMaxGroupSizeReached(i3)) { -@@ -323,6 +347,8 @@ public final class NaturalSpawner { +@@ -324,6 +348,8 @@ public final class NaturalSpawner { } } } @@ -166,10 +166,10 @@ index 1b62bc5836fbf0ddc37d8f979b4e7aa628c4b00e..60290430e1ac70d3b885651168a6e8ad 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 98b7e1e3b8592824c69a9647a82621755526c71a..f6f9a88283e051e6a7c96f461b68b3881b3361d2 100644 +index 54ddcf92e72b9cbd0eb442e5d0faa83c0cf3b33b..f2111830b112870c07bf20a0dd52427309d25332 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -86,6 +86,7 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -83,6 +83,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 @@ -178,19 +178,19 @@ index 98b7e1e3b8592824c69a9647a82621755526c71a..f6f9a88283e051e6a7c96f461b68b388 // 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 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83dabc8437f 100644 +index 95c8d65a4b6db8d0721460ae55cb8fb8143ea9a2..51a3c5c8da9d10a9851eb479db67dd759b2ef9b3 100644 --- a/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +++ b/net/minecraft/world/level/chunk/storage/SerializableChunkData.java @@ -93,6 +93,7 @@ public record SerializableChunkData( List blockEntities, CompoundTag structureData - , @Nullable net.minecraft.nbt.Tag persistentDataContainer // CraftBukkit - persistentDataContainer + , net.minecraft.nbt.@Nullable Tag persistentDataContainer // CraftBukkit - persistentDataContainer + , @Nullable long[] failedSpawnAttempts // Paper - throttle failed spawn attempts ) { 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(); -@@ -184,6 +185,19 @@ public record SerializableChunkData( - lists[i] = list2; +@@ -185,6 +186,19 @@ public record SerializableChunkData( + } } + // Paper start - throttle failed spawn attempts @@ -209,7 +209,7 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d 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"); -@@ -256,6 +270,7 @@ public record SerializableChunkData( +@@ -257,6 +271,7 @@ public record SerializableChunkData( list4, compoundOrEmpty , tag.get("ChunkBukkitValues") // CraftBukkit - ChunkBukkitValues @@ -217,8 +217,8 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d ); } } -@@ -419,6 +434,15 @@ public record SerializableChunkData( - chunkAccess.addPackedPostProcess(this.postProcessingSections[i], i); +@@ -423,6 +438,15 @@ public record SerializableChunkData( + } } + // Paper start - throttle failed spawn attempts @@ -233,7 +233,7 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d if (chunkType == ChunkType.LEVELCHUNK) { return this.loadStarlightLightData(level, new ImposterProtoChunk((LevelChunk)chunkAccess, false)); // Paper - starlight } else { -@@ -534,6 +558,7 @@ public record SerializableChunkData( +@@ -538,6 +562,7 @@ public record SerializableChunkData( persistentDataContainer = chunk.persistentDataContainer.toTagCompound(); } // CraftBukkit end @@ -241,7 +241,7 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d return new SerializableChunkData( level.palettedContainerFactory(), pos, -@@ -554,6 +579,7 @@ public record SerializableChunkData( +@@ -558,6 +583,7 @@ public record SerializableChunkData( list1, compoundTag , persistentDataContainer // CraftBukkit - persistentDataContainer @@ -249,7 +249,7 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d ); } } -@@ -639,6 +665,21 @@ public record SerializableChunkData( +@@ -643,6 +669,21 @@ public record SerializableChunkData( compoundTag.put("ChunkBukkitValues", this.persistentDataContainer); } // CraftBukkit end @@ -271,7 +271,7 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d // 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 -@@ -854,4 +895,49 @@ public record SerializableChunkData( +@@ -857,4 +898,49 @@ public record SerializableChunkData( } // Paper end - starlight - convert from record } @@ -284,19 +284,19 @@ index 2e8a1898c9ef8bbfd58ea1e9fbd7f6a633822fb9..e393f9025283acb7d1f5937aebbde83d + long lastUpdateTime, + long inhabitedTime, + ChunkStatus chunkStatus, -+ @Nullable BlendingData.Packed blendingData, ++ BlendingData.@Nullable Packed blendingData, + @Nullable BelowZeroRetrogen belowZeroRetrogen, + UpgradeData upgradeData, -+ @Nullable long[] carvingMask, ++ long @Nullable [] carvingMask, + Map heightmaps, + ChunkAccess.PackedTicks packedTicks, -+ ShortList[] postProcessingSections, ++ @Nullable ShortList[] postProcessingSections, + boolean lightCorrect, -+ List sectionData, ++ List sectionData, + List entities, + List blockEntities, -+ CompoundTag structureData, -+ @Nullable net.minecraft.nbt.Tag persistentDataContainer // CraftBukkit - persistentDataContainer ++ CompoundTag structureData ++ , net.minecraft.nbt.@Nullable Tag persistentDataContainer // CraftBukkit - persistentDataContainer + ) { + this(containerFactory, + chunkPos, diff --git a/divinemc-server/minecraft-patches/features/0006-Raytrace-AntiXray-SDK-integration.patch b/divinemc-server/minecraft-patches/features/0006-Raytrace-AntiXray-SDK-integration.patch index 241a2fb..0ec71ea 100644 --- a/divinemc-server/minecraft-patches/features/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 fad600f343ee0983efc183f083b1507648987575..9bbcffc77dcf0e062a7f3464aee7f8d0563a440f 100644 +index 2e3b6da733387c95c0add1f7a42508023f0b74ff..df6ebb53ec75f4a66e397100f4ef85978a1db3c5 100644 --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -316,6 +316,12 @@ public class ServerPlayerGameMode { +@@ -313,6 +313,12 @@ public class ServerPlayerGameMode { org.bukkit.craftbukkit.event.CraftEventFactory.callBlockDamageAbortEvent(this.player, pos, this.player.getInventory().getSelectedItem()); // CraftBukkit } } @@ -25,10 +25,10 @@ index fad600f343ee0983efc183f083b1507648987575..9bbcffc77dcf0e062a7f3464aee7f8d0 } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index d8b6f1b853609a7fcbd9c2fe6485e5080dece43a..21a20aa602f51bbd6c8cdcb52f6b485971834595 100644 +index a2f6fe78fc822634ac5c2db9a88000add60134f4..fafee0fe15564b47da3641858e60d10cdd860ef4 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -1126,6 +1126,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1133,6 +1133,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/divinemc-server/minecraft-patches/features/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 index c6c96d1..15419de 100644 --- a/divinemc-server/minecraft-patches/features/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,7 +15,7 @@ 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 8697528095ebed543ee1bb3b6b617a26a800bd5d..4fc29f7aae32180f86af971f7f80a37aa6e797e4 100644 +index 7129c5e1920008ac54f3a8ac83f5589396f4e4e9..7cac3ba1aac89cca09964b4e68ec1628cb3c5811 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 { @@ -27,10 +27,10 @@ index 8697528095ebed543ee1bb3b6b617a26a800bd5d..4fc29f7aae32180f86af971f7f80a37a 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 67f9d5384f26d27cb59c2bfa090697dd86b85b67..457dfcb459f2618e6975ab3e4ff37d5988dd50c2 100644 +index 71c5de736166101d90d464e4a4adb12d89e44315..0313586d4f5f8c21aa9e8367dc9ca072f3271d9e 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -221,6 +221,13 @@ public abstract class PlayerList { +@@ -226,6 +226,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; diff --git a/divinemc-server/minecraft-patches/features/0008-lithium-fast_util.patch b/divinemc-server/minecraft-patches/features/0008-lithium-fast_util.patch index dc52e63..ada3a25 100644 --- a/divinemc-server/minecraft-patches/features/0008-lithium-fast_util.patch +++ b/divinemc-server/minecraft-patches/features/0008-lithium-fast_util.patch @@ -11,7 +11,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/core/Direction.java b/net/minecraft/core/Direction.java -index cbb743ce94f08b624a64555d057ed04286094ba9..15360c644f559f16c319ddd10f6171a9b9cc7ac4 100644 +index 9926682586fda91017e3e1ab079296a8c4a88879..ec167104be91305c6b9320330dcdbfb5627b78da 100644 --- a/net/minecraft/core/Direction.java +++ b/net/minecraft/core/Direction.java @@ -225,7 +225,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa @@ -23,7 +23,7 @@ index cbb743ce94f08b624a64555d057ed04286094ba9..15360c644f559f16c319ddd10f6171a9 } public Direction getClockWise(Direction.Axis axis) { -@@ -358,7 +358,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa +@@ -357,7 +357,7 @@ public enum Direction implements StringRepresentable, ca.spottedleaf.moonrise.pa } public static Direction getRandom(RandomSource random) { @@ -33,7 +33,7 @@ index cbb743ce94f08b624a64555d057ed04286094ba9..15360c644f559f16c319ddd10f6171a9 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 529bd339441fde279ed81573ca5339a0837b3b87..b26ea727a7867a74edd7b0fb60965fe9c2fcb474 100644 +index 120e432df71eaee94225555d24c82e6d05b34b9f..b81c1c66d1f1ec2e3d93a2b32fbd9089c623bc41 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/divinemc-server/minecraft-patches/features/0009-C2ME-Optimize-world-gen-math.patch b/divinemc-server/minecraft-patches/features/0009-C2ME-Optimize-world-gen-math.patch index 1032ecd..e02e779 100644 --- a/divinemc-server/minecraft-patches/features/0009-C2ME-Optimize-world-gen-math.patch +++ b/divinemc-server/minecraft-patches/features/0009-C2ME-Optimize-world-gen-math.patch @@ -11,10 +11,10 @@ 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 caf11fdedb5c390e1241bccbffee22610933b970..26b669942560e0e93d662e9d4016aa8275976f06 100644 +index de7c262f65557f149e00059c7df85917c9ca4342..6831866429ad9b5f5ca1e9191a9ee3ba3a4b355d 100644 --- a/net/minecraft/world/level/ChunkPos.java +++ b/net/minecraft/world/level/ChunkPos.java -@@ -110,7 +110,12 @@ public class ChunkPos { +@@ -119,7 +119,12 @@ public class ChunkPos { @Override public boolean equals(Object other) { @@ -29,10 +29,10 @@ index caf11fdedb5c390e1241bccbffee22610933b970..26b669942560e0e93d662e9d4016aa82 public int getMiddleBlockX() { diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java -index 5e1d88ef91e585a34e9213da923df796dd866e03..c9ddfc8670614c2d8629066b0cc805d18e4f662f 100644 +index b87fad848fa4342dc420a186a762cc826e9c0294..3e8b852fe7630677f0497e36a176787a9400d5d6 100644 --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java -@@ -168,8 +168,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -167,8 +167,14 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } private static double getBuryContribution(double x, double y, double z) { @@ -50,10 +50,10 @@ index 5e1d88ef91e585a34e9213da923df796dd866e03..c9ddfc8670614c2d8629066b0cc805d1 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 576749f5088e6ec49a79b440aa109822e0be33c8..b888a834e4849f326e94e02623e8015a775d4286 100644 +index d1068a122e5dbd5af274d0f8178ca9f5fa49f930..2e02ba3d101eb41b486da7622ada14e330e70dbd 100644 --- a/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -@@ -73,7 +73,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { +@@ -75,7 +75,10 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { if (SharedConstants.DEBUG_DISABLE_FLUID_GENERATION) { return fluidStatus2; } else { diff --git a/divinemc-server/minecraft-patches/features/0011-Carpet-Fixes-RecipeManager-Optimize.patch b/divinemc-server/minecraft-patches/features/0011-Carpet-Fixes-RecipeManager-Optimize.patch index 29af0c5..f29c536 100644 --- a/divinemc-server/minecraft-patches/features/0011-Carpet-Fixes-RecipeManager-Optimize.patch +++ b/divinemc-server/minecraft-patches/features/0011-Carpet-Fixes-RecipeManager-Optimize.patch @@ -9,7 +9,7 @@ This is a fully vanilla optimization. Improves: [Blast]Furnace/Campfire/Smoker/S This was mostly made for the auto crafting table, since the performance boost is much more visible while using that mod diff --git a/net/minecraft/world/item/crafting/RecipeManager.java b/net/minecraft/world/item/crafting/RecipeManager.java -index f2c82217811712625df594667330a73f8f44e261..d39ff67faf89f34dcb41769b268c3dafc1b6305b 100644 +index 158e42d22da29a184d51c43e3e4ad4a1a41b0506..62cea043cefaeece17e4289686840eece6ef453f 100644 --- a/net/minecraft/world/item/crafting/RecipeManager.java +++ b/net/minecraft/world/item/crafting/RecipeManager.java @@ -166,7 +166,7 @@ public class RecipeManager extends SimplePreparableReloadListener imp @@ -22,10 +22,10 @@ index f2c82217811712625df594667330a73f8f44e261..d39ff67faf89f34dcb41769b268c3daf // CraftBukkit end } diff --git a/net/minecraft/world/item/crafting/RecipeMap.java b/net/minecraft/world/item/crafting/RecipeMap.java -index 098753ddd215b6ef5915fac71d8c4f0b19cf4142..1778e58dca9430756d59d07bf017ebe4cc1f4ed4 100644 +index 23186a34bcb3ad2e5976f93cf0ff977a8d9a9721..52c1df3b110b5d8760b9d19ac6d8c96cc1248fe7 100644 --- a/net/minecraft/world/item/crafting/RecipeMap.java +++ b/net/minecraft/world/item/crafting/RecipeMap.java -@@ -75,4 +75,24 @@ public class RecipeMap { +@@ -74,4 +74,24 @@ public class RecipeMap { public > Stream> getRecipesFor(RecipeType type, I input, Level level) { return input.isEmpty() ? Stream.empty() : this.byType(type).stream().filter(recipeHolder -> recipeHolder.value().matches(input, level)); } diff --git a/divinemc-server/minecraft-patches/features/0013-C2ME-optimize-noise-generation.patch b/divinemc-server/minecraft-patches/features/0013-C2ME-optimize-noise-generation.patch index 3bd3f3e..0d7e006 100644 --- a/divinemc-server/minecraft-patches/features/0013-C2ME-optimize-noise-generation.patch +++ b/divinemc-server/minecraft-patches/features/0013-C2ME-optimize-noise-generation.patch @@ -180,7 +180,7 @@ index fb11a2eea540d55e50eab59f9857ca5d99f556f8..c40f65c30b6422a27154295a2b3a6348 private double sampleWithDerivative(int gridX, int gridY, int gridZ, double deltaX, double deltaY, double deltaZ, double[] noiseValues) { diff --git a/net/minecraft/world/level/levelgen/synth/PerlinNoise.java b/net/minecraft/world/level/levelgen/synth/PerlinNoise.java -index da3c26fbad32d75d71f7e59c8c3341316a754756..f05902bb4b0d9e746d0033e73ec9f3b5626a53b5 100644 +index 4c5268704af9b6a88c00878459254851c0592da1..431b81c85af4b482ea1a8f82f31f4e2f29464454 100644 --- a/net/minecraft/world/level/levelgen/synth/PerlinNoise.java +++ b/net/minecraft/world/level/levelgen/synth/PerlinNoise.java @@ -26,6 +26,7 @@ public class PerlinNoise { @@ -230,7 +230,7 @@ index da3c26fbad32d75d71f7e59c8c3341316a754756..f05902bb4b0d9e746d0033e73ec9f3b5 } @Deprecated -@@ -187,7 +211,7 @@ public class PerlinNoise { +@@ -186,7 +210,7 @@ public class PerlinNoise { } public static double wrap(double value) { diff --git a/divinemc-server/minecraft-patches/features/0014-Use-Java-s-Math-functions.patch b/divinemc-server/minecraft-patches/features/0014-Use-Java-s-Math-functions.patch index 52c94f4..d142885 100644 --- a/divinemc-server/minecraft-patches/features/0014-Use-Java-s-Math-functions.patch +++ b/divinemc-server/minecraft-patches/features/0014-Use-Java-s-Math-functions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use Java's Math functions diff --git a/net/minecraft/util/Mth.java b/net/minecraft/util/Mth.java -index 0713d164851216483247da09ff7901f8bfbe2eb9..ed46863a244f4e23610a918f0692390130eaadaf 100644 +index 50de03f9293939425feba058a0567ccae8bde09e..a5c4eb68f718769f088306ca8b098611d4ecdf4d 100644 --- a/net/minecraft/util/Mth.java +++ b/net/minecraft/util/Mth.java -@@ -58,18 +58,15 @@ public class Mth { +@@ -60,18 +60,15 @@ public class Mth { } public static int floor(float value) { @@ -30,7 +30,7 @@ index 0713d164851216483247da09ff7901f8bfbe2eb9..ed46863a244f4e23610a918f06923901 } public static float abs(float value) { -@@ -81,13 +78,11 @@ public class Mth { +@@ -83,13 +80,11 @@ public class Mth { } public static int ceil(float value) { diff --git a/divinemc-server/minecraft-patches/features/0015-Disable-leaf-decay.patch b/divinemc-server/minecraft-patches/features/0015-Disable-leaf-decay.patch index 99b8c5b..99d7084 100644 --- a/divinemc-server/minecraft-patches/features/0015-Disable-leaf-decay.patch +++ b/divinemc-server/minecraft-patches/features/0015-Disable-leaf-decay.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Disable leaf decay diff --git a/net/minecraft/world/level/block/LeavesBlock.java b/net/minecraft/world/level/block/LeavesBlock.java -index b507dbb6ab345cf754775226c59320526d7b94f0..884f102836ff1ea08632804465f21a18bb7cd18d 100644 +index d5b114dca7b28d910f03ae3468e891d5d9863897..dbe3702bab05e38e21cd2e5e0fad793fee36c04a 100644 --- a/net/minecraft/world/level/block/LeavesBlock.java +++ b/net/minecraft/world/level/block/LeavesBlock.java -@@ -70,12 +70,29 @@ public abstract class LeavesBlock extends Block implements SimpleWaterloggedBloc +@@ -80,12 +80,29 @@ public abstract class LeavesBlock extends Block implements SimpleWaterloggedBloc } protected boolean decaying(BlockState state) { diff --git a/divinemc-server/minecraft-patches/features/0016-Optimize-entities.patch b/divinemc-server/minecraft-patches/features/0016-Optimize-entities.patch index e351188..732a9aa 100644 --- a/divinemc-server/minecraft-patches/features/0016-Optimize-entities.patch +++ b/divinemc-server/minecraft-patches/features/0016-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 0adfd1cd5c21f8a7823cd1bf7c9aa91dd2654150..ad1ebec9d47a4f70b51259cd5ad8a6e7d38e1a4f 100644 +index ffe7b73dafa81ab96c24198d83474fd9af542476..36397d3346d85394e1778e1e129cca9863a5c715 100644 --- a/net/minecraft/world/entity/AgeableMob.java +++ b/net/minecraft/world/entity/AgeableMob.java -@@ -126,6 +126,16 @@ public abstract class AgeableMob extends PathfinderMob { +@@ -124,6 +124,16 @@ public abstract class AgeableMob extends PathfinderMob { public void onSyncedDataUpdated(EntityDataAccessor key) { if (DATA_BABY_ID.equals(key)) { this.refreshDimensions(); @@ -26,10 +26,10 @@ index 0adfd1cd5c21f8a7823cd1bf7c9aa91dd2654150..ad1ebec9d47a4f70b51259cd5ad8a6e7 super.onSyncedDataUpdated(key); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index dc558a32d0cf2d1e2d5cbb09a9377313083e9a57..80b771f69549cf460b3d1fca2de8f27152e98f42 100644 +index c1fff7f3d74a804d9608e3ff78386f49845b8f59..38da0cd729b04fb72eabf95d1c161a3e5afdcd5f 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1711,6 +1711,10 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1730,6 +1730,10 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name private int checkInsideBlocks(Vec3 from, Vec3 to, InsideBlockEffectApplier.StepBasedCollector stepBasedCollector, LongSet visited, int maxSteps) { AABB aabb = this.makeBoundingBox(to).deflate(1.0E-5F); @@ -40,7 +40,7 @@ index dc558a32d0cf2d1e2d5cbb09a9377313083e9a57..80b771f69549cf460b3d1fca2de8f271 boolean flag = from.distanceToSqr(to) > Mth.square(0.9999900000002526); boolean flag1 = this.level instanceof ServerLevel serverLevel && serverLevel.getServer().debugSubscribers().hasAnySubscriberFor(DebugSubscriptions.ENTITY_BLOCK_INTERSECTIONS); -@@ -1726,7 +1730,21 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1745,7 +1749,21 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name return false; } else { atomicInteger.set(index); @@ -64,7 +64,7 @@ index dc558a32d0cf2d1e2d5cbb09a9377313083e9a57..80b771f69549cf460b3d1fca2de8f271 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 +index 934bebe2fc044d9c206d7e328e5c273b56ffbb2f..3ffddee3d257d252f2e4982240f2e937066416a3 100644 --- a/net/minecraft/world/entity/InsideBlockEffectApplier.java +++ b/net/minecraft/world/entity/InsideBlockEffectApplier.java @@ -31,68 +31,115 @@ public interface InsideBlockEffectApplier { @@ -210,10 +210,10 @@ 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 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298a3e10c3d 100644 +index 89a8d428d0fd3ca609455274685caab68c101975..bde6a7eacbe1be59fa962198492ad18fb1c66821 100644 --- a/net/minecraft/world/entity/ai/Brain.java +++ b/net/minecraft/world/entity/ai/Brain.java -@@ -45,16 +45,75 @@ public class Brain { +@@ -47,16 +47,75 @@ public class Brain { static final Logger LOGGER = LogUtils.getLogger(); private final Supplier>> codec; private static final int SCHEDULE_UPDATE_DELAY = 20; @@ -223,7 +223,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 + private Map, Optional>> memories = Maps.newConcurrentMap(); + public Map>, Sensor> sensors = Maps.newLinkedHashMap(); private final Map>>> availableBehaviorsByPriority = Maps.newTreeMap(); - private Schedule schedule = Schedule.EMPTY; + private @Nullable EnvironmentAttribute schedule; - private final Map, MemoryStatus>>> activityRequirements = Maps.newHashMap(); + private Map, MemoryStatus>>> activityRequirements = Maps.newHashMap(); + // DivineMC end - Optimize entities @@ -292,7 +292,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 public static Brain.Provider provider( Collection> memoryTypes, Collection>> sensorTypes -@@ -146,6 +205,12 @@ public class Brain { +@@ -148,6 +207,12 @@ public class Brain { for (Brain.MemoryValue memoryValue : memoryValues) { memoryValue.setMemoryInternal(this); } @@ -305,7 +305,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 } public DataResult serializeStart(DynamicOps ops) { -@@ -165,6 +230,7 @@ public class Brain { +@@ -167,6 +232,7 @@ public class Brain { } public void eraseMemory(MemoryModuleType type) { @@ -313,7 +313,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 this.setMemory(type, Optional.empty()); } -@@ -180,16 +246,33 @@ public class Brain { +@@ -182,16 +248,33 @@ public class Brain { this.setMemoryInternal(memoryType, memory.map(ExpirableValue::of)); } @@ -352,7 +352,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 public Optional getMemory(MemoryModuleType type) { Optional> optional = this.memories.get(type); if (optional == null) { -@@ -251,19 +334,7 @@ public class Brain { +@@ -248,19 +331,7 @@ public class Brain { @Deprecated @VisibleForDebug public List> getRunningBehaviors() { @@ -373,7 +373,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 } public void useDefaultActivity() { -@@ -294,6 +365,7 @@ public class Brain { +@@ -291,6 +362,7 @@ public class Brain { this.activeActivities.clear(); this.activeActivities.addAll(this.coreActivities); this.activeActivities.add(activity); @@ -381,7 +381,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 } } -@@ -383,11 +455,13 @@ public class Brain { +@@ -380,11 +452,13 @@ public class Brain { .computeIfAbsent(activity, activity1 -> Sets.newLinkedHashSet()) .add((BehaviorControl)pair.getSecond()); } @@ -395,7 +395,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 } public boolean isActive(Activity activity) { -@@ -404,6 +478,7 @@ public class Brain { +@@ -401,6 +475,7 @@ public class Brain { } } @@ -403,7 +403,7 @@ index 9ccddcb9a3df8fd9e769069b4502c4422872c562..a05df4dfa6b5078558ef9d6603297298 return brain; } -@@ -438,31 +513,38 @@ public class Brain { +@@ -435,31 +510,38 @@ public class Brain { for (BehaviorControl behaviorControl : this.getRunningBehaviors()) { behaviorControl.doStop(level, owner, gameTime); @@ -512,10 +512,10 @@ index 5b0cadd2544fb2a627822e645ff32fec2e9cfda9..02508662c722a515cfd78f872c8ba8bb public static enum Status { STOPPED, diff --git a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java -index 2e0651e15a512a817e38a896e04621de2746f2dc..7f961f772a58d7e4ce840ca1907d9947ff5d59cc 100644 +index e6b9bcf3bf4e476be58830156a194557b76ae3f4..5b017f1ee398ccfa7dcbe8be877daa4e12298751 100644 --- a/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java +++ b/net/minecraft/world/entity/ai/behavior/LongJumpToRandomPos.java -@@ -119,6 +119,12 @@ public class LongJumpToRandomPos extends Behavior { +@@ -118,6 +118,12 @@ public class LongJumpToRandomPos extends Behavior { int x = blockPos.getX(); int y = blockPos.getY(); int z = blockPos.getZ(); @@ -528,7 +528,7 @@ index 2e0651e15a512a817e38a896e04621de2746f2dc..7f961f772a58d7e4ce840ca1907d9947 this.jumpCandidates = BlockPos.betweenClosedStream( x - this.maxLongJumpWidth, y - this.maxLongJumpHeight, -@@ -174,12 +180,25 @@ public class LongJumpToRandomPos extends Behavior { +@@ -173,12 +179,25 @@ public class LongJumpToRandomPos extends Behavior { } } @@ -605,7 +605,7 @@ 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 674d3d69c797ef3ca5934466806831b2cbcbb93a..04a4cc148579904222b3c99a1ad4c64e5783afa2 100644 +index 95ea226cde95155ddfdc87763af368ac11a644e6..1cd5d8e09f22b32ff9ca30c07f45a5248e887cb4 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 { diff --git a/divinemc-server/minecraft-patches/features/0017-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch b/divinemc-server/minecraft-patches/features/0017-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch index c7babf4..f7aaa12 100644 --- a/divinemc-server/minecraft-patches/features/0017-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch +++ b/divinemc-server/minecraft-patches/features/0017-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch @@ -12,12 +12,12 @@ 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 638432a2e6506d3db6a25c068a33eeafb13cf0d6..737a6ff0bfec9b555fa425619d97b80ef95cb3e6 100644 +index 3a817c92147bb78c60238f3ddc1644b721aed7a2..ec05269a2ec8b416582da8ff0c7da7ac83e4e8fa 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -197,23 +197,27 @@ public class ServerEntity { - if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { + if (this.entity.needsSync || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { Vec3 deltaMovement = this.entity.getDeltaMovement(); - double d = deltaMovement.distanceToSqr(this.lastSentMovement); - if (d > 1.0E-7 || d > 0.0 && deltaMovement.lengthSqr() == 0.0) { diff --git a/divinemc-server/minecraft-patches/features/0019-Carpet-Fixes-Sheep-Optimization.patch b/divinemc-server/minecraft-patches/features/0019-Carpet-Fixes-Sheep-Optimization.patch index 3b8f7e4..a36261d 100644 --- a/divinemc-server/minecraft-patches/features/0019-Carpet-Fixes-Sheep-Optimization.patch +++ b/divinemc-server/minecraft-patches/features/0019-Carpet-Fixes-Sheep-Optimization.patch @@ -19,10 +19,10 @@ we used a prebaked list of all the possible colors and combinations, however thi datapack to change it. diff --git a/net/minecraft/world/item/DyeColor.java b/net/minecraft/world/item/DyeColor.java -index fe71f28c0273a23ba6f798eacd6f9a6a8e36ec9b..3fd3cabf59753cc46c99f62b9c9cdcf6fc3c3a19 100644 +index f2e761f253969ca01b78c7ddc7a571ecc9655432..703c08e90fbde1cbd1272a864aa7960691a1ae2e 100644 --- a/net/minecraft/world/item/DyeColor.java +++ b/net/minecraft/world/item/DyeColor.java -@@ -112,6 +112,15 @@ public enum DyeColor implements StringRepresentable { +@@ -110,6 +110,15 @@ public enum DyeColor implements StringRepresentable { } public static DyeColor getMixedColor(ServerLevel level, DyeColor first, DyeColor second) { @@ -38,7 +38,7 @@ index fe71f28c0273a23ba6f798eacd6f9a6a8e36ec9b..3fd3cabf59753cc46c99f62b9c9cdcf6 CraftingInput craftingInput = makeCraftColorInput(first, second); return level.recipeAccess() .getRecipeFor(RecipeType.CRAFTING, craftingInput, level) -@@ -132,4 +141,85 @@ public enum DyeColor implements StringRepresentable { +@@ -130,4 +139,85 @@ public enum DyeColor implements StringRepresentable { return values()[random.nextInt(values().length)]; } // Purpur end - Shulker spawn from bullet options diff --git a/divinemc-server/minecraft-patches/features/0020-Carpet-AMS-Addition-Optimized-dragon-respawn.patch b/divinemc-server/minecraft-patches/features/0020-Carpet-AMS-Addition-Optimized-dragon-respawn.patch index 9231a17..7b6eca6 100644 --- a/divinemc-server/minecraft-patches/features/0020-Carpet-AMS-Addition-Optimized-dragon-respawn.patch +++ b/divinemc-server/minecraft-patches/features/0020-Carpet-AMS-Addition-Optimized-dragon-respawn.patch @@ -12,23 +12,23 @@ As part of: Carpet-AMS-Addition (https://github.com/Minecraft-AMS/Carpet-AMS-Add Licensed under: LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html) diff --git a/net/minecraft/world/level/block/state/pattern/BlockPattern.java b/net/minecraft/world/level/block/state/pattern/BlockPattern.java -index f7bb979f08634a7e1b77c59040f59fb5e11aafa5..e0eca73d9e8a77b2a4972db61001394c6bf1d2c4 100644 +index f834d487136627c07c893b8d68a6929ed46f20b9..681a2d480606387437e25d99cff15905c37399ef 100644 --- a/net/minecraft/world/level/block/state/pattern/BlockPattern.java +++ b/net/minecraft/world/level/block/state/pattern/BlockPattern.java -@@ -59,7 +59,7 @@ public class BlockPattern { +@@ -57,7 +57,7 @@ public class BlockPattern { + return this.matches(pos, finger, thumb, loadingCache); } - @Nullable -- private BlockPattern.BlockPatternMatch matches(BlockPos pos, Direction finger, Direction thumb, LoadingCache cache) { -+ public BlockPattern.BlockPatternMatch matches(BlockPos pos, Direction finger, Direction thumb, LoadingCache cache) { // DivineMC - Carpet-AMS-Addition: Optimized dragon respawn - make public +- private BlockPattern.@Nullable BlockPatternMatch matches(BlockPos pos, Direction finger, Direction thumb, LoadingCache cache) { ++ public BlockPattern.@Nullable BlockPatternMatch matches(BlockPos pos, Direction finger, Direction thumb, LoadingCache cache) { // DivineMC - Carpet-AMS-Addition: Optimized dragon respawn - make public for (int i = 0; i < this.width; i++) { 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 fcb0fb9ca663ec40e1541d099bc3d710963f6c9d..db9843fddf43bdc287978728f08230c0e6178195 100644 +index cb6e5f2ad837a0eb11ceccee297f557f4355d304..072d5716a8fbec5c9c5ae78fa9591cf3c22ca755 100644 --- a/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -274,8 +274,68 @@ public class EndDragonFight { +@@ -270,7 +270,68 @@ public class EndDragonFight { return false; } @@ -36,9 +36,10 @@ index fcb0fb9ca663ec40e1541d099bc3d710963f6c9d..db9843fddf43bdc287978728f08230c0 + private int cachePortalChunkIteratorX = -8; + private int cachePortalChunkIteratorZ = -8; + private int cachePortalOriginIteratorY = -1; ++ // DivineMC end - Carpet-AMS-Addition: Optimized dragon respawn + - @Nullable - public BlockPattern.BlockPatternMatch findExitPortal() { + public BlockPattern.@Nullable BlockPatternMatch findExitPortal() { ++ // DivineMC start - Carpet-AMS-Addition: Optimized dragon respawn + if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.optimizedDragonRespawn) { + int i, j; + for (i = cachePortalChunkIteratorX; i <= 8; ++i) { @@ -92,12 +93,11 @@ index fcb0fb9ca663ec40e1541d099bc3d710963f6c9d..db9843fddf43bdc287978728f08230c0 + + return null; + } -+ // DivineMC end - Carpet-AMS-Addition: Optimized dragon respawn -+ ++ // DivineMC end - Carpet-AMS-Addition: Optimized dragon respawn ChunkPos chunkPos = new ChunkPos(this.origin); for (int i = -8 + chunkPos.x; i <= 8 + chunkPos.x; i++) { -@@ -573,6 +633,11 @@ public class EndDragonFight { +@@ -567,6 +628,11 @@ public class EndDragonFight { } public boolean respawnDragon(List crystals) { // CraftBukkit - return boolean diff --git a/divinemc-server/minecraft-patches/features/0022-Option-to-disable-disconnect.spam.patch b/divinemc-server/minecraft-patches/features/0022-Option-to-disable-disconnect.spam.patch index 69287b4..b0cc61c 100644 --- a/divinemc-server/minecraft-patches/features/0022-Option-to-disable-disconnect.spam.patch +++ b/divinemc-server/minecraft-patches/features/0022-Option-to-disable-disconnect.spam.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Option to disable disconnect.spam diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2ce82bb127978bf77812bb8cb526507f6985a92a..151e7113ed1a4906b97cea7d34aa522900c4ee3f 100644 +index bb030b5a2ea38ee2ca3387eb9c92b1911ccad15a..62ac7576b2b1e2e214bcd2d9d35a20d2e9e4bd99 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -853,7 +853,7 @@ public class ServerGamePacketListenerImpl +@@ -863,7 +863,7 @@ public class ServerGamePacketListenerImpl public void handleCustomCommandSuggestions(ServerboundCommandSuggestionPacket packet) { // PacketUtils.ensureRunningOnSameThread(packet, this, this.player.level()); // Paper - AsyncTabCompleteEvent; run this async // CraftBukkit start @@ -17,7 +17,7 @@ index 2ce82bb127978bf77812bb8cb526507f6985a92a..151e7113ed1a4906b97cea7d34aa5229 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - Kick event cause // Paper - add proper async disconnect return; } -@@ -865,7 +865,7 @@ public class ServerGamePacketListenerImpl +@@ -875,7 +875,7 @@ public class ServerGamePacketListenerImpl // Paper end - Don't suggest if tab-complete is disabled // Paper start final int index; @@ -26,7 +26,7 @@ index 2ce82bb127978bf77812bb8cb526507f6985a92a..151e7113ed1a4906b97cea7d34aa5229 this.disconnectAsync(Component.translatable("disconnect.spam"), org.bukkit.event.player.PlayerKickEvent.Cause.SPAM); // Paper - add proper async disconnect return; } -@@ -925,6 +925,7 @@ public class ServerGamePacketListenerImpl +@@ -935,6 +935,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,7 +34,7 @@ index 2ce82bb127978bf77812bb8cb526507f6985a92a..151e7113ed1a4906b97cea7d34aa5229 && 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; -@@ -2639,6 +2640,7 @@ public class ServerGamePacketListenerImpl +@@ -2679,6 +2680,7 @@ public class ServerGamePacketListenerImpl // this.chatSpamThrottler.increment(); if (!this.chatSpamThrottler.isIncrementAndUnderThreshold() // CraftBukkit end @@ -42,7 +42,7 @@ index 2ce82bb127978bf77812bb8cb526507f6985a92a..151e7113ed1a4906b97cea7d34aa5229 && !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 -@@ -3349,7 +3351,7 @@ public class ServerGamePacketListenerImpl +@@ -3392,7 +3394,7 @@ public class ServerGamePacketListenerImpl public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { diff --git a/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch index de5154a..00bc08f 100644 --- a/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch +++ b/divinemc-server/minecraft-patches/features/0023-Option-to-disable-saving-of-snowball-and-firework.patch @@ -5,10 +5,10 @@ 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 145ed3c5f5823c7505767b6d7f4f4d16cc863948..d0624f0ecc2305b9c04bc299f8b575fd039876fa 100644 +index 1b633d2eb77704fd9a6358f09ed368fab2a5b212..4261db541a407378c1f89f4a33646269b59bd33a 100644 --- a/net/minecraft/world/entity/projectile/FireworkRocketEntity.java +++ b/net/minecraft/world/entity/projectile/FireworkRocketEntity.java -@@ -351,4 +351,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { +@@ -350,4 +350,14 @@ public class FireworkRocketEntity extends Projectile implements ItemSupplier { double d1 = entity.position().z - this.position().z; return DoubleDoubleImmutablePair.of(d, d1); } @@ -23,10 +23,10 @@ index 145ed3c5f5823c7505767b6d7f4f4d16cc863948..d0624f0ecc2305b9c04bc299f8b575fd + } + // 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 6e6e10140381b63f9833e704f5d35d7e74ac7e66..97e6628e0717b3d11b91b5eead7b3b4373966e05 100644 ---- a/net/minecraft/world/entity/projectile/Snowball.java -+++ b/net/minecraft/world/entity/projectile/Snowball.java +diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java +index 3dfe7eef12d40d986d2eb3f750b09b47ee04aecc..448f9564abad3781b10525949fb0ba5413a87cd4 100644 +--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java ++++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java @@ -95,4 +95,14 @@ public class Snowball extends ThrowableItemProjectile { this.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.HIT); // CraftBukkit - add Bukkit remove cause } diff --git a/divinemc-server/minecraft-patches/features/0024-Snowball-and-Egg-knockback.patch b/divinemc-server/minecraft-patches/features/0024-Snowball-and-Egg-knockback.patch index 8db52d1..c9eac0b 100644 --- a/divinemc-server/minecraft-patches/features/0024-Snowball-and-Egg-knockback.patch +++ b/divinemc-server/minecraft-patches/features/0024-Snowball-and-Egg-knockback.patch @@ -4,10 +4,10 @@ Date: Sat, 1 Feb 2025 19:24:47 +0300 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 97e6628e0717b3d11b91b5eead7b3b4373966e05..7afe2ce589a3c25ddabc707c7580751834c1940a 100644 ---- a/net/minecraft/world/entity/projectile/Snowball.java -+++ b/net/minecraft/world/entity/projectile/Snowball.java +diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java +index 448f9564abad3781b10525949fb0ba5413a87cd4..1ea3b5fdcb9ce48e7ba0fe31dd39cab1c8ab1282 100644 +--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java ++++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/Snowball.java @@ -55,6 +55,12 @@ public class Snowball extends ThrowableItemProjectile { Entity entity = result.getEntity(); int i = entity.level().purpurConfig.snowballDamage >= 0 ? entity.level().purpurConfig.snowballDamage : entity instanceof Blaze ? 3 : 0; // Purpur - Add configurable snowball damage @@ -21,10 +21,10 @@ index 97e6628e0717b3d11b91b5eead7b3b4373966e05..7afe2ce589a3c25ddabc707c75807518 } // 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 bbb364be2af16a3c200d2197166bb3ad28e5e35d..ff0453123efb7a751d576e5bd2864fa495f8ef3d 100644 ---- a/net/minecraft/world/entity/projectile/ThrownEgg.java -+++ b/net/minecraft/world/entity/projectile/ThrownEgg.java +diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEgg.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEgg.java +index c7db74ccc3f8c46e97c24857f297fe5fb5f45e36..13c91d42a6ca4f2b4baa66a8ca73a391bf128ce7 100644 +--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEgg.java ++++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEgg.java @@ -55,7 +55,14 @@ public class ThrownEgg extends ThrowableItemProjectile { @Override protected void onHitEntity(EntityHitResult result) { diff --git a/divinemc-server/minecraft-patches/features/0026-Reduce-chunk-loading-lookups.patch b/divinemc-server/minecraft-patches/features/0026-Reduce-chunk-loading-lookups.patch index 7433f47..1c91250 100644 --- a/divinemc-server/minecraft-patches/features/0026-Reduce-chunk-loading-lookups.patch +++ b/divinemc-server/minecraft-patches/features/0026-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 e4d6610c43a019e9e1e296703e80eecc4ffdd36c..5607e5712795a0c979bc11ac335f9bb38668d503 100644 +index c90a955b14ae10037f31c7e9b8a86df3323602cc..ac363aef23dec6d76bca9b4d5a6e85b908beabae 100644 --- a/net/minecraft/world/entity/monster/EnderMan.java +++ b/net/minecraft/world/entity/monster/EnderMan.java -@@ -336,11 +336,28 @@ public class EnderMan extends Monster implements NeutralMob { +@@ -334,11 +334,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/divinemc-server/minecraft-patches/features/0027-Configurable-movement-speed-for-entities.patch b/divinemc-server/minecraft-patches/features/0027-Configurable-movement-speed-for-entities.patch index c715ca1..40f32ee 100644 --- a/divinemc-server/minecraft-patches/features/0027-Configurable-movement-speed-for-entities.patch +++ b/divinemc-server/minecraft-patches/features/0027-Configurable-movement-speed-for-entities.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 23 Mar 2025 01:26:54 +0300 +Date: Wed, 10 Dec 2025 22:45:49 +0300 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 5a947d7fbf1a08011d87f71b96a8f221130fb583..28fb51950c38ffbc88c3e01c113310fd2bccd097 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 { +diff --git a/net/minecraft/world/entity/monster/zombie/Drowned.java b/net/minecraft/world/entity/monster/zombie/Drowned.java +index abafb96df26b3d987ce3ec3e1e96e8fc20cb5b6b..e7724c599c0b69bf786041db647a170c9b0a2a71 100644 +--- a/net/minecraft/world/entity/monster/zombie/Drowned.java ++++ b/net/minecraft/world/entity/monster/zombie/Drowned.java +@@ -101,6 +101,7 @@ public class Drowned extends Zombie implements RangedAttackMob { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.drownedMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.drownedScale); @@ -16,11 +16,11 @@ index 5a947d7fbf1a08011d87f71b96a8f221130fb583..28fb51950c38ffbc88c3e01c113310fd } @Override -diff --git a/net/minecraft/world/entity/monster/Husk.java b/net/minecraft/world/entity/monster/Husk.java -index ef261e61358bf466bdfdd6cfe982c5afe53d7c4d..354f6b4c26194fe836ed89bff65aba31b464779f 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 { +diff --git a/net/minecraft/world/entity/monster/zombie/Husk.java b/net/minecraft/world/entity/monster/zombie/Husk.java +index ef289dd3fe0be980c200affb0b84a1066fe52232..3c362657d7f60c5aa5cad3c289eb42a636ede8c5 100644 +--- a/net/minecraft/world/entity/monster/zombie/Husk.java ++++ b/net/minecraft/world/entity/monster/zombie/Husk.java +@@ -51,6 +51,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); @@ -28,10 +28,10 @@ index ef261e61358bf466bdfdd6cfe982c5afe53d7c4d..354f6b4c26194fe836ed89bff65aba31 } @Override -diff --git a/net/minecraft/world/entity/monster/Zombie.java b/net/minecraft/world/entity/monster/Zombie.java -index 2dd08e5ef413c37a682046071b83f595c8499cf2..042fd91c2534fc07c3a34892a2e83940de245704 100644 ---- a/net/minecraft/world/entity/monster/Zombie.java -+++ b/net/minecraft/world/entity/monster/Zombie.java +diff --git a/net/minecraft/world/entity/monster/zombie/Zombie.java b/net/minecraft/world/entity/monster/zombie/Zombie.java +index f14fc03577a94dc6bd6e536e819a32c2d6144f02..47759fce571e0f7b8b3979fd3451d7fbd04ad22c 100644 +--- a/net/minecraft/world/entity/monster/zombie/Zombie.java ++++ b/net/minecraft/world/entity/monster/zombie/Zombie.java @@ -126,6 +126,7 @@ public class Zombie extends Monster { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth); @@ -40,7 +40,7 @@ index 2dd08e5ef413c37a682046071b83f595c8499cf2..042fd91c2534fc07c3a34892a2e83940 } // Purpur end - Configurable entity base attributes -@@ -193,7 +194,6 @@ public class Zombie extends Monster { +@@ -194,7 +195,6 @@ public class Zombie extends Monster { public static AttributeSupplier.Builder createAttributes() { return Monster.createMonsterAttributes() .add(Attributes.FOLLOW_RANGE, 35.0) @@ -48,11 +48,11 @@ index 2dd08e5ef413c37a682046071b83f595c8499cf2..042fd91c2534fc07c3a34892a2e83940 .add(Attributes.ATTACK_DAMAGE, 3.0) .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 671afcaa17bac0235e362797320118864fec7e66..49a211381c60c2739b03127f8f98c7d8fbfcc9f1 100644 ---- a/net/minecraft/world/entity/monster/ZombieVillager.java -+++ b/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -96,6 +96,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { +diff --git a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java +index 492f963daa12931e9712cd3bbd845ba852981e92..6011186c07a3295bbd613805f43d23473cd3b206 100644 +--- a/net/minecraft/world/entity/monster/zombie/ZombieVillager.java ++++ b/net/minecraft/world/entity/monster/zombie/ZombieVillager.java +@@ -106,6 +106,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); @@ -60,10 +60,10 @@ index 671afcaa17bac0235e362797320118864fec7e66..49a211381c60c2739b03127f8f98c7d8 } @Override -diff --git a/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index 05bbd9588ae85256c46d8b0c2434a3bc8cb5f620..532c196ed57542844b9ab63a36cfd610535a2feb 100644 ---- a/net/minecraft/world/entity/monster/ZombifiedPiglin.java -+++ b/net/minecraft/world/entity/monster/ZombifiedPiglin.java +diff --git a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java +index 528baf4ca71725d4af6876d195b6d75fdab5ca58..2964fd753953d2f4d38b2e1a33f702b69cff4f73 100644 +--- a/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java ++++ b/net/minecraft/world/entity/monster/zombie/ZombifiedPiglin.java @@ -86,6 +86,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombifiedPiglinMaxHealth); @@ -72,7 +72,7 @@ index 05bbd9588ae85256c46d8b0c2434a3bc8cb5f620..532c196ed57542844b9ab63a36cfd610 } // Purpur end - Configurable entity base attributes -@@ -137,7 +138,6 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { +@@ -133,7 +134,6 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { public static AttributeSupplier.Builder createAttributes() { return Zombie.createAttributes() .add(Attributes.SPAWN_REINFORCEMENTS_CHANCE, 0.0) diff --git a/divinemc-server/minecraft-patches/features/0028-Option-to-allow-weird-movement-and-disable-teleporti.patch b/divinemc-server/minecraft-patches/features/0028-Option-to-allow-weird-movement-and-disable-teleporti.patch index 801c3b4..8499918 100644 --- a/divinemc-server/minecraft-patches/features/0028-Option-to-allow-weird-movement-and-disable-teleporti.patch +++ b/divinemc-server/minecraft-patches/features/0028-Option-to-allow-weird-movement-and-disable-teleporti.patch @@ -6,10 +6,10 @@ 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 151e7113ed1a4906b97cea7d34aa522900c4ee3f..93885af89a402bdadaccd598c7c2939c96fdf6e4 100644 +index 62ac7576b2b1e2e214bcd2d9d35a20d2e9e4bd99..358ea5d52a2e1df9b885bd58a7681b4009361263 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -618,7 +618,7 @@ public class ServerGamePacketListenerImpl +@@ -628,7 +628,7 @@ public class ServerGamePacketListenerImpl return; } // Paper end - Prevent moving into unloaded chunks @@ -18,7 +18,7 @@ index 151e7113ed1a4906b97cea7d34aa522900c4ee3f..93885af89a402bdadaccd598c7c2939c // CraftBukkit end LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", rootVehicle.getPlainTextName(), this.player.getPlainTextName(), d3, d4, d5); this.send(ClientboundMoveVehiclePacket.fromEntity(rootVehicle)); -@@ -646,7 +646,7 @@ public class ServerGamePacketListenerImpl +@@ -656,7 +656,7 @@ public class ServerGamePacketListenerImpl d5 = d2 - rootVehicle.getZ(); d7 = d3 * d3 + d4 * d4 + d5 * d5; boolean flag1 = false; @@ -27,7 +27,7 @@ index 151e7113ed1a4906b97cea7d34aa522900c4ee3f..93885af89a402bdadaccd598c7c2939c flag1 = true; // Paper - diff on change, this should be moved wrongly LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", rootVehicle.getPlainTextName(), this.player.getPlainTextName(), Math.sqrt(d7)); } -@@ -1563,20 +1563,24 @@ public class ServerGamePacketListenerImpl +@@ -1587,20 +1587,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))) { @@ -63,7 +63,7 @@ index 151e7113ed1a4906b97cea7d34aa522900c4ee3f..93885af89a402bdadaccd598c7c2939c } } } -@@ -1637,6 +1641,7 @@ public class ServerGamePacketListenerImpl +@@ -1661,6 +1665,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/divinemc-server/minecraft-patches/features/0029-Optimize-Raids.patch b/divinemc-server/minecraft-patches/features/0029-Optimize-Raids.patch index 0ca430c..d89d25b 100644 --- a/divinemc-server/minecraft-patches/features/0029-Optimize-Raids.patch +++ b/divinemc-server/minecraft-patches/features/0029-Optimize-Raids.patch @@ -1,14 +1,14 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Sun, 6 Apr 2025 20:53:48 +0300 +Date: Wed, 10 Dec 2025 22:47:51 +0300 Subject: [PATCH] Optimize Raids diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index d182aafc4c8b4ea657ec3228c45fb29f05ff8d75..3275a8a3a57a6d836170efbf12bc1257282703c8 100644 +index 857a1ac427644a1f24a8564041ba3f41da540ef4..477cb54c89b59812af74758c841fb714a39bf6c5 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -223,6 +223,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -229,6 +229,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 d182aafc4c8b4ea657ec3228c45fb29f05ff8d75..3275a8a3a57a6d836170efbf12bc1257 @Override public @Nullable LevelChunk getChunkIfLoaded(int x, int z) { -@@ -718,6 +719,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -728,6 +729,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 d182aafc4c8b4ea657ec3228c45fb29f05ff8d75..3275a8a3a57a6d836170efbf12bc1257 // Paper start diff --git a/net/minecraft/world/entity/raid/Raid.java b/net/minecraft/world/entity/raid/Raid.java -index adae4ef6b2f5019b79838eddf0255200096bccd9..97b9676c03b4b2d2aea7fd7c7dff3e6c4cecd57f 100644 +index 8aa049d80cf74fb7ea525e0dc648741ddc788e3e..27c469462d54b6a8cf0b42b9d6ccacdc9488e556 100644 --- a/net/minecraft/world/entity/raid/Raid.java +++ b/net/minecraft/world/entity/raid/Raid.java -@@ -128,6 +128,7 @@ public class Raid { +@@ -127,6 +127,7 @@ public class Raid { private Raid.RaidStatus status; private int celebrationTicks; private Optional waveSpawnPos = Optional.empty(); @@ -36,7 +36,7 @@ index adae4ef6b2f5019b79838eddf0255200096bccd9..97b9676c03b4b2d2aea7fd7c7dff3e6c public Raid(BlockPos center, Difficulty difficulty) { this.active = true; -@@ -280,6 +281,12 @@ public class Raid { +@@ -279,6 +280,12 @@ public class Raid { } public void tick(ServerLevel level) { @@ -49,7 +49,7 @@ index adae4ef6b2f5019b79838eddf0255200096bccd9..97b9676c03b4b2d2aea7fd7c7dff3e6c if (!this.isStopped()) { if (this.status == Raid.RaidStatus.ONGOING) { boolean flag = this.active; -@@ -610,7 +617,7 @@ public class Raid { +@@ -609,7 +616,7 @@ public class Raid { } public void updateBossbar() { @@ -59,10 +59,10 @@ index adae4ef6b2f5019b79838eddf0255200096bccd9..97b9676c03b4b2d2aea7fd7c7dff3e6c public float getHealthOfLivingRaiders() { diff --git a/net/minecraft/world/entity/raid/Raider.java b/net/minecraft/world/entity/raid/Raider.java -index 4d72b60489e9c684905ca251ead011aaa8ce1cdd..692701bf46f980c11af9735d48ca58532ba7f4d6 100644 +index b03faa7600f182a12c3a739deefc38028cf45615..fd7ee7d014b696c354357c871b546b2fb3859294 100644 --- a/net/minecraft/world/entity/raid/Raider.java +++ b/net/minecraft/world/entity/raid/Raider.java -@@ -43,9 +43,25 @@ import net.minecraft.world.phys.Vec3; +@@ -43,9 +43,25 @@ import org.jspecify.annotations.Nullable; public abstract class Raider extends PatrollingMonster { protected static final EntityDataAccessor IS_CELEBRATING = SynchedEntityData.defineId(Raider.class, EntityDataSerializers.BOOLEAN); @@ -90,8 +90,8 @@ index 4d72b60489e9c684905ca251ead011aaa8ce1cdd..692701bf46f980c11af9735d48ca5853 + // DivineMC end - Optimize Raids private static final int DEFAULT_WAVE = 0; private static final boolean DEFAULT_CAN_JOIN_RAID = false; - @Nullable -@@ -150,7 +166,7 @@ public abstract class Raider extends PatrollingMonster { + protected @Nullable Raid raid; +@@ -148,7 +164,7 @@ public abstract class Raider extends PatrollingMonster { public boolean isCaptain() { ItemStack itemBySlot = this.getItemBySlot(EquipmentSlot.HEAD); boolean flag = !itemBySlot.isEmpty() @@ -100,7 +100,7 @@ index 4d72b60489e9c684905ca251ead011aaa8ce1cdd..692701bf46f980c11af9735d48ca5853 boolean isPatrolLeader = this.isPatrolLeader(); return flag && isPatrolLeader; } -@@ -213,7 +229,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -211,7 +227,7 @@ public abstract class Raider extends PatrollingMonster { boolean flag = this.hasActiveRaid() && this.getCurrentRaid().getLeader(this.getWave()) != null; if (this.hasActiveRaid() && !flag @@ -109,7 +109,7 @@ index 4d72b60489e9c684905ca251ead011aaa8ce1cdd..692701bf46f980c11af9735d48ca5853 // Paper start - EntityPickupItemEvent fixes if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityPickupItemEvent(this, entity, 0, false).isCancelled()) { return; -@@ -400,6 +416,16 @@ public abstract class Raider extends PatrollingMonster { +@@ -395,6 +411,16 @@ public abstract class Raider extends PatrollingMonster { && !this.cannotPickUpBanner(); } @@ -124,9 +124,9 @@ index 4d72b60489e9c684905ca251ead011aaa8ce1cdd..692701bf46f980c11af9735d48ca5853 + // DivineMC end - Optimize Raids + private boolean cannotPickUpBanner() { - if (!getServerLevel(this.mob).getGameRules().getBoolean(net.minecraft.world.level.GameRules.RULE_MOBGRIEFING, this.mob.level().purpurConfig.pillagerMobGriefingOverride)) return true; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing override to everything affected + if (!getServerLevel(this.mob).getGameRules().get(net.minecraft.world.level.gamerules.GameRules.MOB_GRIEFING, this.mob.level().purpurConfig.pillagerMobGriefingOverride)) return true; // Paper - respect game and entity rules for picking up items // Purpur - Add mobGriefing override to everything affected if (!this.mob.hasActiveRaid()) { -@@ -409,7 +435,7 @@ public abstract class Raider extends PatrollingMonster { +@@ -404,7 +430,7 @@ public abstract class Raider extends PatrollingMonster { } else if (!this.mob.canBeLeader()) { return true; } else if (ItemStack.matches( diff --git a/divinemc-server/minecraft-patches/features/0032-Optimize-Fluids.patch b/divinemc-server/minecraft-patches/features/0032-Optimize-Fluids.patch index 098554f..3273d34 100644 --- a/divinemc-server/minecraft-patches/features/0032-Optimize-Fluids.patch +++ b/divinemc-server/minecraft-patches/features/0032-Optimize-Fluids.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Optimize Fluids diff --git a/net/minecraft/world/level/block/LiquidBlock.java b/net/minecraft/world/level/block/LiquidBlock.java -index 8c00026651da489ab954710b59d5a03bf54ffd0d..6b55c4110ebf0c8fa74ede3d33bd4ad121c51908 100644 +index 2a21f04b39507bc76c7ddf18cac4d3ec2532540f..66bcca51be89536c5e176cece02e33eae37818a9 100644 --- a/net/minecraft/world/level/block/LiquidBlock.java +++ b/net/minecraft/world/level/block/LiquidBlock.java @@ -199,6 +199,7 @@ public class LiquidBlock extends Block implements BucketPickup { @@ -132,10 +132,10 @@ index 9685d02a9837c773094a5da5cff6fa6fcfeed86a..afab54ffe92241f8d549ebe9745a0b47 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 4df0dad91a5beeb0443ac1849e7783c470aae3d3..b7c01dadd69ce314ef6066d4c5d7c27080c7af8f 100644 +index 9d93ca788ee18988ec8b4d069339fab47b1a1fb9..e0924cf9201a6d24f5deb9dcd924822228ce5b51 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -239,6 +239,7 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -237,6 +237,7 @@ public abstract class LavaFluid extends FlowingFluid { // CraftBukkit end } diff --git a/divinemc-server/minecraft-patches/features/0033-Optimize-Structure-Generation.patch b/divinemc-server/minecraft-patches/features/0033-Optimize-Structure-Generation.patch index 3f51d48..75734d4 100644 --- a/divinemc-server/minecraft-patches/features/0033-Optimize-Structure-Generation.patch +++ b/divinemc-server/minecraft-patches/features/0033-Optimize-Structure-Generation.patch @@ -7,19 +7,10 @@ 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 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5980f5d4b 100644 +index 12a8c5d85c9b6a433b90ae98743e78a48bf1e7d4..ae25d2b544f61bec142e38f299331f67a3f2d8bf 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; - import com.mojang.logging.LogUtils; - import java.util.List; - import java.util.Optional; -+import java.util.ArrayList; -+import java.util.LinkedHashSet; - import net.minecraft.core.BlockPos; - import net.minecraft.core.Direction; - import net.minecraft.core.Holder; -@@ -288,6 +290,108 @@ public class JigsawPlacement { +@@ -286,6 +286,108 @@ public class JigsawPlacement { this.random = random; } @@ -48,7 +39,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 + } + + // Linked hashset keeps order of elements. -+ LinkedHashSet uniquePieces = new LinkedHashSet<>((instance).rawTemplates.size()); ++ java.util.LinkedHashSet uniquePieces = new java.util.LinkedHashSet<>((instance).rawTemplates.size()); + + // Don't use addAll. Want to keep it simple in case of inefficiency in collection's addAll. + // Set will ignore duplicates after first appearance of an element. @@ -59,7 +50,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 + + // Move the elements from set to the list in the same order. + int uniquePiecesFound = uniquePieces.size(); -+ List deduplicatedListOfPieces = new ArrayList<>(uniquePiecesFound); ++ List deduplicatedListOfPieces = new java.util.ArrayList<>(uniquePiecesFound); + for (int i = 0; i < uniquePiecesFound; i++) { + deduplicatedListOfPieces.add(uniquePieces.removeFirst()); + } @@ -67,7 +58,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 + return deduplicatedListOfPieces; + } + -+ private ArrayList structureLayoutOptimizer$skipDuplicateTemplatePoolElementLists1() { ++ private java.util.ArrayList structureLayoutOptimizer$skipDuplicateTemplatePoolElementLists1() { + // Swap with trojan list, so we can record what pieces we visited + return org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.deduplicateShuffledTemplatePoolElementList ? Lists.newArrayList() : new org.bxteam.divinemc.util.structure.TrojanArrayList<>(); + } @@ -88,7 +79,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 + StructureTemplatePool.Projection candidatePlacementBehavior = structurePoolElement.getProjection(); + boolean isCandidateRigid = candidatePlacementBehavior == StructureTemplatePool.Projection.RIGID; + if (isCandidateRigid && (!trojanVoxelShape.boxOctree.boundaryContains(parentTargetPosition) || trojanVoxelShape.boxOctree.withinAnyBox(parentTargetPosition))) { -+ return new ArrayList<>(); ++ return new java.util.ArrayList<>(); + } + } + return original; @@ -112,7 +103,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 + } + + // Short circuit the Rotation loop -+ return new ArrayList<>(); ++ return new java.util.ArrayList<>(); + } + // Record piece as it will go through the 4 rotation checks for spawning. + else { @@ -128,7 +119,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 void tryPlacingChildren( PoolElementStructurePiece piece, MutableObject free, -@@ -345,9 +449,9 @@ public class JigsawPlacement { +@@ -343,9 +445,9 @@ public class JigsawPlacement { mutableObject1 = free; } @@ -140,7 +131,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 } list.addAll(fallback.value().getShuffledTemplates(this.random)); -@@ -358,10 +462,14 @@ public class JigsawPlacement { +@@ -356,10 +458,14 @@ public class JigsawPlacement { break; } @@ -157,7 +148,7 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 BoundingBox boundingBox1 = structurePoolElement.getBoundingBox(this.structureTemplateManager, BlockPos.ZERO, rotation1); int i2; if (useExpansionHack && boundingBox1.getYSpan() <= 16) { -@@ -394,7 +502,7 @@ public class JigsawPlacement { +@@ -392,7 +498,7 @@ public class JigsawPlacement { } for (StructureTemplate.JigsawBlockInfo jigsawBlockInfo1 : shuffledJigsawBlocks) { @@ -166,16 +157,16 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 BlockPos blockPos2 = jigsawBlockInfo1.info().pos(); BlockPos blockPos3 = blockPos1.subtract(blockPos2); BoundingBox boundingBox2 = structurePoolElement.getBoundingBox(this.structureTemplateManager, blockPos3, rotation1); -@@ -423,9 +531,26 @@ public class JigsawPlacement { +@@ -421,9 +527,26 @@ public class JigsawPlacement { boundingBox3.encapsulate(new BlockPos(boundingBox3.minX(), boundingBox3.minY() + max, boundingBox3.minZ())); } - if (!Shapes.joinIsNotEmpty( -- mutableObject1.getValue(), Shapes.create(AABB.of(boundingBox3).deflate(0.25)), BooleanOp.ONLY_SECOND +- mutableObject1.get(), Shapes.create(AABB.of(boundingBox3).deflate(0.25)), BooleanOp.ONLY_SECOND - )) { + // DivineMC start - Optimize Structure Generation + boolean internal$joinIsNotEmpty; -+ VoxelShape parentBounds = mutableObject1.getValue(); ++ VoxelShape parentBounds = mutableObject1.get(); + java.util.function.Supplier original = () -> Shapes.joinIsNotEmpty( + parentBounds, Shapes.create(AABB.of(boundingBox3).deflate(0.25)), BooleanOp.ONLY_SECOND + ); @@ -194,13 +185,13 @@ index 103d604797bed34c2e357d01c2f7324dea3e9026..4aa68163958e89521f542470c473f8d5 + if (!internal$joinIsNotEmpty) { + // DivineMC end - Optimize Structure Generation mutableObject1.setValue( - Shapes.joinUnoptimized( - mutableObject1.getValue(), Shapes.create(AABB.of(boundingBox3)), BooleanOp.ONLY_FIRST + Shapes.joinUnoptimized(mutableObject1.get(), Shapes.create(AABB.of(boundingBox3)), BooleanOp.ONLY_FIRST) + ); diff --git a/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java b/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java -index 0e107da76f267e8987b97c976a17e85cd5b8a341..f76a26a471dfe2f261b15d0ebbe3602cd05aaa4e 100644 +index d6ee47406d65f66c2559242816471add8c3f9f8f..a79af6c4820f391e56ca90b5dc2bcb15fefe7e30 100644 --- a/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java +++ b/net/minecraft/world/level/levelgen/structure/pools/SinglePoolElement.java -@@ -120,8 +120,16 @@ public class SinglePoolElement extends StructurePoolElement { +@@ -118,8 +118,16 @@ public class SinglePoolElement extends StructurePoolElement { StructureTemplateManager structureTemplateManager, BlockPos pos, Rotation rotation, RandomSource random ) { List jigsaws = this.getTemplate(structureTemplateManager).getJigsaws(pos, rotation); @@ -219,8 +210,8 @@ index 0e107da76f267e8987b97c976a17e85cd5b8a341..f76a26a471dfe2f261b15d0ebbe3602c return jigsaws; } -@@ -197,4 +205,12 @@ public class SinglePoolElement extends StructurePoolElement { - public ResourceLocation getTemplateLocation() { +@@ -195,4 +203,12 @@ public class SinglePoolElement extends StructurePoolElement { + public Identifier getTemplateLocation() { return this.template.orThrow(); } + @@ -233,7 +224,7 @@ index 0e107da76f267e8987b97c976a17e85cd5b8a341..f76a26a471dfe2f261b15d0ebbe3602c + // 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 a2405124c0d04827b9a98883e587729646df456f..da67064ed98d343e0b303819a8fdf5c48cc33b43 100644 +index dd804657ed9935155aaaacfd5a1738df39d016e8..e7f672e07b6e920d5088b0dce5a2939cbd2bc9a4 100644 --- a/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java +++ b/net/minecraft/world/level/levelgen/structure/templatesystem/StructureTemplate.java @@ -256,6 +256,12 @@ public class StructureTemplate { @@ -246,10 +237,10 @@ index a2405124c0d04827b9a98883e587729646df456f..da67064ed98d343e0b303819a8fdf5c4 + } + // DivineMC end - Optimize Structure Generation + - public boolean placeInWorld(ServerLevelAccessor level, BlockPos offset, BlockPos pos, StructurePlaceSettings settings, RandomSource random, int flags) { - if (this.palettes.isEmpty()) { - return false; -@@ -273,7 +279,11 @@ public class StructureTemplate { + public boolean placeInWorld( + ServerLevelAccessor level, BlockPos offset, BlockPos pos, StructurePlaceSettings settings, RandomSource random, @Block.UpdateFlags int flags + ) { +@@ -275,7 +281,11 @@ public class StructureTemplate { } } // CraftBukkit end @@ -262,8 +253,8 @@ index a2405124c0d04827b9a98883e587729646df456f..da67064ed98d343e0b303819a8fdf5c4 if ((!list.isEmpty() || !settings.isIgnoreEntities() && !this.entityInfoList.isEmpty()) && this.size.getX() >= 1 && this.size.getY() >= 1 -@@ -885,7 +895,11 @@ public class StructureTemplate { - private List cachedJigsaws; +@@ -886,7 +896,11 @@ public class StructureTemplate { + private @Nullable List cachedJigsaws; Palette(List blocks) { - this.blocks = blocks; diff --git a/divinemc-server/minecraft-patches/features/0034-Implement-NoChatReports.patch b/divinemc-server/minecraft-patches/features/0034-Implement-NoChatReports.patch index 3ed4d41..15bd140 100644 --- a/divinemc-server/minecraft-patches/features/0034-Implement-NoChatReports.patch +++ b/divinemc-server/minecraft-patches/features/0034-Implement-NoChatReports.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement NoChatReports diff --git a/net/minecraft/network/FriendlyByteBuf.java b/net/minecraft/network/FriendlyByteBuf.java -index 9c57702310f710a83971faaf9f658610e47334df..ddf3e514310f7c8990acb7d9d733e5cc07f33eea 100644 +index f4bc9d05cd2349804eec832490fbb47862e5f073..85f0a693a8175174ca59ea4df235612046a3fbe5 100644 --- a/net/minecraft/network/FriendlyByteBuf.java +++ b/net/minecraft/network/FriendlyByteBuf.java @@ -105,7 +105,28 @@ public class FriendlyByteBuf extends ByteBuf { @@ -58,7 +58,7 @@ index 9c57702310f710a83971faaf9f658610e47334df..ddf3e514310f7c8990acb7d9d733e5cc this.writeUtf(GSON.toJson(dataResult.getOrThrow(exception -> new EncoderException("Failed to encode: " + exception + " " + value))), maxLength); // Paper - Adventure; add max length parameter } diff --git a/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java b/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java -index 07943553b562b95076bdce232d6f0796f469400f..478c07e8c569d35761ce138cf1deed9511b826d6 100644 +index 7f24fd1f5ff5100aeb404dc049af1893be824047..73d22322c08a57568e1310a40fe906f566b0c7d9 100644 --- a/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java +++ b/net/minecraft/network/protocol/game/ServerboundChatCommandSignedPacket.java @@ -36,4 +36,15 @@ public record ServerboundChatCommandSignedPacket( @@ -78,7 +78,7 @@ index 07943553b562b95076bdce232d6f0796f469400f..478c07e8c569d35761ce138cf1deed95 + // DivineMC end - Implement NoChatReports } diff --git a/net/minecraft/network/protocol/game/ServerboundChatPacket.java b/net/minecraft/network/protocol/game/ServerboundChatPacket.java -index b5afc05924ae899e020c303c8b86398e1d4ab8a0..2a6fdec4faae3512060cbb21a2043129765a480e 100644 +index 11d18c1c13e25c01c5e8f2e3363932d1fce16236..6cb7834e2f7a35d532afdc9c5a9699f30bf68bf2 100644 --- a/net/minecraft/network/protocol/game/ServerboundChatPacket.java +++ b/net/minecraft/network/protocol/game/ServerboundChatPacket.java @@ -36,4 +36,16 @@ public record ServerboundChatPacket(String message, Instant timeStamp, long salt @@ -206,7 +206,7 @@ index 88447fc2108126ccfad2fb7eb79ac94537f132d3..571cbe6844ebb330801dd893a45c1f73 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 6a8f501883a5b5697d3ebf401f6b7aa6145479ea..d2ac3057cd6d27c9f0ec043421cbb72b57853b97 100644 +index 684ce31d079a6669028eb7d87628d823066e3da4..f333e09da89ee7b8e1dff2e0f62aec4696715359 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java @@ -832,6 +832,7 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -218,7 +218,7 @@ index 6a8f501883a5b5697d3ebf401f6b7aa6145479ea..d2ac3057cd6d27c9f0ec043421cbb72b // 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 4a333e87af17bd5b673b57c0fa0d3a239fb8db59..e5569978a23c5bde673146421963a2ff0905d514 100644 +index 9b7dc6b3b1037fb2aa285c33537e9b5c342cdb39..28c61ccce5a71b8a3c3e87617907ced1fc45b68c 100644 --- a/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerCommonPacketListenerImpl.java @@ -344,10 +344,64 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -287,19 +287,19 @@ index 4a333e87af17bd5b673b57c0fa0d3a239fb8db59..e5569978a23c5bde673146421963a2ff if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 457dfcb459f2618e6975ab3e4ff37d5988dd50c2..42af746efa840152dfb0a8d73d9d227115254acc 100644 +index 0313586d4f5f8c21aa9e8367dc9ca072f3271d9e..6a5f955fda51bc607a81deeba97e7a489bd31fee 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -182,7 +182,7 @@ public abstract class PlayerList { - !_boolean, - _boolean2, +@@ -187,7 +187,7 @@ public abstract class PlayerList { + !flag, + flag2, player.createCommonSpawnInfo(serverLevel), - this.server.enforceSecureProfile() + org.bxteam.divinemc.config.DivineConfig.NetworkCategory.noChatReportsEnabled || this.server.enforceSecureProfile() // DivineMC - Implement NoChatReports ) ); player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit -@@ -1197,6 +1197,7 @@ public abstract class PlayerList { +@@ -1199,6 +1199,7 @@ public abstract class PlayerList { } public boolean verifyChatTrusted(PlayerChatMessage message) { diff --git a/divinemc-server/minecraft-patches/features/0035-Lag-compensation.patch b/divinemc-server/minecraft-patches/features/0035-Lag-compensation.patch index 1bbb59b..7d0fbae 100644 --- a/divinemc-server/minecraft-patches/features/0035-Lag-compensation.patch +++ b/divinemc-server/minecraft-patches/features/0035-Lag-compensation.patch @@ -3,12 +3,13 @@ From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> Date: Sat, 1 Feb 2025 18:38:26 +0300 Subject: [PATCH] Lag compensation +TODO: recheck GameRules diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 9180e8cdd4bfad33f8dcda0ac8785defff4a1dad..9a3bd9f646889f43393c3cf54f5bcfa33ec6bbd1 100644 +index c425b6a1f3cb2fb451671c1d5732f9352dac5bcf..eab57f8cc5b065e19728643f4ca1340d99751f92 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -287,6 +287,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop key) { -- return this.getRule(key).get(); -+ return lagCompensation(this.getRule(key).get(), key); // DivineMC - Lag compensation -+ } -+ -+ // DivineMC start - Lag compensation -+ private final java.util.concurrent.atomic.AtomicReference level = new java.util.concurrent.atomic.AtomicReference<>(); -+ -+ private int lagCompensation(int original, GameRules.Key rule) { -+ net.minecraft.server.level.ServerLevel level = getOrCacheLevel(); -+ if (!org.bxteam.divinemc.config.DivineConfig.MiscCategory.lagCompensationEnabled || !org.bxteam.divinemc.config.DivineConfig.MiscCategory.randomTickSpeedAcceleration) return original; -+ if (!(rule == GameRules.RULE_RANDOMTICKING)) return original; -+ return (int) (original * org.bxteam.divinemc.util.tps.TPSCalculator.MAX_TPS / (float) level.tpsCalculator.getMostAccurateTPS()); -+ } -+ -+ private net.minecraft.server.level.ServerLevel getOrCacheLevel() { -+ if (level.get() == null) { -+ for (final net.minecraft.server.level.ServerLevel level : MinecraftServer.getServer().getAllLevels()) { -+ if (level.getGameRules() == this) { -+ this.level.set(level); -+ break; -+ } -+ } -+ } -+ return level.get(); - } -+ // DivineMC end - Lag compensation - - public static class BooleanValue extends GameRules.Value { - private boolean value; + return !stack.has(DataComponents.BLOCKS_ATTACKS) && !stack.has(DataComponents.KINETIC_WEAPON) ? 0 : 72000; + } diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index f9794da266b5f08f01f88184d3bcca9d8371e44f..a6c99a119a923dd890169888ff4e9852f6e27855 100644 +index 430712393db078423d5d7e3391cc0a6833cab434..5ce545304d1ba80efaeb63367dbd34b2e17d64ed 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -350,13 +350,21 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -349,13 +349,21 @@ public abstract class BlockBehaviour implements FeatureElement { protected void tick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) { } @@ -248,10 +212,10 @@ index f9794da266b5f08f01f88184d3bcca9d8371e44f..a6c99a119a923dd890169888ff4e9852 } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 606c33d67fc7612b25ca23fe34769d3b179ebbd6..2d4807134e071254ce882e0bc4988242894c5d2f 100644 +index 1cea69f07a0b28cf8b112c202c668b915bf1b88f..63e391441f655138ddfd303270f33c7a35655ca5 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -953,6 +953,19 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -947,6 +947,19 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot this.ticker = ticker; } @@ -271,7 +235,7 @@ index 606c33d67fc7612b25ca23fe34769d3b179ebbd6..2d4807134e071254ce882e0bc4988242 @Override public void tick() { if (!this.blockEntity.isRemoved() && this.blockEntity.hasLevel()) { -@@ -961,7 +974,11 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -955,7 +968,11 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot try { BlockState blockState = LevelChunk.this.getBlockState(blockPos); if (this.blockEntity.getType().isValid(blockState)) { @@ -285,10 +249,10 @@ index 606c33d67fc7612b25ca23fe34769d3b179ebbd6..2d4807134e071254ce882e0bc4988242 // 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 ccbaed0f81c3edb25231037950bf1559ca3e616d..f9ad547c86d553b9cc7020d3966169f1fa23cd0d 100644 +index e0924cf9201a6d24f5deb9dcd924822228ce5b51..71539ed8c9a568ede5e681ca78fa3d7c41d7037c 100644 --- a/net/minecraft/world/level/material/LavaFluid.java +++ b/net/minecraft/world/level/material/LavaFluid.java -@@ -190,9 +190,22 @@ public abstract class LavaFluid extends FlowingFluid { +@@ -188,9 +188,22 @@ public abstract class LavaFluid extends FlowingFluid { return fluidState.getHeight(level, pos) >= 0.44444445F && fluid.is(FluidTags.WATER); } @@ -301,9 +265,9 @@ index ccbaed0f81c3edb25231037950bf1559ca3e616d..f9ad547c86d553b9cc7020d3966169f1 + @Override public int getTickDelay(LevelReader level) { -- return level.getWorldBorder().world != null ? (level.dimensionType().ultraWarm() ? level.getWorldBorder().world.purpurConfig.lavaSpeedNether : level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether) : (level.dimensionType().ultraWarm() ? 10 : 30); // Purpur - Make lava flow speed configurable +- return level.getWorldBorder().world != null ? (isFastLava(level) ? level.getWorldBorder().world.purpurConfig.lavaSpeedNether : level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether) : (isFastLava(level) ? 10 : 30); // Purpur - Make lava flow speed configurable + // DivineMC start - Lag compensation -+ int original = level.getWorldBorder().world != null ? (level.dimensionType().ultraWarm() ? level.getWorldBorder().world.purpurConfig.lavaSpeedNether : level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether) : (level.dimensionType().ultraWarm() ? 10 : 30); // Purpur - Make lava flow speed configurable ++ int original = level.getWorldBorder().world != null ? (isFastLava(level) ? level.getWorldBorder().world.purpurConfig.lavaSpeedNether : level.getWorldBorder().world.purpurConfig.lavaSpeedNotNether) : (isFastLava(level) ? 10 : 30); // Purpur - Make lava flow speed configurable + if (level instanceof ServerLevel serverLevel) { + return lagCompensation(original, serverLevel); + } @@ -313,10 +277,10 @@ index ccbaed0f81c3edb25231037950bf1559ca3e616d..f9ad547c86d553b9cc7020d3966169f1 @Override diff --git a/net/minecraft/world/level/material/WaterFluid.java b/net/minecraft/world/level/material/WaterFluid.java -index 19505eafb8b3aa09d7f889ecb62bcc28d835b4c8..790dcd8e71fc2e102a4aeae28b3a4a24680401ae 100644 +index 4533d9f76f4ea21cee3c3114bcfcded40fe7321b..55a3b79c902881852900c3f2ea6740caca66cd18 100644 --- a/net/minecraft/world/level/material/WaterFluid.java +++ b/net/minecraft/world/level/material/WaterFluid.java -@@ -124,8 +124,16 @@ public abstract class WaterFluid extends FlowingFluid { +@@ -123,8 +123,16 @@ public abstract class WaterFluid extends FlowingFluid { return 1; } diff --git a/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch b/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch index f11fe54..39f2ec4 100644 --- a/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch +++ b/divinemc-server/minecraft-patches/features/0036-Virtual-Threads.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Virtual Threads diff --git a/net/minecraft/commands/Commands.java b/net/minecraft/commands/Commands.java -index 9a7a40c1dcea57ba674d8431077d2477104a456f..8e41097f978800039e6e057c5bbcfcf03f5a9c89 100644 +index ace1dc38dac79298141bca666b188a4258183df7..e93294cbe2e5637257cdd189c800275588fb08ea 100644 --- a/net/minecraft/commands/Commands.java +++ b/net/minecraft/commands/Commands.java -@@ -482,7 +482,7 @@ public class Commands { +@@ -493,7 +493,7 @@ public class Commands { } // Fixed pool, but with discard policy @@ -18,10 +18,10 @@ index 9a7a40c1dcea57ba674d8431077d2477104a456f..8e41097f978800039e6e057c5bbcfcf0 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 9a3bd9f646889f43393c3cf54f5bcfa33ec6bbd1..21043f7ccc4a26ae5e016dd4e72092a032c3bddf 100644 +index eab57f8cc5b065e19728643f4ca1340d99751f92..56b2c8b781ad7d416ceb05f527826186bd39b188 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -2733,8 +2733,11 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop 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 { + public abstract ServerLevel getLevel(); +@@ -110,13 +114,41 @@ public abstract class BaseCommandBlock { this.successCount++; } }); @@ -46,10 +46,10 @@ index 390d9cbe8050b90e4bd9327cf4d80571fbd8ece4..1398fb38edfc975dc716a5147159e9da + 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); ++ //net.minecraft.server.MinecraftServer.LOGGER.info("Recompiling parse results cache for command block at ({}, {}, {})", this.getPosition().x, this.getPosition().y, this.getPosition().z); // TODO: check this ++ this.cache(level.getServer().getCommands().getDispatcher(), commandSourceStack, newCommand); + } -+ server.getCommands().performCommand(parseResultsCache, newCommand); ++ level.getServer().getCommands().performCommand(parseResultsCache, newCommand); + } + } + } else { @@ -58,16 +58,16 @@ index 390d9cbe8050b90e4bd9327cf4d80571fbd8ece4..1398fb38edfc975dc716a5147159e9da + if (!event.callEvent()) { + return true; + } -+ server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); ++ level.getServer().getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); + // Paper end - ServerCommandEvent } -- server.getCommands().performPrefixedCommand(commandSourceStack, event.getCommand()); +- level.getServer().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 { + } catch (Throwable var7) { + CrashReport crashReport = CrashReport.forThrowable(var7, "Executing command block"); +@@ -137,6 +169,13 @@ public abstract class BaseCommandBlock { } } @@ -78,6 +78,6 @@ index 390d9cbe8050b90e4bd9327cf4d80571fbd8ece4..1398fb38edfc975dc716a5147159e9da + } + // DivineMC end - Command block parse results caching + - public BaseCommandBlock.CloseableCommandBlockSource createSource() { // Paper - public, remove nullable - return new BaseCommandBlock.CloseableCommandBlockSource(this.trackOutput); // Paper - add back source when output disabled + public BaseCommandBlock.CloseableCommandBlockSource createSource(ServerLevel level) { // Paper - public, remove nullable + return new BaseCommandBlock.CloseableCommandBlockSource(level, this.trackOutput); // Paper - add back source when output disabled } diff --git a/divinemc-server/minecraft-patches/features/0039-Player-ProfileResult-caching.patch b/divinemc-server/minecraft-patches/features/0039-Player-ProfileResult-caching.patch index 0c96eaa..1a7b080 100644 --- a/divinemc-server/minecraft-patches/features/0039-Player-ProfileResult-caching.patch +++ b/divinemc-server/minecraft-patches/features/0039-Player-ProfileResult-caching.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Player ProfileResult caching diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index ace65f36d6562988665c530dd3fdbfaa5d2e2071..68e88a923d8dd8cd91f0ccd2b82cd60a492ad359 100644 +index 971eaba968c7e981ccd057130ee61e589b93811d..601ed1fa4d2dd77b062f25e25e6bb6f9243fbaf9 100644 --- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -72,6 +72,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, - public @Nullable java.util.UUID requestedUuid; // Paper + public java.util.@Nullable 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 + // DivineMC start - Player ProfileResult caching @@ -20,7 +20,7 @@ index ace65f36d6562988665c530dd3fdbfaa5d2e2071..68e88a923d8dd8cd91f0ccd2b82cd60a public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection, boolean transferred) { this.server = server; -@@ -258,10 +263,25 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, +@@ -259,10 +264,25 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, String string1 = Objects.requireNonNull(ServerLoginPacketListenerImpl.this.requestedUsername, "Player name not initialized"); try { diff --git a/divinemc-server/minecraft-patches/features/0040-Implement-Secure-Seed.patch b/divinemc-server/minecraft-patches/features/0040-Implement-Secure-Seed.patch index e5748c1..90fea27 100644 --- a/divinemc-server/minecraft-patches/features/0040-Implement-Secure-Seed.patch +++ b/divinemc-server/minecraft-patches/features/0040-Implement-Secure-Seed.patch @@ -7,32 +7,32 @@ Original license: GPLv3 Original project: https://github.com/plasmoapp/matter diff --git a/net/minecraft/server/commands/SeedCommand.java b/net/minecraft/server/commands/SeedCommand.java -index 7c1e18d8362be5ae885c32b05e98b9ef45942d93..a414de3768972157d3031222fd160556d9b99bf4 100644 +index 68a27436bae245a31470483f92a116fa029f3d4e..e182b58486bdf19c72974a19766112c56b2aeeae 100644 --- a/net/minecraft/server/commands/SeedCommand.java +++ b/net/minecraft/server/commands/SeedCommand.java -@@ -12,6 +12,17 @@ public class SeedCommand { - long seed = commandContext.getSource().getLevel().getSeed(); - Component component = ComponentUtils.copyOnClickText(String.valueOf(seed)); - commandContext.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", component), false); +@@ -15,6 +15,17 @@ public class SeedCommand { + long seed = commandContext.getSource().getLevel().getSeed(); + Component component = ComponentUtils.copyOnClickText(String.valueOf(seed)); + commandContext.getSource().sendSuccess(() -> Component.translatable("commands.seed.success", component), false); + -+ // DivineMC start - Implement Secure Seed -+ if (org.bxteam.divinemc.config.DivineConfig.MiscCategory.enableSecureSeed) { -+ su.plo.matter.Globals.setupGlobals(commandContext.getSource().getLevel()); -+ String seedStr = su.plo.matter.Globals.seedToString(su.plo.matter.Globals.worldSeed); -+ Component featureSeedComponent = ComponentUtils.copyOnClickText(seedStr); ++ // DivineMC start - Implement Secure Seed ++ if (org.bxteam.divinemc.config.DivineConfig.MiscCategory.enableSecureSeed) { ++ su.plo.matter.Globals.setupGlobals(commandContext.getSource().getLevel()); ++ String seedStr = su.plo.matter.Globals.seedToString(su.plo.matter.Globals.worldSeed); ++ Component featureSeedComponent = ComponentUtils.copyOnClickText(seedStr); + -+ commandContext.getSource().sendSuccess(() -> Component.translatable(("Feature seed: %s"), featureSeedComponent), false); -+ } -+ // DivineMC end - Implement Secure Seed ++ commandContext.getSource().sendSuccess(() -> Component.translatable(("Feature seed: %s"), featureSeedComponent), false); ++ } ++ // DivineMC end - Implement Secure Seed + - return (int)seed; - })); - } + return (int)seed; + }) + ); diff --git a/net/minecraft/server/dedicated/DedicatedServerProperties.java b/net/minecraft/server/dedicated/DedicatedServerProperties.java -index a9cd61f0a7bde931e59f1496191f1f8d465aec5e..7711cc269b97811836f1b1dafd0f38eac5cdc7d3 100644 +index 2a3b10c5e031ef44a2b53bc4fdc6e86c917f75d4..e9fbc5b6116b4cd680a1589d5d56168167a9525b 100644 --- a/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -129,7 +129,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()) + this.get("level-type", property -> property.toLowerCase(Locale.ROOT), WorldPresets.NORMAL.identifier().toString()) diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 3aa09ea7498fb0d790cc47c66a8e89df981671e2..d36ec0581e541dea9fffe2c4b9a0ea4da5e5ac0f 100644 +index d58f05a6ffd7d445cdeae35bbe81fed9d52ee9f5..dca4059bfc46fddf6de537f71c6abd699b618e1b 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -616,6 +616,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -610,6 +610,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } public ChunkGenerator getGenerator() { @@ -64,10 +64,10 @@ index 3aa09ea7498fb0d790cc47c66a8e89df981671e2..d36ec0581e541dea9fffe2c4b9a0ea4d } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index f038c8fe7fa84457dcee2276bbbdb7ec8533d430..646ca37bba6da8ab0babbf4a1e6ba88e75658e72 100644 +index 45d33ea79d9464a821f1770771d31e53e80bdea7..421ec3dd350ad49b2249779c61aca0f99b96b897 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -655,6 +655,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -661,6 +661,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 f038c8fe7fa84457dcee2276bbbdb7ec8533d430..646ca37bba6da8ab0babbf4a1e6ba88e 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 a03b1d15aa8b41e7c22464e8b66811c41acdcef2..00d172e663ae9aa880fa267792899a79f912ea01 100644 +index 29d6d0c9687b835d24fe51c3824deeb67af1ba4f..491cf4cceb272ce023346b2f44146a98fc2457e3 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 { +@@ -412,7 +412,11 @@ public class Slime extends Mob implements Enemy { } ChunkPos chunkPos = new ChunkPos(pos); @@ -93,10 +93,10 @@ index a03b1d15aa8b41e7c22464e8b66811c41acdcef2..00d172e663ae9aa880fa267792899a79 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 f6f9a88283e051e6a7c96f461b68b3881b3361d2..421133e5e1ff37b0a50173bd69faef50e5b5c252 100644 +index f2111830b112870c07bf20a0dd52427309d25332..1dfad162acf6ed53f3f12760cd3a707a4e91e810 100644 --- a/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -82,6 +82,10 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -79,6 +79,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 f6f9a88283e051e6a7c96f461b68b3881b3361d2..421133e5e1ff37b0a50173bd69faef50 // 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); -@@ -190,6 +194,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh +@@ -187,6 +191,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh return GameEventListenerRegistry.NOOP; } @@ -124,12 +124,12 @@ index f6f9a88283e051e6a7c96f461b68b3881b3361d2..421133e5e1ff37b0a50173bd69faef50 + public abstract BlockState getBlockState(final int x, final int y, final int z); // Paper - @Nullable + public @Nullable BlockState setBlockState(BlockPos pos, BlockState state) { diff --git a/net/minecraft/world/level/chunk/ChunkGenerator.java b/net/minecraft/world/level/chunk/ChunkGenerator.java -index 4e4a5595ccbadf7e2df0f6de1c8e2ceb00b9ec90..180103f3712b459b4f4202959b900a1ddf4aba61 100644 +index 78600f4c583056403c93e72ec0996b00ec6d1284..15b9298ca0ea151608f88517fb16e18fe6601275 100644 --- a/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/net/minecraft/world/level/chunk/ChunkGenerator.java -@@ -346,7 +346,11 @@ public abstract class ChunkGenerator { +@@ -342,7 +342,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,7 +142,7 @@ index 4e4a5595ccbadf7e2df0f6de1c8e2ceb00b9ec90..180103f3712b459b4f4202959b900a1d long l = worldgenRandom.setDecorationSeed(level.getSeed(), blockPos.getX(), blockPos.getZ()); Set> set = new ObjectArraySet<>(); ChunkPos.rangeClosed(sectionPos.chunk(), 1).forEach(chunkPos -> { -@@ -561,8 +565,18 @@ public abstract class ChunkGenerator { +@@ -557,8 +561,18 @@ public abstract class ChunkGenerator { } else { ArrayList list1 = new ArrayList<>(list.size()); list1.addAll(list); @@ -164,7 +164,7 @@ index 4e4a5595ccbadf7e2df0f6de1c8e2ceb00b9ec90..180103f3712b459b4f4202959b900a1d for (StructureSet.StructureSelectionEntry structureSelectionEntry1 : list1) { diff --git a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java -index b7762440bfd4f5ac105c22e5ded56cc6a1b2815a..8f57ff050356bd53f46eeeacd39c0fd39c5d1d70 100644 +index 784d9de7abecd0816b2a5a6b256ad4e275791fff..cca612027efc11e3b5cb874a6dba4e432c0f76c0 100644 --- a/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -205,14 +205,21 @@ public class ChunkGeneratorStructureState { @@ -198,7 +198,7 @@ index b7762440bfd4f5ac105c22e5ded56cc6a1b2815a..8f57ff050356bd53f46eeeacd39c0fd3 int i = 0; int i1 = 0; diff --git a/net/minecraft/world/level/chunk/status/ChunkStep.java b/net/minecraft/world/level/chunk/status/ChunkStep.java -index b8348976e80578d9eff64eea68c04c603fed49ad..9494e559113798fe451a6d0226be3ae0449021dc 100644 +index aa8c40d49756611537e2698b7f2a861c303ef842..28d70c310e3350804058c12942f11bc2cc867d8c 100644 --- a/net/minecraft/world/level/chunk/status/ChunkStep.java +++ b/net/minecraft/world/level/chunk/status/ChunkStep.java @@ -60,6 +60,7 @@ public final class ChunkStep implements ca.spottedleaf.moonrise.patches.chunk_sy @@ -328,7 +328,7 @@ index c92508741439a8d0d833ea02d0104416adb83c92..c4afe1cc270e6d7b4ffeada75da8265b public static OptionalLong parseSeed(String seed) { seed = seed.trim(); diff --git a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -index 4e72eb49dbf4c70ae7556ba6eb210fcd5ef36aaa..00e20c8c76ff8d902c3ea85ed96dfa3649c8e301 100644 +index 1489328395e212fc34e6e5462dba9d7a167c9a81..c529393b3b00c3f240a24f6925c1b325a526d387 100644 --- a/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/net/minecraft/world/level/levelgen/feature/GeodeFeature.java @@ -41,7 +41,11 @@ public class GeodeFeature extends Feature { @@ -412,10 +412,10 @@ index b3a538f9aebf5b6e965e1140b8fc558eb394605b..892bba74ef5bd670f30d8ab3bdb3b363 } diff --git a/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index 4aa68163958e89521f542470c473f8d5980f5d4b..527e8e874bf4496504c9499a6ba6dce56d50e983 100644 +index ae25d2b544f61bec142e38f299331f67a3f2d8bf..a26621611bd57e47754be7416beba12260d6ecef 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 { +@@ -64,7 +64,11 @@ public class JigsawPlacement { ChunkGenerator chunkGenerator = context.chunkGenerator(); StructureTemplateManager structureTemplateManager = context.structureTemplateManager(); LevelHeightAccessor levelHeightAccessor = context.heightAccessor(); diff --git a/divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch b/divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch index dae8764..aec84f3 100644 --- a/divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch +++ b/divinemc-server/minecraft-patches/features/0041-Dynamic-Activation-of-Brain.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Dynamic Activation of Brain diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index ca21597263cb430e2a5ae07e8cecfb0d53a270d2..226088405c019922085285ba5d04d7c131470c69 100644 +index bc62da127a01b33ce8fc0f958bc232d6287d57ec..9687a31e83d2d5be833cdd127ccef1415f3a3406 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java @@ -167,6 +167,21 @@ public final class ActivationRange { @@ -31,10 +31,10 @@ index ca21597263cb430e2a5ae07e8cecfb0d53a270d2..226088405c019922085285ba5d04d7c1 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 646ca37bba6da8ab0babbf4a1e6ba88e75658e72..1d9b32476c1b89984f1afa8e906ca09472b8d6b2 100644 +index 421ec3dd350ad49b2249779c61aca0f99b96b897..a714ee2724220c5bc5f3d9eebb0a709611478b3a 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -830,6 +830,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -845,6 +845,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.entityTickList .forEach( entity -> { @@ -43,10 +43,10 @@ index 646ca37bba6da8ab0babbf4a1e6ba88e75658e72..1d9b32476c1b89984f1afa8e906ca094 if (!tickRateManager.isEntityFrozen(entity)) { entity.checkDespawn(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 80b771f69549cf460b3d1fca2de8f27152e98f42..5d5e125e55daf55764846c0d7ce2c3150847aeb8 100644 +index 38da0cd729b04fb72eabf95d1c161a3e5afdcd5f..a315d7c523cda7acc6c4fa0413764a4eca746045 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -366,6 +366,8 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -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,19 +56,19 @@ index 80b771f69549cf460b3d1fca2de8f27152e98f42..5d5e125e55daf55764846c0d7ce2c315 // 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 d6f7d96dbdff908c91fbe43432313d2221b57afc..d9d45a3e7436d5a211e3f2b6810f76e0a22766e8 100644 +index f0731609fbfb06ea23baba2a8b3694003a470b7d..1ccab891e10f2a79435c12a9e58f5f3acc804323 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1193,6 +1193,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -1220,6 +1220,7 @@ public class EntityType implements FeatureElement, EntityTypeT private final boolean canSpawnFarFromPlayer; private final int clientTrackingRange; private final int updateInterval; + public boolean dabEnabled = false; // DivineMC - Dynamic Activation of Brain private final String descriptionId; - @Nullable - private Component description; + private @Nullable Component description; + private final Optional> lootTable; diff --git a/net/minecraft/world/entity/Mob.java b/net/minecraft/world/entity/Mob.java -index b2853b6a3bca0ea04c50fedf5e2f5ff633ac2a21..f7cdbc7ca10d4320da5deabe9e01ca774890d796 100644 +index 64b12c6617e4a787c614f0c9c1bf2ba704f45d17..847bc762f45bc52d3309981940c8328f978c1e27 100644 --- a/net/minecraft/world/entity/Mob.java +++ b/net/minecraft/world/entity/Mob.java @@ -220,10 +220,10 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -84,7 +84,7 @@ index b2853b6a3bca0ea04c50fedf5e2f5ff633ac2a21..f7cdbc7ca10d4320da5deabe9e01ca77 this.targetSelector.tick(); } } -@@ -784,13 +784,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -812,13 +812,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(); @@ -109,7 +109,7 @@ index b2853b6a3bca0ea04c50fedf5e2f5ff633ac2a21..f7cdbc7ca10d4320da5deabe9e01ca77 this.navigation.tick(); this.customServerAiStep((ServerLevel)this.level()); diff --git a/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java b/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java -index f6c673b1abe53afcb14fd68d590431027ed29f67..1e5312e02298c63c168526a960d688dc03581cee 100644 +index 389f773e22872778fc434ad47f3a983b490a0284..4d0d7ac936307e399fccb3e6815248bb9345ff86 100644 --- a/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java +++ b/net/minecraft/world/entity/ai/behavior/VillagerPanicTrigger.java @@ -36,7 +36,11 @@ public class VillagerPanicTrigger extends Behavior { @@ -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 c8487029d5707d75b83aebc6fab7c65391f102f9..af6670cff00a3c2de21b91d7c9353f2e4171df9c 100644 +index 9e0fe52c81f764843580ebb5fe6a5bd6b2522794..f011a83657d34674fdb3052003e96da5a9830bc3 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,7 +158,7 @@ index c8487029d5707d75b83aebc6fab7c65391f102f9..af6670cff00a3c2de21b91d7c9353f2e public Allay(EntityType type, Level level) { super(type, 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) { @@ -177,12 +177,12 @@ index c8487029d5707d75b83aebc6fab7c65391f102f9..af6670cff00a3c2de21b91d7c9353f2e @Override diff --git a/net/minecraft/world/entity/animal/axolotl/Axolotl.java b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -index a952e78ac0c1fa7a2728fc3036b93e69e2fefb8d..8540ee65e1733ab37f77c964b8514e08d08781f3 100644 +index 73ff138007002a6203b6a0df88d34d26f025a827..ec2442d74ff59181f3429818a8d4dc836eef96e6 100644 --- a/net/minecraft/world/entity/animal/axolotl/Axolotl.java +++ b/net/minecraft/world/entity/animal/axolotl/Axolotl.java -@@ -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); +@@ -113,6 +113,7 @@ public class Axolotl extends Animal implements Bucketable { + public final BinaryAnimator onGroundAnimator = new BinaryAnimator(10, EasingType.IN_OUT_SINE); + public final BinaryAnimator movingAnimator = new BinaryAnimator(10, EasingType.IN_OUT_SINE); private static final int REGEN_BUFF_BASE_DURATION = 100; + private int behaviorTick = 0; // DivineMC - Dynamic Activation of Brain @@ -212,7 +212,7 @@ index a952e78ac0c1fa7a2728fc3036b93e69e2fefb8d..8540ee65e1733ab37f77c964b8514e08 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 7643e8d1b89a23354c27395509407c20e3d93b69..ccd4a12b5bf2a064f8ea7d49113a18b541778ca5 100644 +index 62de0bd9fce5c6abc168df34f9eda357b789d049..16c23712e80d01dba375106e9770736de3650861 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java @@ -105,6 +105,7 @@ public class Frog extends Animal { @@ -223,7 +223,7 @@ index 7643e8d1b89a23354c27395509407c20e3d93b69..ccd4a12b5bf2a064f8ea7d49113a18b5 public Frog(EntityType type, Level level) { super(type, level); -@@ -258,10 +259,13 @@ public class Frog extends Animal { +@@ -257,10 +258,13 @@ public class Frog extends Animal { @Override protected void customServerAiStep(ServerLevel level) { @@ -242,7 +242,7 @@ index 7643e8d1b89a23354c27395509407c20e3d93b69..ccd4a12b5bf2a064f8ea7d49113a18b5 @Override diff --git a/net/minecraft/world/entity/animal/frog/Tadpole.java b/net/minecraft/world/entity/animal/frog/Tadpole.java -index 37b1674c3f89d7ddba054b066df957f3337f4a89..e437dad4f65a77b1ecbefe324355e33e0abcb76d 100644 +index f712a189107c1bcde82126f96c087b3520cf2dd3..03028270885027e4ac45578cd35b0e6c14cd18db 100644 --- a/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/net/minecraft/world/entity/animal/frog/Tadpole.java @@ -64,6 +64,7 @@ public class Tadpole extends AbstractFish { @@ -272,7 +272,7 @@ index 37b1674c3f89d7ddba054b066df957f3337f4a89..e437dad4f65a77b1ecbefe324355e33e 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 04a4cc148579904222b3c99a1ad4c64e5783afa2..b2c932706b8d910c6e10cfa0ca44bf77c4521835 100644 +index 1cd5d8e09f22b32ff9ca30c07f45a5248e887cb4..6197f96a27fe03fa93bf12aab9d8e51665047fe4 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 { @@ -283,7 +283,7 @@ index 04a4cc148579904222b3c99a1ad4c64e5783afa2..b2c932706b8d910c6e10cfa0ca44bf77 public Goat(EntityType type, Level level) { super(type, 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) { @@ -302,10 +302,10 @@ index 04a4cc148579904222b3c99a1ad4c64e5783afa2..b2c932706b8d910c6e10cfa0ca44bf77 @Override diff --git a/net/minecraft/world/entity/monster/hoglin/Hoglin.java b/net/minecraft/world/entity/monster/hoglin/Hoglin.java -index 1abc4d0de2ff983fc0c30bbc8a356d78f1c23897..f23c3918adf0a654be4365370e132067e8574c5c 100644 +index 81cca68abdf5fa2e176d0121785bbdeed44377a7..a59f0391f58537f9056e87e4d0dcde720b6a3c69 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 { +@@ -89,6 +89,7 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { MemoryModuleType.PACIFIED, MemoryModuleType.IS_PANICKING ); @@ -313,7 +313,7 @@ index 1abc4d0de2ff983fc0c30bbc8a356d78f1c23897..f23c3918adf0a654be4365370e132067 public Hoglin(EntityType type, Level level) { super(type, level); -@@ -206,18 +207,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { +@@ -207,18 +208,21 @@ public class Hoglin extends Animal implements Enemy, HoglinBase { @Override protected void customServerAiStep(ServerLevel level) { @@ -346,10 +346,10 @@ index 1abc4d0de2ff983fc0c30bbc8a356d78f1c23897..f23c3918adf0a654be4365370e132067 @Override diff --git a/net/minecraft/world/entity/monster/piglin/Piglin.java b/net/minecraft/world/entity/monster/piglin/Piglin.java -index b21ca373220f80c81cadab1eda482057d6366caf..8d0b364149c3772b95e97136f77749f7aadd442a 100644 +index 5ceca0b60903b6a5a51db009ac7e583eef24d119..b6ed869269b74c3ae24cc2b2b8ba6b5c33b8b43d 100644 --- a/net/minecraft/world/entity/monster/piglin/Piglin.java +++ b/net/minecraft/world/entity/monster/piglin/Piglin.java -@@ -128,6 +128,7 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -133,6 +133,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,7 +357,7 @@ index b21ca373220f80c81cadab1eda482057d6366caf..8d0b364149c3772b95e97136f77749f7 public Piglin(EntityType type, Level level) { super(type, level); -@@ -350,10 +351,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento +@@ -354,10 +355,13 @@ public class Piglin extends AbstractPiglin implements CrossbowAttackMob, Invento @Override protected void customServerAiStep(ServerLevel level) { @@ -376,7 +376,7 @@ index b21ca373220f80c81cadab1eda482057d6366caf..8d0b364149c3772b95e97136f77749f7 @Override diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index 87976d8981f72732899c57a96971e851b86d5123..5bc5b7e89c87eef6031729f2f7185263da014540 100644 +index 96db45d6885831c290ea6e29400633a502961f01..2bb51cf48c55cf9a00eb497c987842c17a1fb9fd 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 { @@ -387,7 +387,7 @@ index 87976d8981f72732899c57a96971e851b86d5123..5bc5b7e89c87eef6031729f2f7185263 public Warden(EntityType type, Level level) { super(type, 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) { @@ -421,10 +421,10 @@ index 87976d8981f72732899c57a96971e851b86d5123..5bc5b7e89c87eef6031729f2f7185263 } @Override -diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index d99a6ade82bbd01e25137fecfbec5dcef6765e79..a356da48b20ab38648d75f9066b2ed4a013c13c2 100644 ---- a/net/minecraft/world/entity/npc/Villager.java -+++ b/net/minecraft/world/entity/npc/Villager.java +diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java +index 40fae3fdcd9fc875df1db02d8c0d1f2388e0436a..2efa081b835779f16a3701a1f195e89475e73014 100644 +--- a/net/minecraft/world/entity/npc/villager/Villager.java ++++ b/net/minecraft/world/entity/npc/villager/Villager.java @@ -179,6 +179,8 @@ public class Villager extends AbstractVillager implements ReputationEventHandler ); private boolean isLobotomized = false; public boolean isLobotomized() { return this.isLobotomized; } // Purpur - Lobotomize stuck villagers @@ -442,4 +442,4 @@ index d99a6ade82bbd01e25137fecfbec5dcef6765e79..a356da48b20ab38648d75f9066b2ed4a + 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(); + else if (this.isLobotomized && shouldRestock(level)) restock(); diff --git a/divinemc-server/minecraft-patches/features/0042-Petal-Async-Pathfinding.patch b/divinemc-server/minecraft-patches/features/0042-Petal-Async-Pathfinding.patch index f23f90a..ec2d95f 100644 --- a/divinemc-server/minecraft-patches/features/0042-Petal-Async-Pathfinding.patch +++ b/divinemc-server/minecraft-patches/features/0042-Petal-Async-Pathfinding.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Tue, 28 Jan 2025 01:04:55 +0300 +Date: Wed, 10 Dec 2025 23:34:59 +0300 Subject: [PATCH] Petal: Async Pathfinding Original code by Bloom-host, licensed under GPL v3 @@ -9,7 +9,7 @@ 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 21046cde1bd1ede8e7851eb4ea414e33628aa4a9..9fd3b55dc640e96de05c149b90dcbb459b414f4b 100644 +index 3e0fd09a0c0047cfe100e878186471090f8909a0..54543268aa514375c83ff3400304be575cc68240 100644 --- a/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/net/minecraft/world/entity/ai/behavior/AcquirePoi.java @@ -93,21 +93,18 @@ public class AcquirePoi { @@ -75,22 +75,22 @@ index 21046cde1bd1ede8e7851eb4ea414e33628aa4a9..9fd3b55dc640e96de05c149b90dcbb45 + } + // DivineMC end - Async path processing + - @Nullable - public static Path findPathToPois(Mob mob, Set, BlockPos>> poiPositions) { + public static @Nullable Path findPathToPois(Mob mob, Set, BlockPos>> poiPositions) { if (poiPositions.isEmpty()) { + return null; diff --git a/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java b/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java -index 621ba76784f2b92790eca62be4d0688834335ab6..92d8899ff7d42ecc987a7bf2035cc72484ea9e82 100644 +index a0df7e116872858efa02c9c80e9812dcd97ffbf2..bac9dc8d88cbc159a03edf5adeb72275061f95e8 100644 --- a/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java +++ b/net/minecraft/world/entity/ai/behavior/MoveToTargetSink.java -@@ -21,6 +21,7 @@ public class MoveToTargetSink extends Behavior { +@@ -20,6 +20,7 @@ public class MoveToTargetSink extends Behavior { + private static final int MAX_COOLDOWN_BEFORE_RETRYING = 40; private int remainingCooldown; - @Nullable - private Path path; + private @Nullable Path path; + private boolean finishedProcessing; // DivineMC - async path processing - @Nullable - private BlockPos lastTargetPos; + private @Nullable BlockPos lastTargetPos; private float speedModifier; -@@ -53,9 +54,11 @@ public class MoveToTargetSink extends Behavior { + +@@ -51,9 +52,11 @@ public class MoveToTargetSink extends Behavior { Brain brain = owner.getBrain(); WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get(); boolean flag = this.reachedTarget(owner, walkTarget); @@ -103,7 +103,7 @@ index 621ba76784f2b92790eca62be4d0688834335ab6..92d8899ff7d42ecc987a7bf2035cc724 } else { brain.eraseMemory(MemoryModuleType.WALK_TARGET); if (flag) { -@@ -69,6 +72,7 @@ public class MoveToTargetSink extends Behavior { +@@ -67,6 +70,7 @@ public class MoveToTargetSink extends Behavior { @Override protected boolean canStillUse(ServerLevel level, Mob entity, long gameTime) { @@ -111,7 +111,7 @@ index 621ba76784f2b92790eca62be4d0688834335ab6..92d8899ff7d42ecc987a7bf2035cc724 if (this.path != null && this.lastTargetPos != null) { Optional memory = entity.getBrain().getMemory(MemoryModuleType.WALK_TARGET); boolean flag = memory.map(MoveToTargetSink::isWalkTargetSpectator).orElse(false); -@@ -95,27 +99,98 @@ public class MoveToTargetSink extends Behavior { +@@ -93,27 +97,97 @@ public class MoveToTargetSink extends Behavior { @Override protected void start(ServerLevel level, Mob entity, long gameTime) { @@ -196,8 +196,7 @@ index 621ba76784f2b92790eca62be4d0688834335ab6..92d8899ff7d42ecc987a7bf2035cc724 + + if (path != null && this.lastTargetPos != null) { + WalkTarget walkTarget = brain.getMemory(MemoryModuleType.WALK_TARGET).get(); -+ if (walkTarget.getTarget().currentBlockPosition().distSqr(this.lastTargetPos) > 4.0 -+ && this.tryComputePath(owner, walkTarget, level.getGameTime())) { ++ if (walkTarget.getTarget().currentBlockPosition().distSqr(this.lastTargetPos) > 4.0 && this.tryComputePath(owner, walkTarget, level.getGameTime())) { + this.lastTargetPos = walkTarget.getTarget().currentBlockPosition(); + this.start(level, owner, gameTime); + } @@ -222,7 +221,7 @@ 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 348ff9ef8595fa9324d41ec1328f8d7a503d1d13..55b57381008deeb4965ecaa29932ae168a201dbb 100644 +index 7b6e9047f88370ca445ca2a62b57df98e1d6fbc6..856845e43e197cb5c8a0dd0101f2fce3bc005188 100644 --- a/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java +++ b/net/minecraft/world/entity/ai/behavior/SetClosestHomeAsWalkTarget.java @@ -59,17 +59,18 @@ public class SetClosestHomeAsWalkTarget { @@ -237,8 +236,8 @@ index 348ff9ef8595fa9324d41ec1328f8d7a503d1d13..55b57381008deeb4965ecaa29932ae16 - walkTarget.set(new WalkTarget(target, speedModifier, 1)); - level.debugSynchronizers().updatePoi(target); - } -- } else if (mutableInt.getValue() < 5) { -- map.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < mutableLong.getValue()); +- } else if (mutableInt.intValue() < 5) { +- map.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < mutableLong.longValue()); + // DivineMC start - async path processing + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.asyncPathfinding) { + Path possiblePath = AcquirePoi.findPathToPois(mob, set); @@ -275,8 +274,8 @@ index 348ff9ef8595fa9324d41ec1328f8d7a503d1d13..55b57381008deeb4965ecaa29932ae16 + walkTarget.set(new WalkTarget(target, speedModifier, 1)); + level.debugSynchronizers().updatePoi(target); + } -+ } else if (mutableInt.getValue() < 5) { -+ map.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < mutableLong.getValue()); ++ } else if (mutableInt.intValue() < 5) { ++ map.long2LongEntrySet().removeIf(entry -> entry.getLongValue() < mutableLong.longValue()); + } + } + // DivineMC end - async path processing @@ -393,10 +392,10 @@ index 5ccc526adb65b2107afd944a52c1246738b4bcad..d26f0d0217d6c9d24c3db117140980d5 } diff --git a/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index 17d2a937ab6f325295c0b5b9b0a681952d4bce85..b469f5be3bebd4beb0bf933e33cb9c8d49a940d8 100644 +index 9d145a526d797e2fac5a72d376e67c1e2b62573f..0cc95c0ff71fca31f32faa03e22e3b0f74eb309f 100644 --- a/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -173,6 +173,10 @@ public abstract class PathNavigation { +@@ -159,6 +159,10 @@ public abstract class PathNavigation { return null; } else if (!this.canUpdatePath()) { return null; @@ -407,7 +406,7 @@ index 17d2a937ab6f325295c0b5b9b0a681952d4bce85..b469f5be3bebd4beb0bf933e33cb9c8d } else if (this.path != null && !this.path.isDone() && targets.contains(this.targetPos)) { return this.path; } else { -@@ -197,11 +201,29 @@ public abstract class PathNavigation { +@@ -183,11 +187,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, reachRange, this.maxVisitedNodesMultiplier); @@ -441,7 +440,7 @@ index 17d2a937ab6f325295c0b5b9b0a681952d4bce85..b469f5be3bebd4beb0bf933e33cb9c8d return path; } -@@ -252,8 +274,8 @@ public abstract class PathNavigation { +@@ -238,8 +260,8 @@ public abstract class PathNavigation { if (this.isDone()) { return false; } else { @@ -452,7 +451,7 @@ index 17d2a937ab6f325295c0b5b9b0a681952d4bce85..b469f5be3bebd4beb0bf933e33cb9c8d return false; } else { this.speedModifier = speedModifier; -@@ -276,6 +298,7 @@ public abstract class PathNavigation { +@@ -261,6 +283,7 @@ public abstract class PathNavigation { if (this.hasDelayedRecomputation) { this.recomputePath(); } @@ -460,7 +459,7 @@ index 17d2a937ab6f325295c0b5b9b0a681952d4bce85..b469f5be3bebd4beb0bf933e33cb9c8d if (!this.isDone()) { if (this.canUpdatePath()) { -@@ -304,6 +327,7 @@ public abstract class PathNavigation { +@@ -289,6 +312,7 @@ public abstract class PathNavigation { } protected void followThePath() { @@ -468,7 +467,7 @@ index 17d2a937ab6f325295c0b5b9b0a681952d4bce85..b469f5be3bebd4beb0bf933e33cb9c8d 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(); -@@ -460,7 +484,7 @@ public abstract class PathNavigation { +@@ -445,7 +469,7 @@ public abstract class PathNavigation { public boolean shouldRecomputePath(BlockPos pos) { if (this.hasDelayedRecomputation) { return false; @@ -556,11 +555,11 @@ 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 5e054044444b464243c11574bbac9a0eabcc4073..c52ed3f4744638922b585693e86fc71c356b0f82 100644 ---- a/net/minecraft/world/entity/animal/Bee.java -+++ b/net/minecraft/world/entity/animal/Bee.java -@@ -943,7 +943,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +diff --git a/net/minecraft/world/entity/animal/bee/Bee.java b/net/minecraft/world/entity/animal/bee/Bee.java +index 10dfa28ec46727e60f8a9c90d7e8914aa8b96ea1..beb0cd9b6a947d869085ba2fec472d54f682439d 100644 +--- a/net/minecraft/world/entity/animal/bee/Bee.java ++++ b/net/minecraft/world/entity/animal/bee/Bee.java +@@ -941,7 +941,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } else { Bee.this.pathfindRandomlyTowards(Bee.this.hivePos); } @@ -569,7 +568,7 @@ index 5e054044444b464243c11574bbac9a0eabcc4073..c52ed3f4744638922b585693e86fc71c boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos); if (!flag) { this.dropAndBlacklistHive(); -@@ -997,7 +997,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -995,7 +995,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { return true; } else { Path path = Bee.this.navigation.getPath(); @@ -579,10 +578,10 @@ index 5e054044444b464243c11574bbac9a0eabcc4073..c52ed3f4744638922b585693e86fc71c } } diff --git a/net/minecraft/world/entity/animal/frog/Frog.java b/net/minecraft/world/entity/animal/frog/Frog.java -index ccd4a12b5bf2a064f8ea7d49113a18b541778ca5..7893205fa74c348d5345ad48a1928ae56caf46d3 100644 +index 16c23712e80d01dba375106e9770736de3650861..8672da2666a743913e283e9480e61b122c805886 100644 --- a/net/minecraft/world/entity/animal/frog/Frog.java +++ b/net/minecraft/world/entity/animal/frog/Frog.java -@@ -480,6 +480,17 @@ public class Frog extends Animal { +@@ -470,6 +470,17 @@ public class Frog extends Animal { super(mob, level); } @@ -600,36 +599,23 @@ index ccd4a12b5bf2a064f8ea7d49113a18b541778ca5..7893205fa74c348d5345ad48a1928ae5 @Override public boolean canCutCorner(PathType pathType) { return pathType != PathType.WATER_BORDER && super.canCutCorner(pathType); -@@ -488,6 +499,11 @@ public class Frog extends Animal { +@@ -478,6 +489,11 @@ public class Frog extends Animal { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new Frog.FrogNodeEvaluator(true); + // DivineMC start - async path processing + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.asyncPathfinding) { + return new PathFinder(this.nodeEvaluator, maxVisitedNodes, nodeEvaluatorGenerator); -+ } ++ } + // DivineMC end - async path processing return new PathFinder(this.nodeEvaluator, maxVisitedNodes); } } -diff --git a/net/minecraft/world/entity/monster/Drowned.java b/net/minecraft/world/entity/monster/Drowned.java -index 28fb51950c38ffbc88c3e01c113310fd2bccd097..71864c239da6e12bb897d171cdeff314fed54b5c 100644 ---- a/net/minecraft/world/entity/monster/Drowned.java -+++ b/net/minecraft/world/entity/monster/Drowned.java -@@ -304,7 +304,7 @@ public class Drowned extends Zombie implements RangedAttackMob { - - protected boolean closeToNextPos() { - Path path = this.getNavigation().getPath(); -- if (path != null) { -+ if (path != null && path.isProcessed()) { // DivineMC - ensure path is processed - BlockPos target = path.getTarget(); - 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 da7644dd2b9e86ec8947250ff998fb554e881161..c842e500ddc229bc776c29a39c6f8a71237ea810 100644 +index 37b0c8f55ed4ac4feac6a35bd4377007a19ea2ce..3f7c5f5772ccea9f0b2526868f830c5e0edf2c97 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 { +@@ -556,9 +556,25 @@ public class Strider extends Animal implements ItemSteerable { super(strider, level); } @@ -656,10 +642,10 @@ index da7644dd2b9e86ec8947250ff998fb554e881161..c842e500ddc229bc776c29a39c6f8a71 } diff --git a/net/minecraft/world/entity/monster/warden/Warden.java b/net/minecraft/world/entity/monster/warden/Warden.java -index 5bc5b7e89c87eef6031729f2f7185263da014540..f3a8e187740eacd4244da67d21b2ec7de1b2208a 100644 +index 2bb51cf48c55cf9a00eb497c987842c17a1fb9fd..09dbd6061cf77f59a2be453b6d639cd044f53a17 100644 --- a/net/minecraft/world/entity/monster/warden/Warden.java +++ b/net/minecraft/world/entity/monster/warden/Warden.java -@@ -573,6 +573,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -570,6 +570,16 @@ public class Warden extends Monster implements VibrationSystem { @Override protected PathFinder createPathFinder(int maxVisitedNodes) { this.nodeEvaluator = new WalkNodeEvaluator(); @@ -676,20 +662,33 @@ index 5bc5b7e89c87eef6031729f2f7185263da014540..f3a8e187740eacd4244da67d21b2ec7d return new PathFinder(this.nodeEvaluator, maxVisitedNodes) { @Override protected float distance(Node first, Node second) { +diff --git a/net/minecraft/world/entity/monster/zombie/Drowned.java b/net/minecraft/world/entity/monster/zombie/Drowned.java +index e7724c599c0b69bf786041db647a170c9b0a2a71..fb3729bb9e1a6ea70a1fe2d4666a1093e04399d6 100644 +--- a/net/minecraft/world/entity/monster/zombie/Drowned.java ++++ b/net/minecraft/world/entity/monster/zombie/Drowned.java +@@ -325,7 +325,7 @@ public class Drowned extends Zombie implements RangedAttackMob { + + protected boolean closeToNextPos() { + Path path = this.getNavigation().getPath(); +- if (path != null) { ++ if (path != null && path.isProcessed()) { // DivineMC - ensure path is processed + BlockPos target = path.getTarget(); + if (target != null) { + double d = this.distanceToSqr(target.getX(), target.getY(), target.getZ()); diff --git a/net/minecraft/world/level/pathfinder/Path.java b/net/minecraft/world/level/pathfinder/Path.java -index 4a17d60e09bc2a73c50a1c981e4b50ae3eabe9ee..7f4fd1bfb26651a0c61728479b4827c3c8140979 100644 +index 5959e1b1772ffbdfb108365171fe37cbf56ef825..92669a529316d76563a110f5770ba06afbe6593e 100644 --- a/net/minecraft/world/level/pathfinder/Path.java +++ b/net/minecraft/world/level/pathfinder/Path.java -@@ -11,7 +11,7 @@ import net.minecraft.util.VisibleForDebug; - import net.minecraft.world.entity.Entity; +@@ -11,7 +11,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.phys.Vec3; + import org.jspecify.annotations.Nullable; -public final class Path { +public class Path { public static final StreamCodec STREAM_CODEC = StreamCodec.of((buffer, value) -> value.writeToStream(buffer), Path::createFromStream); public final List nodes; - @Nullable -@@ -28,6 +28,17 @@ public final class Path { + private Path.@Nullable DebugData debugData; +@@ -27,6 +27,17 @@ public final class Path { this.reached = reached; } @@ -707,7 +706,7 @@ index 4a17d60e09bc2a73c50a1c981e4b50ae3eabe9ee..7f4fd1bfb26651a0c61728479b4827c3 public void advance() { this.nextNodeIndex++; } -@@ -101,6 +112,7 @@ public final class Path { +@@ -98,6 +109,7 @@ public final class Path { } public boolean sameAs(@Nullable Path path) { @@ -716,7 +715,7 @@ index 4a17d60e09bc2a73c50a1c981e4b50ae3eabe9ee..7f4fd1bfb26651a0c61728479b4827c3 } diff --git a/net/minecraft/world/level/pathfinder/PathFinder.java b/net/minecraft/world/level/pathfinder/PathFinder.java -index 477446a1bf38efb1e5b5b4513dd85808a5cd8cdb..b1849e431a8e22065c7f9c46412409148fa0df73 100644 +index 919769ae40efea904be6adbbb13542bd39bf0291..42a82354377ea9ee90064678851d3e41051650fc 100644 --- a/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/net/minecraft/world/level/pathfinder/PathFinder.java @@ -23,11 +23,19 @@ public class PathFinder { @@ -740,10 +739,10 @@ index 477446a1bf38efb1e5b5b4513dd85808a5cd8cdb..b1849e431a8e22065c7f9c4641240914 public void setCaptureDebug(BooleanSupplier captureDebug) { this.captureDebug = captureDebug; -@@ -39,26 +47,62 @@ public class PathFinder { +@@ -38,25 +46,61 @@ public class PathFinder { + } - @Nullable - public Path findPath(PathNavigationRegion region, Mob mob, Set targets, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { + public @Nullable Path findPath(PathNavigationRegion region, Mob mob, Set targets, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { - this.openSet.clear(); - this.nodeEvaluator.prepare(region, mob); - Node start = this.nodeEvaluator.getStart(); @@ -791,8 +790,7 @@ index 477446a1bf38efb1e5b5b4513dd85808a5cd8cdb..b1849e431a8e22065c7f9c4641240914 } } - @Nullable - private Path findPath(Node node, List> positions, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { // Paper - optimize collection + private @Nullable Path findPath(Node node, List> positions, float maxRange, int reachRange, float maxVisitedNodesMultiplier) { // Paper - optimize collection + // DivineMC start - split pathfinding into the original sync method for compat and processing for delaying + try { + return this.processPath(this.nodeEvaluator, node, positions, maxRange, reachRange, maxVisitedNodesMultiplier); @@ -810,7 +808,7 @@ index 477446a1bf38efb1e5b5b4513dd85808a5cd8cdb..b1849e431a8e22065c7f9c4641240914 // Set set = targetPositions.keySet(); // Paper - unused node.g = 0.0F; node.h = this.getBestH(node, positions); // Paper - optimize collection -@@ -99,7 +143,7 @@ public class PathFinder { +@@ -97,7 +141,7 @@ public class PathFinder { } if (!(node1.distanceTo(node) >= maxRange)) { diff --git a/divinemc-server/minecraft-patches/features/0043-Petal-Multithreaded-Tracker.patch b/divinemc-server/minecraft-patches/features/0043-Petal-Multithreaded-Tracker.patch index d3c81f4..611635b 100644 --- a/divinemc-server/minecraft-patches/features/0043-Petal-Multithreaded-Tracker.patch +++ b/divinemc-server/minecraft-patches/features/0043-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 ea3d63856ed487c4d23b0448c97169c230932832..646bd06468bdd7a7ebc5ecc7e876617ad0fc6c05 100644 +index 7a9f113e53a9528f1ddf8884e0d138162350b7e0..cc0a7819dd4209141f36668a8ebf51f6db3b0cf4 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 { @@ -54,7 +54,7 @@ index ea3d63856ed487c4d23b0448c97169c230932832..646bd06468bdd7a7ebc5ecc7e876617a private static final byte CHUNK_TICKET_STAGE_NONE = 0; private static final byte CHUNK_TICKET_STAGE_LOADING = 1; diff --git a/net/minecraft/network/protocol/game/ClientboundUpdateAttributesPacket.java b/net/minecraft/network/protocol/game/ClientboundUpdateAttributesPacket.java -index 9c0c99b936b4a82ebfe924866e53ec71f7bbe9ad..01ed1e3572e9c2ccfd19df117cda0d5cf65b9bcb 100644 +index 51ec726fcfe5b178d1e45fa14a604c81cf38bb3c..4a72f84fbbc30c7b24667ba728143384a605d973 100644 --- a/net/minecraft/network/protocol/game/ClientboundUpdateAttributesPacket.java +++ b/net/minecraft/network/protocol/game/ClientboundUpdateAttributesPacket.java @@ -32,6 +32,7 @@ public class ClientboundUpdateAttributesPacket implements Packet packet) { @@ -287,7 +287,7 @@ index 188a62f00bd541f27adaaa4250b56276565f0d74..04dd1bec1aff470e67a21fb0b2593268 serverPlayerConnection.send(packet); } } -@@ -1291,7 +1417,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1324,7 +1450,7 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP @Override public void sendToTrackingPlayersFiltered(Packet packet, Predicate filter) { @@ -296,7 +296,7 @@ index 188a62f00bd541f27adaaa4250b56276565f0d74..04dd1bec1aff470e67a21fb0b2593268 if (filter.test(serverPlayerConnection.getPlayer())) { serverPlayerConnection.send(packet); } -@@ -1299,24 +1425,35 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1332,24 +1458,35 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP } public void broadcastRemoved() { @@ -335,7 +335,7 @@ index 188a62f00bd541f27adaaa4250b56276565f0d74..04dd1bec1aff470e67a21fb0b2593268 // Paper start - remove allocation of Vec3D here // Vec3 vec3 = player.position().subtract(this.entity.position()); double vec3_dx = player.getX() - this.entity.getX(); -@@ -1344,6 +1481,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1377,6 +1514,7 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP // CraftBukkit end if (flag) { if (this.seenBy.add(player.connection)) { @@ -343,7 +343,7 @@ index 188a62f00bd541f27adaaa4250b56276565f0d74..04dd1bec1aff470e67a21fb0b2593268 // 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); -@@ -1357,6 +1495,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1390,6 +1528,7 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP this.serverEntity.onPlayerAdd(); // Paper - fix desync when a player is added to the tracker } } else { @@ -369,7 +369,7 @@ index f106373ef3ac4a8685c2939c9e8361688a285913..b844b6dd89bc53b74c0d1bdbf4657c11 public boolean visible = true; diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index 737a6ff0bfec9b555fa425619d97b80ef95cb3e6..cfa2c3aa357a0dbb7edf7f0c8cebea5ed2f31cbc 100644 +index ec05269a2ec8b416582da8ff0c7da7ac83e4e8fa..615691b0f07380e5ce0c105d1f7eb469c7c0d5d6 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -122,7 +122,7 @@ public class ServerEntity { @@ -381,7 +381,7 @@ index 737a6ff0bfec9b555fa425619d97b80ef95cb3e6..cfa2c3aa357a0dbb7edf7f0c8cebea5e final ServerPlayer serverPlayer = connection.getPlayer(); // Paper savedData.tickCarriedBy(serverPlayer, item); Packet updatePacket = savedData.getUpdatePacket(mapId, serverPlayer); -@@ -409,8 +409,6 @@ public class ServerEntity { +@@ -410,8 +410,6 @@ public class ServerEntity { // CraftBukkit end this.synchronizer.sendToTrackingPlayersAndSelf(new ClientboundUpdateAttributesPacket(this.entity.getId(), attributesToSync)); } @@ -391,10 +391,10 @@ index 737a6ff0bfec9b555fa425619d97b80ef95cb3e6..cfa2c3aa357a0dbb7edf7f0c8cebea5e } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 1d9b32476c1b89984f1afa8e906ca09472b8d6b2..0b1ea5c5248f0b54ba7b01d7bc89e1547ad2a89a 100644 +index a714ee2724220c5bc5f3d9eebb0a709611478b3a..7be8790e7c2b9f8fefc646ec6ebc4a21d63fd19f 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -2569,7 +2569,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2598,7 +2598,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public LevelEntityGetter getEntities() { @@ -402,7 +402,7 @@ index 1d9b32476c1b89984f1afa8e906ca09472b8d6b2..0b1ea5c5248f0b54ba7b01d7bc89e154 return this.moonrise$getEntityLookup(); // Paper - rewrite chunk system } -@@ -2848,7 +2847,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2900,7 +2899,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } map.carriedByPlayers.remove(player); @@ -412,10 +412,10 @@ index 1d9b32476c1b89984f1afa8e906ca09472b8d6b2..0b1ea5c5248f0b54ba7b01d7bc89e154 } } diff --git a/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3bd279d72d06f30c9b20146ba932a8f4832dee50..ef578f42cceac5fd75d0d0528e2ec9791beff2d0 100644 +index 41bc20f28171b50849022e4b64c2eee38eec2c16..ef03cdbf80bbd1447a272e36a74b86121391e7f2 100644 --- a/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1943,7 +1943,6 @@ public class ServerGamePacketListenerImpl +@@ -1967,7 +1967,6 @@ public class ServerGamePacketListenerImpl } public void internalTeleport(PositionMoveRotation posMoveRotation, Set relatives) { @@ -424,7 +424,7 @@ index 3bd279d72d06f30c9b20146ba932a8f4832dee50..ef578f42cceac5fd75d0d0528e2ec979 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 2dc2dd9dbbe63316827b620b991ad929ad7bb77e..7ec1c2f39981b60343f152a5432b3677574ee46c 100644 +index 879f93453fce3bf4dec30ecdac738796eec576b4..2005a3787b4b74913d02b09dac27cee8db9ec0ca 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -1361,13 +1361,13 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin @@ -467,17 +467,17 @@ index 69d59650b26fcb1c654d7a784022ac7f4c9230ce..7e8fed00bbdeaa1ccd6d07312b26c1e7 public double getDefaultValue() { diff --git a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java -index 42ad600c6a5cb20e1d820f169f6a1a17ef3a5195..c93b2c684d773551b14cc2ce024923536780ee17 100644 +index e42e6d01a8bb1bca5dea440d3f002ead68590e11..bb4c35957e3e31a76f91eeb395b491d7b184f647 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeInstance.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeInstance.java -@@ -22,8 +22,24 @@ public class AttributeInstance { - private final Map> modifiersByOperation = Maps.newEnumMap( - AttributeModifier.Operation.class - ); -- private final Map modifierById = new Object2ObjectArrayMap<>(); -- private final Map permanentModifiers = new Object2ObjectArrayMap<>(); +@@ -20,8 +20,24 @@ import org.jspecify.annotations.Nullable; + public class AttributeInstance { + private final Holder attribute; + private final Map> modifiersByOperation = Maps.newEnumMap(AttributeModifier.Operation.class); +- private final Map modifierById = new Object2ObjectArrayMap<>(); +- private final Map permanentModifiers = new Object2ObjectArrayMap<>(); + // DivineMC start - Multithreaded tracker -+ private final Map modifierById; ++ private final Map modifierById; + { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.multithreadedEnabled) { + modifierById = it.unimi.dsi.fastutil.objects.Object2ObjectMaps.synchronize(new Object2ObjectArrayMap<>(), this); @@ -485,7 +485,7 @@ index 42ad600c6a5cb20e1d820f169f6a1a17ef3a5195..c93b2c684d773551b14cc2ce02492353 + modifierById = new Object2ObjectArrayMap<>(); + } + } -+ private final Map permanentModifiers; ++ private final Map permanentModifiers; + { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.multithreadedEnabled) { + permanentModifiers = it.unimi.dsi.fastutil.objects.Object2ObjectMaps.synchronize(new Object2ObjectArrayMap<>(), this); @@ -497,10 +497,10 @@ index 42ad600c6a5cb20e1d820f169f6a1a17ef3a5195..c93b2c684d773551b14cc2ce02492353 private double baseValue; private boolean dirty = true; private double cachedValue; -@@ -52,7 +68,13 @@ public class AttributeInstance { +@@ -50,7 +66,13 @@ public class AttributeInstance { @VisibleForTesting - Map getModifiers(AttributeModifier.Operation operation) { + Map getModifiers(AttributeModifier.Operation operation) { - return this.modifiersByOperation.computeIfAbsent(operation, operation1 -> new Object2ObjectOpenHashMap<>()); + // DivineMC start - Multithreaded tracker + return this.modifiersByOperation.computeIfAbsent(operation, operation1 -> { @@ -512,7 +512,7 @@ index 42ad600c6a5cb20e1d820f169f6a1a17ef3a5195..c93b2c684d773551b14cc2ce02492353 } public Set getModifiers() { -@@ -140,8 +162,12 @@ public class AttributeInstance { +@@ -137,8 +159,12 @@ public class AttributeInstance { public double getValue() { if (this.dirty) { @@ -526,7 +526,7 @@ index 42ad600c6a5cb20e1d820f169f6a1a17ef3a5195..c93b2c684d773551b14cc2ce02492353 } return this.cachedValue; -@@ -184,7 +210,15 @@ public class AttributeInstance { +@@ -181,7 +207,15 @@ public class AttributeInstance { } public AttributeInstance.Packed pack() { @@ -544,11 +544,11 @@ index 42ad600c6a5cb20e1d820f169f6a1a17ef3a5195..c93b2c684d773551b14cc2ce02492353 public void apply(AttributeInstance.Packed instance) { diff --git a/net/minecraft/world/entity/ai/attributes/AttributeMap.java b/net/minecraft/world/entity/ai/attributes/AttributeMap.java -index 7dd8c1c8e27410854ce1ee90defc607c2710b5a2..290a7fa565f695c7afe3cf0791f6cf1da6a39663 100644 +index fd26471047cc5bef28ee9ddba4a8542deef889cc..f7d74f86b21f05f8c116c52f49de02d94cd95489 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeMap.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeMap.java -@@ -14,9 +14,11 @@ import net.minecraft.core.Holder; - import net.minecraft.resources.ResourceLocation; +@@ -14,9 +14,11 @@ import net.minecraft.resources.Identifier; + import org.jspecify.annotations.Nullable; public class AttributeMap { - private final Map, AttributeInstance> attributes = new Object2ObjectOpenHashMap<>(); @@ -562,7 +562,7 @@ index 7dd8c1c8e27410854ce1ee90defc607c2710b5a2..290a7fa565f695c7afe3cf0791f6cf1d private final AttributeSupplier supplier; private final net.minecraft.world.entity.LivingEntity entity; // Purpur - Ridables -@@ -30,28 +32,52 @@ public class AttributeMap { +@@ -30,27 +32,51 @@ public class AttributeMap { this.supplier = defaultAttributes; } @@ -603,8 +603,7 @@ index 7dd8c1c8e27410854ce1ee90defc607c2710b5a2..290a7fa565f695c7afe3cf0791f6cf1d return this.attributes.values().stream().filter(instance -> instance.getAttribute().value().isClientSyncable() && (entity == null || entity.shouldSendAttribute(instance.getAttribute().value()))).collect(Collectors.toList()); // Purpur - Ridables } - @Nullable - public AttributeInstance getInstance(Holder attribute) { + public @Nullable AttributeInstance getInstance(Holder attribute) { - return this.attributes.computeIfAbsent(attribute, holder -> this.supplier.createInstance(this::onAttributeModified, (Holder)holder)); + // DivineMC start - Multithreaded Tracker + AttributeInstance v; @@ -622,7 +621,7 @@ index 7dd8c1c8e27410854ce1ee90defc607c2710b5a2..290a7fa565f695c7afe3cf0791f6cf1d public boolean hasAttribute(Holder attribute) { diff --git a/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java b/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java -index 24710041ccbc70e5506d8d89ae34f0141977f209..dbcff8bdd6911843bc42f64d5dcf1bb854128075 100644 +index 8bf6b76277c529433dbf541dee23156bbb94c946..33b5140fcaee633d1b68ba789fe83ed9266f40ce 100644 --- a/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java +++ b/net/minecraft/world/entity/ai/attributes/AttributeSupplier.java @@ -11,7 +11,7 @@ public class AttributeSupplier { @@ -634,11 +633,11 @@ index 24710041ccbc70e5506d8d89ae34f0141977f209..dbcff8bdd6911843bc42f64d5dcf1bb8 } public AttributeInstance getAttributeInstance(Holder attribute) { -diff --git a/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java b/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java -index 325ec57df2885f5e81b8a6b61e3a9fed9484b30f..1796f0a6f647c94b0943a6003a1307795294805e 100644 ---- a/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java -+++ b/net/minecraft/world/entity/vehicle/NewMinecartBehavior.java -@@ -35,13 +35,20 @@ public class NewMinecartBehavior extends MinecartBehavior { +diff --git a/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java b/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java +index 84b11654411eaa561a9b58ffa1210ca3d3b5a7cd..cf21748149c5e36cf76675379f5bd36517ab4806 100644 +--- a/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java ++++ b/net/minecraft/world/entity/vehicle/minecart/NewMinecartBehavior.java +@@ -34,13 +34,20 @@ public class NewMinecartBehavior extends MinecartBehavior { private int cachedLerpDelay; private float cachedPartialTick; private int lerpDelay = 0; @@ -661,7 +660,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 d2511e001645c30b7b4d1f2b280401c817672fdb..8ea2a1ab532fdcffab04a9019d7f617bd3e8ed8f 100644 +index bbb0440be29497b56ad1bac20d0ed1f3fddddac7..a1493c285519956d0740508bb6ed5507ffaf0ec6 100644 --- a/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java @@ -214,6 +214,7 @@ public class MapItemSavedData extends SavedData { diff --git a/divinemc-server/minecraft-patches/features/0044-Pufferfish-Optimize-mob-spawning.patch b/divinemc-server/minecraft-patches/features/0044-Pufferfish-Optimize-mob-spawning.patch index de15b55..b95fc39 100644 --- a/divinemc-server/minecraft-patches/features/0044-Pufferfish-Optimize-mob-spawning.patch +++ b/divinemc-server/minecraft-patches/features/0044-Pufferfish-Optimize-mob-spawning.patch @@ -9,10 +9,10 @@ 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 690c67f2051996d0888a946b8c089d39dcb004f6..698460d2dc19a0bdf6cf2a528a702d6dbc625eb2 100644 +index 56b2c8b781ad7d416ceb05f527826186bd39b188..190eb522be262d7a237aca69bb732463a1895caf 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -288,6 +288,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop chunkHoldersToBroadcast = new ReferenceOpenHashSet<>(); + @VisibleForDebug + private NaturalSpawner.@Nullable SpawnState lastSpawnState; + // DivineMC start - Pufferfish: Optimize mob spawning + public boolean firstRunSpawnCounts = true; + public final java.util.concurrent.atomic.AtomicBoolean spawnCountsReady = new java.util.concurrent.atomic.AtomicBoolean(false); + // DivineMC end - Pufferfish: Optimize mob spawning - - public ServerChunkCache( - ServerLevel level, -@@ -501,6 +505,47 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + // Paper start + public final ca.spottedleaf.concurrentutil.map.ConcurrentLong2ReferenceChainedHashTable fullChunks = new ca.spottedleaf.concurrentutil.map.ConcurrentLong2ReferenceChainedHashTable<>(); + public int getFullChunksCount() { +@@ -495,6 +499,47 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.broadcastChangedChunks(); } @@ -96,7 +96,7 @@ index d36ec0581e541dea9fffe2c4b9a0ea4da5e5ac0f..c5b95557dc148cfc91c031bf07890018 } private void broadcastChangedChunks() { -@@ -518,27 +563,31 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -512,27 +557,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; @@ -139,19 +139,19 @@ index d36ec0581e541dea9fffe2c4b9a0ea4da5e5ac0f..c5b95557dc148cfc91c031bf07890018 + // DivineMC end - Pufferfish: Optimize mob spawning // Paper end - Optional per player mob spawns - this.lastSpawnState = spawnState; - boolean _boolean = this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBSPAWNING) && !this.level.players().isEmpty(); // CraftBukkit - int _int = this.level.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + boolean flag = this.level.getGameRules().get(GameRules.SPAWN_MOBS) && !this.level.players().isEmpty(); // CraftBukkit + int i = this.level.getGameRules().get(GameRules.RANDOM_TICK_SPEED); List filteredSpawningCategories; -@@ -552,7 +601,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -546,7 +595,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 -- filteredSpawningCategories = NaturalSpawner.getFilteredSpawningCategories(spawnState, this.spawnFriendlies, this.spawnEnemies, flag, this.level); // CraftBukkit -+ filteredSpawningCategories = NaturalSpawner.getFilteredSpawningCategories(lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag, this.level); // CraftBukkit // DivineMC - Pufferfish: Optimize mob spawning + boolean flag1 = this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) != 0L && this.level.getGameTime() % this.level.ticksPerSpawnCategory.getLong(org.bukkit.entity.SpawnCategory.ANIMAL) == 0L; // CraftBukkit +- filteredSpawningCategories = NaturalSpawner.getFilteredSpawningCategories(spawnState, this.spawnFriendlies, this.spawnEnemies, flag1, this.level); // CraftBukkit ++ filteredSpawningCategories = NaturalSpawner.getFilteredSpawningCategories(lastSpawnState, this.spawnFriendlies, this.spawnEnemies, flag1, this.level); // CraftBukkit // DivineMC - Pufferfish: Optimize mob spawning } else { filteredSpawningCategories = List.of(); } -@@ -569,7 +618,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -563,7 +612,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // Paper end - chunk tick iteration optimisation for (LevelChunk levelChunk : list) { @@ -160,7 +160,7 @@ index d36ec0581e541dea9fffe2c4b9a0ea4da5e5ac0f..c5b95557dc148cfc91c031bf07890018 } } finally { list.clear(); -@@ -588,11 +637,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -582,11 +631,11 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon this.level.tickThunder(chunk); } diff --git a/divinemc-server/minecraft-patches/features/0045-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch b/divinemc-server/minecraft-patches/features/0045-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch index 693fc2f..3b6920e 100644 --- a/divinemc-server/minecraft-patches/features/0045-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch +++ b/divinemc-server/minecraft-patches/features/0045-Pufferfish-Simpler-ShapelessRecipes-comparison-for-V.patch @@ -13,16 +13,16 @@ the vanilla one, however this is far more advanced than what you need for all the vanilla recipes. diff --git a/net/minecraft/world/item/crafting/ShapelessRecipe.java b/net/minecraft/world/item/crafting/ShapelessRecipe.java -index d601b54b1de2f2ae44fe2b20c8116c71a6340e45..658c950e18a5a4ff992c8720e60f505a11ab2efd 100644 +index 28d085fce206634ee88c492e06fdbf63a618ee12..33bf174d99e8f3ea80523301b22a31bb3b2d4219 100644 --- a/net/minecraft/world/item/crafting/ShapelessRecipe.java +++ b/net/minecraft/world/item/crafting/ShapelessRecipe.java -@@ -23,13 +23,21 @@ public class ShapelessRecipe implements CraftingRecipe { +@@ -22,13 +22,21 @@ public class ShapelessRecipe implements CraftingRecipe { + final ItemStack result; final List ingredients; - @Nullable - private PlacementInfo placementInfo; -+ // DivineMC start - Pufferfish: Simpler ShapelessRecipes comparison for Vanilla -+ private final boolean isBukkit; + private @Nullable PlacementInfo placementInfo; ++ private final boolean isBukkit; // DivineMC - Pufferfish: Simpler ShapelessRecipes comparison for Vanilla ++ // DivineMC start - Pufferfish: Simpler ShapelessRecipes comparison for Vanilla public ShapelessRecipe(String group, CraftingBookCategory category, ItemStack result, List ingredients) { + this(group, category, result, ingredients, false); + } @@ -38,7 +38,7 @@ index d601b54b1de2f2ae44fe2b20c8116c71a6340e45..658c950e18a5a4ff992c8720e60f505a // CraftBukkit start @Override -@@ -72,6 +80,27 @@ public class ShapelessRecipe implements CraftingRecipe { +@@ -71,6 +79,27 @@ public class ShapelessRecipe implements CraftingRecipe { @Override public boolean matches(CraftingInput input, Level level) { diff --git a/divinemc-server/minecraft-patches/features/0046-C2ME-Density-Function-Compiler.patch b/divinemc-server/minecraft-patches/features/0046-C2ME-Density-Function-Compiler.patch index fc33497..2746fb1 100644 --- a/divinemc-server/minecraft-patches/features/0046-C2ME-Density-Function-Compiler.patch +++ b/divinemc-server/minecraft-patches/features/0046-C2ME-Density-Function-Compiler.patch @@ -11,7 +11,7 @@ All functions provided by vanilla are implemented. About Density function: https://minecraft.wiki/w/Density_function diff --git a/net/minecraft/util/CubicSpline.java b/net/minecraft/util/CubicSpline.java -index e4e1ecdfd28a1c6d0fd518668caed33a8ec45ec3..929820fcab17b1b804759c5e9fa36606e3add72c 100644 +index c8d7dafce978eb321ea8d253d9c66fefc544fc82..10c1a12b0a2dd8044e1fca333cd4fe179dd1451c 100644 --- a/net/minecraft/util/CubicSpline.java +++ b/net/minecraft/util/CubicSpline.java @@ -254,31 +254,47 @@ public interface CubicSpline> extends Bound @@ -111,7 +111,7 @@ index e4e1ecdfd28a1c6d0fd518668caed33a8ec45ec3..929820fcab17b1b804759c5e9fa36606 } } diff --git a/net/minecraft/world/level/levelgen/DensityFunctions.java b/net/minecraft/world/level/levelgen/DensityFunctions.java -index 73412c5b89b38f90a4c941acb3ce6f13e026c303..40d7965d95b78c6046b0da33f290eaeadd99c9b5 100644 +index 496df184cd2739d4de78afd8128f1bb5a56c92ef..5072c53b863a9975d60dfbd08c62448a673eca19 100644 --- a/net/minecraft/world/level/levelgen/DensityFunctions.java +++ b/net/minecraft/world/level/levelgen/DensityFunctions.java @@ -281,38 +281,66 @@ public final class DensityFunctions { @@ -339,20 +339,12 @@ index 73412c5b89b38f90a4c941acb3ce6f13e026c303..40d7965d95b78c6046b0da33f290eaea FlatCache("flat_cache"), Cache2D("cache_2d"), diff --git a/net/minecraft/world/level/levelgen/NoiseChunk.java b/net/minecraft/world/level/levelgen/NoiseChunk.java -index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2af3c6893 100644 +index a5fa45fd0f5460a2f0819f136dc134460d56ba27..669fd5f258839a7f4d56f10c7d7ec85bd6905015 100644 --- a/net/minecraft/world/level/levelgen/NoiseChunk.java +++ b/net/minecraft/world/level/levelgen/NoiseChunk.java -@@ -8,6 +8,7 @@ import java.util.Arrays; - import java.util.HashMap; - import java.util.List; - import java.util.Map; -+import java.util.function.Supplier; - import javax.annotation.Nullable; - import net.minecraft.core.QuartPos; - import net.minecraft.core.SectionPos; -@@ -21,7 +22,18 @@ import net.minecraft.world.level.chunk.ChunkAccess; - import net.minecraft.world.level.levelgen.blending.Blender; +@@ -21,7 +21,18 @@ import net.minecraft.world.level.levelgen.blending.Blender; import net.minecraft.world.level.levelgen.material.MaterialRuleList; + import org.jspecify.annotations.Nullable; -public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunction.FunctionContext { +// DivineMC start - Density Function Compiler @@ -366,11 +358,11 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 +import com.ishland.c2me.opts.dfc.common.vif.NoisePosVanillaInterface; +// DivineMC end - Density Function Compiler + -+public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunction.FunctionContext, IArrayCacheCapable, ICoordinatesFilling { - private final NoiseSettings noiseSettings; ++public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunction.FunctionContext, IArrayCacheCapable, ICoordinatesFilling { // DivineMC - Density Function Compiler final int cellCountXZ; final int cellCountY; -@@ -57,7 +69,47 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct + final int cellNoiseMinY; +@@ -56,7 +67,47 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct long interpolationCounter; long arrayInterpolationCounter; int arrayIndex; @@ -419,7 +411,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 @Override public DensityFunction.FunctionContext forIndex(int arrayIndex) { NoiseChunk.this.cellStartBlockY = (arrayIndex + NoiseChunk.this.cellNoiseMinY) * NoiseChunk.this.cellHeight; -@@ -77,7 +129,23 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -76,7 +127,23 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct values[i] = function.compute(NoiseChunk.this); } } @@ -444,7 +436,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 public static NoiseChunk forChunk( ChunkAccess chunk, -@@ -140,7 +208,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -138,7 +205,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } NoiseRouter noiseRouter = random.router(); @@ -453,7 +445,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 this.preliminarySurfaceLevel = noiseRouter1.preliminarySurfaceLevel(); if (!noiseGeneratorSettings.isAquifersEnabled()) { this.aquifer = Aquifer.createDisabled(fluidPicker); -@@ -156,7 +224,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -154,7 +221,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct DensityFunction densityFunction = DensityFunctions.cacheAllInCell( DensityFunctions.add(noiseRouter1.finalDensity(), DensityFunctions.BeardifierMarker.INSTANCE) ) @@ -462,7 +454,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 list.add(context -> this.aquifer.computeSubstance(context, densityFunction.compute(context))); if (noiseGeneratorSettings.oreVeinsEnabled()) { list.add(OreVeinifier.create(noiseRouter1.veinToggle(), noiseRouter1.veinRidged(), noiseRouter1.veinGap(), random.oreRandom())); -@@ -167,12 +235,14 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -165,12 +232,14 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct protected Climate.Sampler cachedClimateSampler(NoiseRouter noiseRouter, List points) { return new Climate.Sampler( @@ -483,7 +475,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 points ); } -@@ -378,6 +448,13 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -375,6 +444,13 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } private DensityFunction wrapNew(DensityFunction densityFunction) { @@ -497,8 +489,8 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 if (densityFunction instanceof DensityFunctions.Marker marker) { return (DensityFunction)(switch (marker.type()) { case Interpolated -> new NoiseChunk.NoiseInterpolator(marker.wrapped()); -@@ -487,10 +564,48 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct - BlockState calculate(DensityFunction.FunctionContext context); +@@ -483,10 +559,48 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct + @Nullable BlockState calculate(DensityFunction.FunctionContext context); } - static class Cache2D implements DensityFunctions.MarkerOrMarked, NoiseChunk.NoiseChunkDensityFunction { @@ -547,7 +539,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 Cache2D(DensityFunction function) { this.function = function; -@@ -527,9 +642,92 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -523,9 +637,92 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } } @@ -642,7 +634,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 CacheAllInCell(final DensityFunction noiseFiller) { this.noiseFiller = noiseFiller; -@@ -539,18 +737,51 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -535,18 +732,51 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct @Override public double compute(DensityFunction.FunctionContext context) { @@ -657,7 +649,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 - return i >= 0 && i1 >= 0 && i2 >= 0 && i < NoiseChunk.this.cellWidth && i1 < NoiseChunk.this.cellHeight && i2 < NoiseChunk.this.cellWidth - ? this.values[((NoiseChunk.this.cellHeight - 1 - i1) * NoiseChunk.this.cellWidth + i) * NoiseChunk.this.cellWidth + i2] + // DivineMC start - Density Function Compiler -+ Supplier run = () -> { ++ java.util.function.Supplier run = () -> { + if (context != NoiseChunk.this) { + return this.noiseFiller.compute(context); + } else if (!NoiseChunk.this.interpolating) { @@ -704,7 +696,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 } @Override -@@ -569,13 +800,84 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -565,12 +795,83 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } } @@ -714,8 +706,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 private long lastCounter; private long lastArrayCounter; private double lastValue; - @Nullable - private double[] lastArray; + private double @Nullable [] lastArray; + // DivineMC start - Density Function Compiler + private double c2me$lastValue = Double.NaN; + private int c2me$lastX = Integer.MIN_VALUE; @@ -790,7 +781,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 CacheOnce(final DensityFunction function) { this.function = function; -@@ -583,34 +885,82 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -578,34 +879,82 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct @Override public double compute(DensityFunction.FunctionContext context) { @@ -806,7 +797,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 - this.lastValue = d; - return d; + // DivineMC start - Density Function Compiler -+ Supplier run = () -> { ++ java.util.function.Supplier run = () -> { + if (context != NoiseChunk.this) { + return this.function.compute(context); + } else if (this.lastArray != null && this.lastArrayCounter == NoiseChunk.this.arrayInterpolationCounter) { @@ -893,7 +884,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 } @Override -@@ -624,10 +974,64 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -619,10 +968,64 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } } @@ -959,7 +950,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 FlatCache(final DensityFunction noiseFiller, final boolean computeValues) { this.noiseFiller = noiseFiller; -@@ -686,7 +1090,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -681,7 +1084,7 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } } @@ -968,7 +959,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 double[][] slice0; double[][] slice1; private DensityFunction noiseFiller; -@@ -705,6 +1109,104 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -700,6 +1103,104 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct private double valueZ0; private double valueZ1; private double value; @@ -1073,7 +1064,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 NoiseInterpolator(final DensityFunction noiseFiller) { this.noiseFiller = noiseFiller; -@@ -754,16 +1256,18 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -749,16 +1250,18 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct @Override public double compute(DensityFunction.FunctionContext context) { @@ -1088,7 +1079,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 - (double)NoiseChunk.this.inCellY / NoiseChunk.this.cellHeight, - (double)NoiseChunk.this.inCellZ / NoiseChunk.this.cellWidth, + // DivineMC start - Density Function Compiler -+ Supplier original = () -> { ++ java.util.function.Supplier original = () -> { + if (context != NoiseChunk.this) { + return this.noiseFiller.compute(context); + } else if (!NoiseChunk.this.interpolating) { @@ -1102,7 +1093,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 this.noise000, this.noise100, this.noise010, -@@ -773,8 +1277,45 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -768,8 +1271,45 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct this.noise011, this.noise111 ) @@ -1150,7 +1141,7 @@ index 39efa4329e7517fe0ec47d1e1975fc0d4ec5727c..a743c142b152ad696506dca7b04462d2 @Override diff --git a/net/minecraft/world/level/levelgen/RandomState.java b/net/minecraft/world/level/levelgen/RandomState.java -index f1e089ecfffa40cd794c49db30fcedf138d3fee9..f0f28f433523e0ee9379af5b70cffe8f8c87da5d 100644 +index 460c655baec3f55debd1a64b0e80479bca6ad8d3..412d5acb64fa61adb64b90a6264706ce37b909b6 100644 --- a/net/minecraft/world/level/levelgen/RandomState.java +++ b/net/minecraft/world/level/levelgen/RandomState.java @@ -122,6 +122,41 @@ public final class RandomState { diff --git a/divinemc-server/minecraft-patches/features/0047-Clump-experience-orbs.patch b/divinemc-server/minecraft-patches/features/0047-Clump-experience-orbs.patch index 4846386..d5eb5f2 100644 --- a/divinemc-server/minecraft-patches/features/0047-Clump-experience-orbs.patch +++ b/divinemc-server/minecraft-patches/features/0047-Clump-experience-orbs.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Clump experience orbs diff --git a/net/minecraft/world/entity/ExperienceOrb.java b/net/minecraft/world/entity/ExperienceOrb.java -index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792667321a7 100644 +index c655689cdd2d4e655dfc872edd231dcdfb7c0995..ddc2f9799fa159d43d96c08904801254b546fd72 100644 --- a/net/minecraft/world/entity/ExperienceOrb.java +++ b/net/minecraft/world/entity/ExperienceOrb.java -@@ -50,6 +50,10 @@ public class ExperienceOrb extends Entity { - @Nullable - public java.util.UUID triggerEntityId; +@@ -47,6 +47,10 @@ public class ExperienceOrb extends Entity { + public java.util.@Nullable UUID sourceEntityId; + public java.util.@Nullable UUID triggerEntityId; public org.bukkit.entity.ExperienceOrb.SpawnReason spawnReason = org.bukkit.entity.ExperienceOrb.SpawnReason.UNKNOWN; + // DivineMC start - Clump experience orbs + public java.util.Map clumps$clumpedMap; @@ -19,7 +19,7 @@ index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792 private void loadPaperNBT(ValueInput input) { input.read("Paper.ExpData", net.minecraft.nbt.CompoundTag.CODEC).ifPresent(expData -> { -@@ -272,6 +276,28 @@ public class ExperienceOrb extends Entity { +@@ -269,6 +273,28 @@ public class ExperienceOrb extends Entity { } private static boolean tryMergeToExisting(ServerLevel level, Vec3 pos, int amount) { @@ -48,7 +48,7 @@ index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792 // Paper - TODO some other event for this kind of merge AABB aabb = AABB.ofSize(pos, 1.0, 1.0, 1.0); int randomInt = level.getRandom().nextInt(io.papermc.paper.configuration.GlobalConfiguration.get().misc.xpOrbGroupsPerArea.or(ORB_GROUPS_PER_AREA)); // Paper - Configure how many orb groups per area -@@ -289,11 +315,11 @@ public class ExperienceOrb extends Entity { +@@ -286,11 +312,11 @@ public class ExperienceOrb extends Entity { } private boolean canMerge(ExperienceOrb orb) { @@ -62,7 +62,7 @@ index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792 } private void merge(ExperienceOrb orb) { -@@ -302,6 +328,18 @@ public class ExperienceOrb extends Entity { +@@ -299,6 +325,18 @@ public class ExperienceOrb extends Entity { return; } // Paper end - call orb merge event @@ -81,7 +81,7 @@ index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792 this.count = this.count + orb.count; this.age = Math.min(this.age, orb.age); orb.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.MERGE); // CraftBukkit - add Bukkit remove cause -@@ -343,6 +381,13 @@ public class ExperienceOrb extends Entity { +@@ -340,6 +378,13 @@ public class ExperienceOrb extends Entity { output.putInt("Value", this.getValue()); // Paper - save as Integer output.putInt("Count", this.count); this.savePaperNBT(output); // Paper @@ -95,7 +95,7 @@ index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792 } @Override -@@ -352,10 +397,52 @@ public class ExperienceOrb extends Entity { +@@ -349,10 +394,52 @@ public class ExperienceOrb extends Entity { this.setValue(input.getIntOr("Value", 0)); // Paper - load as Integer this.count = input.read("Count", ExtraCodecs.POSITIVE_INT).orElse(1); this.loadPaperNBT(input); // Paper @@ -148,7 +148,7 @@ index 189488367329df837f4a98cda5af2c80d8847b96..67e777a0f0f71c620014234e889f5792 if (entity instanceof ServerPlayer serverPlayer) { if (entity.takeXpDelay == 0 && new com.destroystokyo.paper.event.player.PlayerPickupExperienceEvent(serverPlayer.getBukkitEntity(), (org.bukkit.entity.ExperienceOrb) this.getBukkitEntity()).callEvent()) { // Paper - PlayerPickupExperienceEvent entity.takeXpDelay = org.bukkit.craftbukkit.event.CraftEventFactory.callPlayerXpCooldownEvent(entity, this.level().purpurConfig.playerExpPickupDelay, org.bukkit.event.player.PlayerExpCooldownChangeEvent.ChangeReason.PICKUP_ORB).getNewCooldown(); // CraftBukkit - entity.takeXpDelay = 2; // Purpur - Configurable player pickup exp delay -@@ -373,10 +460,60 @@ public class ExperienceOrb extends Entity { +@@ -370,10 +457,60 @@ public class ExperienceOrb extends Entity { } } diff --git a/divinemc-server/minecraft-patches/features/0048-SparklyPaper-Parallel-world-ticking.patch b/divinemc-server/minecraft-patches/features/0048-SparklyPaper-Parallel-world-ticking.patch index 7bc1057..7af8404 100644 --- a/divinemc-server/minecraft-patches/features/0048-SparklyPaper-Parallel-world-ticking.patch +++ b/divinemc-server/minecraft-patches/features/0048-SparklyPaper-Parallel-world-ticking.patch @@ -47,7 +47,7 @@ index 467065e3b40df17f38716499259b46663c174fd0..18822bed7986348bbbed1712db7dac65 if (!PlatformHooks.get().allowAsyncTicketUpdates() && isTickThread) { TickThread.ensureTickThread("Cannot asynchronously process ticket updates"); diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index 226088405c019922085285ba5d04d7c131470c69..5d9089d98ed0daa8ee680123e50c3ce9abd2bca6 100644 +index 9687a31e83d2d5be833cdd127ccef1415f3a3406..883504917170f59b04ad61304eb51bc5832e2c97 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java @@ -120,7 +120,7 @@ public final class ActivationRange { @@ -94,10 +94,10 @@ index ff747a1ecdf3c888bca0d69de4f85dcd810b6139..4970243433e7de4ec2e452f25f8737cd // The variable 'k' holds the maximum redstone power value of any adjacent blocks. // If 'k' has the highest level of all neighbors, then the power level of this diff --git a/net/minecraft/core/dispenser/DispenseItemBehavior.java b/net/minecraft/core/dispenser/DispenseItemBehavior.java -index 077ccddb7d358be352b6d497ed8b4e97b7d09262..7197434fdd304d0608b1d0bf2b1d6c6e2eb3d1df 100644 +index fc618f97cee829dbd4b0c167c5fe515a58189c37..1e4eeb81fe7ef7356d398bb89827869986e2ba8e 100644 --- a/net/minecraft/core/dispenser/DispenseItemBehavior.java +++ b/net/minecraft/core/dispenser/DispenseItemBehavior.java -@@ -412,8 +412,10 @@ public interface DispenseItemBehavior { +@@ -416,8 +416,10 @@ public interface DispenseItemBehavior { // CraftBukkit start level.captureTreeGeneration = false; if (!level.capturedBlockStates.isEmpty()) { @@ -111,10 +111,10 @@ index 077ccddb7d358be352b6d497ed8b4e97b7d09262..7197434fdd304d0608b1d0bf2b1d6c6e List states = new java.util.ArrayList<>(level.capturedBlockStates.values()); level.capturedBlockStates.clear(); diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 76fb33ddc89c699db5d0e423106f5bbbee17c958..c4c4c0c76a1763fa4c7dadffc89376f796b2d93b 100644 +index 190eb522be262d7a237aca69bb732463a1895caf..53e1eb987ada082d241ce6f691c3ef2b22f5e709 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -289,6 +289,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop serverPlayer1.connection.suspendFlushing()); this.server.getScheduler().mainThreadHeartbeat(); // CraftBukkit -@@ -1760,28 +1785,43 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop, ServerLevel> oldLevels = this.levels; Map, ServerLevel> newLevels = Maps.newLinkedHashMap(oldLevels); newLevels.remove(level.dimension()); @@ -262,7 +262,7 @@ index 76fb33ddc89c699db5d0e423106f5bbbee17c958..c4c4c0c76a1763fa4c7dadffc89376f7 } // CraftBukkit end diff --git a/net/minecraft/server/PlayerAdvancements.java b/net/minecraft/server/PlayerAdvancements.java -index 3836d60ce84fb26f30a609486a5755d3fd1c94f1..637531fad0d4eb230dc078c1bce201d57d13f9ef 100644 +index afa99de0800d1ac15fe496e6af62969764fcb865..da94b8419dad718e25057f2efc839d3c00ba9f47 100644 --- a/net/minecraft/server/PlayerAdvancements.java +++ b/net/minecraft/server/PlayerAdvancements.java @@ -53,7 +53,7 @@ public class PlayerAdvancements { @@ -273,16 +273,16 @@ index 3836d60ce84fb26f30a609486a5755d3fd1c94f1..637531fad0d4eb230dc078c1bce201d5 + private final Set progressChanged = org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking ? java.util.concurrent.ConcurrentHashMap.newKeySet() : new HashSet<>(); // DivineMC - Parallel world ticking private final Set rootsToUpdate = new HashSet<>(); private ServerPlayer player; - @Nullable -@@ -266,6 +266,7 @@ public class PlayerAdvancements { + private @Nullable AdvancementHolder lastSelectedTab; +@@ -265,6 +265,7 @@ public class PlayerAdvancements { } public void flushDirty(ServerPlayer player, boolean showAdvancements) { + final boolean isConcurrent = org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking; // DivineMC - Parallel world ticking if (this.isFirstPacket || !this.rootsToUpdate.isEmpty() || !this.progressChanged.isEmpty()) { - Map map = new HashMap<>(); + Map map = new HashMap<>(); Set set = new java.util.TreeSet<>(java.util.Comparator.comparing(adv -> adv.id().toString())); // Paper - Changed from HashSet to TreeSet ordered alphabetically. -@@ -277,13 +278,23 @@ public class PlayerAdvancements { +@@ -276,13 +277,23 @@ public class PlayerAdvancements { this.rootsToUpdate.clear(); @@ -312,10 +312,10 @@ index 3836d60ce84fb26f30a609486a5755d3fd1c94f1..637531fad0d4eb230dc078c1bce201d5 player.connection.send(new ClientboundUpdateAdvancementsPacket(this.isFirstPacket, set, set1, map, showAdvancements)); } diff --git a/net/minecraft/server/dedicated/DedicatedServer.java b/net/minecraft/server/dedicated/DedicatedServer.java -index c37851095cfe637a2768de0aa179efe66e9a4cde..1afd48654a421f0e0d4d5c2f27bdfe0b5f436bb8 100644 +index 013459615632ec7e55d72e56a7b18acfbb2d6bae..7a36b8609d9fdcb7b9ec862c3edc1c30d947ba84 100644 --- a/net/minecraft/server/dedicated/DedicatedServer.java +++ b/net/minecraft/server/dedicated/DedicatedServer.java -@@ -311,6 +311,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface +@@ -317,6 +317,13 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface } // DivineMC end - Pufferfish: SIMD Support @@ -330,10 +330,10 @@ index c37851095cfe637a2768de0aa179efe66e9a4cde..1afd48654a421f0e0d4d5c2f27bdfe0b LOGGER.info("Default game type: {}", properties.gameMode.get()); // Paper start - Unix domain socket support diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index c5b95557dc148cfc91c031bf0789001868a60cbd..6ea62fbffda38e477ef8e119608fc93793db95c3 100644 +index 416cae71b852bb7ad3efb8e11b81a29d71a6bec2..809bd6e35b629f73b5a93cd00225a90aa7fa89b7 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -176,8 +176,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -178,8 +178,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // call mid-tick tasks for chunk system if ((i & 7) == 0) { @@ -349,19 +349,19 @@ index c5b95557dc148cfc91c031bf0789001868a60cbd..6ea62fbffda38e477ef8e119608fc937 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1326be98e 100644 +index 7be8790e7c2b9f8fefc646ec6ebc4a21d63fd19f..3a27c522ee4702b9cca70900a5ae4de2a78d234c 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -186,7 +186,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -192,7 +192,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final ServerChunkCache chunkSource; private final MinecraftServer server; public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type - final EntityTickList entityTickList = new EntityTickList(); + final EntityTickList entityTickList = new EntityTickList(this); // DivineMC - Parallel world ticking private final ServerWaypointManager waypointManager; + private final EnvironmentAttributeSystem environmentAttributes; // Paper - rewrite chunk system - private final GameEventDispatcher gameEventDispatcher; -@@ -225,6 +225,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -231,6 +231,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public boolean hasRidableMoveEvent = false; // Purpur - Ridables public net.minecraft.world.item.ItemStack ominousBanner; // DivineMC - Optimize Raids public org.bxteam.divinemc.util.tps.TPSCalculator tpsCalculator = new org.bxteam.divinemc.util.tps.TPSCalculator(); // DivineMC - Lag Compensation @@ -369,16 +369,16 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 @Override public @Nullable LevelChunk getChunkIfLoaded(int x, int z) { -@@ -704,7 +705,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -712,7 +713,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.sleepStatus = new SleepStatus(); this.gameEventDispatcher = new GameEventDispatcher(this); this.randomSequences = Objects.requireNonNullElseGet(randomSequences, () -> this.getDataStorage().computeIfAbsent(RandomSequences.TYPE)); - this.waypointManager = new ServerWaypointManager(); + this.waypointManager = new ServerWaypointManager(this); // DivineMC - Parallel world ticking + this.environmentAttributes = EnvironmentAttributeSystem.builder().addDefaultLayers(this).build(); + this.updateSkyBrightness(); // Paper start - rewrite chunk system - this.moonrise$setEntityLookup(new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup((ServerLevel)(Object)this, ((ServerLevel)(Object)this).new EntityCallbacks())); - this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this); -@@ -722,6 +723,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -732,6 +733,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit this.preciseTime = this.serverLevelData.getDayTime(); // Purpur - Configurable daylight cycle this.ominousBanner = Objects.requireNonNullElse(this.registryAccess(), net.minecraft.core.RegistryAccess.EMPTY).lookup(Registries.BANNER_PATTERN).map(Raid::getOminousBannerInstance).orElse(null); // DivineMC - Optimize Raids @@ -392,7 +392,7 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 } // Paper start -@@ -763,6 +771,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -778,6 +786,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.advanceWeatherCycle(); } @@ -402,10 +402,10 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 + } + // DivineMC end - Parallel world ticking + - int _int = this.getGameRules().getInt(GameRules.RULE_PLAYERS_SLEEPING_PERCENTAGE); - if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(_int) && this.sleepStatus.areEnoughDeepSleeping(_int, this.players)) { // Purpur - Config for skipping night + int i = this.getGameRules().get(GameRules.PLAYERS_SLEEPING_PERCENTAGE); + if (this.purpurConfig.playersSkipNight && this.sleepStatus.areEnoughSleeping(i) && this.sleepStatus.areEnoughDeepSleeping(i, this.players)) { // Purpur - Config for skipping night // Paper start - create time skip event - move up calculations -@@ -1336,12 +1350,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1374,12 +1388,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (fluidState.is(fluid)) { fluidState.tick(this, pos, blockState); } @@ -423,7 +423,7 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 } private void tickBlock(BlockPos pos, Block block) { -@@ -1349,12 +1363,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1387,12 +1401,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (blockState.is(block)) { blockState.tick(this, pos, this.random); } @@ -441,7 +441,7 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 } // Paper start - log detailed entity tick information -@@ -1614,6 +1628,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1651,6 +1665,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } private void addPlayer(ServerPlayer player) { @@ -449,10 +449,10 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 Entity entity = this.getEntity(player.getUUID()); if (entity != null) { LOGGER.warn("Force-added player with duplicate UUID {}", player.getUUID()); -@@ -1626,7 +1641,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1663,7 +1678,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // CraftBukkit start - private boolean addEntity(Entity entity, @Nullable org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { + private boolean addEntity(Entity entity, org.bukkit.event.entity.CreatureSpawnEvent.@Nullable SpawnReason spawnReason) { - org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot + // DivineMC start - Parallel world ticking + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking) { @@ -465,10 +465,10 @@ index e17060524fee0751042aa835e3d7fa04f5dd9b1d..a6d7afbca70e9c7df14df2f7f74788a1 // Paper start - extra debug info if (entity.valid) { diff --git a/net/minecraft/server/level/ServerPlayer.java b/net/minecraft/server/level/ServerPlayer.java -index b1667ed08c417daf292e092ca0d2ab9848ac8d61..f7603988f9d818bd66eba8a9d3d3edbef347b6c2 100644 +index e662869de396db5d2481b86146096e0b262ab94f..6c2004c808de2b73c31727363c9b29ebd7c92aee 100644 --- a/net/minecraft/server/level/ServerPlayer.java +++ b/net/minecraft/server/level/ServerPlayer.java -@@ -444,6 +444,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -434,6 +434,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 @@ -476,7 +476,7 @@ index b1667ed08c417daf292e092ca0d2ab9848ac8d61..f7603988f9d818bd66eba8a9d3d3edbe // Paper start - rewrite chunk system private ca.spottedleaf.moonrise.patches.chunk_system.player.RegionizedPlayerChunkLoader.PlayerChunkLoaderData chunkLoader; -@@ -724,6 +725,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -721,6 +722,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc @Override public void tick() { @@ -484,7 +484,7 @@ index b1667ed08c417daf292e092ca0d2ab9848ac8d61..f7603988f9d818bd66eba8a9d3d3edbe // CraftBukkit start if (this.joining) { this.joining = false; -@@ -1558,6 +1560,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1556,6 +1558,7 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc teleportTransition.postTeleportTransition().onTransition(this); return this; } else { @@ -492,7 +492,7 @@ index b1667ed08c417daf292e092ca0d2ab9848ac8d61..f7603988f9d818bd66eba8a9d3d3edbe this.isChangingDimension = true; LevelData levelData = level.getLevelData(); this.connection.send(new ClientboundRespawnPacket(this.createCommonSpawnInfo(level), ClientboundRespawnPacket.KEEP_ALL_DATA)); -@@ -1874,6 +1877,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1881,6 +1884,12 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc return OptionalInt.empty(); } else { // CraftBukkit start @@ -505,7 +505,7 @@ index b1667ed08c417daf292e092ca0d2ab9848ac8d61..f7603988f9d818bd66eba8a9d3d3edbe this.containerMenu = abstractContainerMenu; // Moved up if (!this.isImmobile()) this.connection -@@ -1938,6 +1947,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc +@@ -1969,6 +1978,11 @@ public class ServerPlayer extends Player implements ca.spottedleaf.moonrise.patc } @Override public void closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { @@ -518,10 +518,10 @@ index b1667ed08c417daf292e092ca0d2ab9848ac8d61..f7603988f9d818bd66eba8a9d3d3edbe // Paper end - Inventory close reason this.connection.send(new ClientboundContainerClosePacket(this.containerMenu.containerId)); diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index 42af746efa840152dfb0a8d73d9d227115254acc..9acc247ec540449a0e4cf3a5a0bc67a0e3dfbf15 100644 +index 6a5f955fda51bc607a81deeba97e7a489bd31fee..3bcdc1dac6c3970b2d0ec23142e0dcd0880d1b91 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -150,6 +150,7 @@ public abstract class PlayerList { +@@ -154,6 +154,7 @@ public abstract class PlayerList { abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie cookie) { @@ -529,7 +529,7 @@ index 42af746efa840152dfb0a8d73d9d227115254acc..9acc247ec540449a0e4cf3a5a0bc67a0 player.isRealPlayer = true; // Paper player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed NameAndId nameAndId = player.nameAndId(); -@@ -597,6 +598,7 @@ public abstract class PlayerList { +@@ -603,6 +604,7 @@ public abstract class PlayerList { // Paper start - respawn event public ServerPlayer respawn(ServerPlayer player, boolean keepInventory, Entity.RemovalReason reason, org.bukkit.event.player.PlayerRespawnEvent.RespawnReason respawnReason) { @@ -537,7 +537,7 @@ index 42af746efa840152dfb0a8d73d9d227115254acc..9acc247ec540449a0e4cf3a5a0bc67a0 ServerPlayer.RespawnResult result = player.findRespawnPositionAndUseSpawnBlock0(!keepInventory, TeleportTransition.DO_NOTHING, respawnReason); if (result == null) { // disconnected player during the respawn event return player; -@@ -609,6 +611,7 @@ public abstract class PlayerList { +@@ -615,6 +617,7 @@ public abstract class PlayerList { player.level().removePlayerImmediately(player, reason); ServerLevel level = teleportTransition.newLevel(); ServerPlayer serverPlayer = player; // Paper - TODO - recreate instance @@ -546,7 +546,7 @@ index 42af746efa840152dfb0a8d73d9d227115254acc..9acc247ec540449a0e4cf3a5a0bc67a0 serverPlayer.restoreFrom(player, keepInventory); serverPlayer.setId(player.getId()); diff --git a/net/minecraft/server/waypoints/ServerWaypointManager.java b/net/minecraft/server/waypoints/ServerWaypointManager.java -index f9e7532f86122a379692561a639a209a126e8bba..839f6b7696ef85314da185bedba7cfc5870c314a 100644 +index 471e558a609c9e457720660b90fe57322b860461..0d12647a0dc1159eb1932c947058068d0a96b1b3 100644 --- a/net/minecraft/server/waypoints/ServerWaypointManager.java +++ b/net/minecraft/server/waypoints/ServerWaypointManager.java @@ -19,9 +19,17 @@ public class ServerWaypointManager implements WaypointManager portalEntityTask = entity -> { + assert entity.portalProcess != null; @@ -653,12 +652,16 @@ index 5d5e125e55daf55764846c0d7ce2c3150847aeb8..56483d9e770e29526a36d4c8c5565092 + return; + } + -+ TeleportTransition portalDestination = entity.portalProcess.getPortalDestination(serverLevel, entity); ++ TeleportTransition portalDestination = this.portalProcess.getPortalDestination(serverLevel, this); + if (portalDestination != null) { + ServerLevel level = portalDestination.newLevel(); -+ if (entity instanceof ServerPlayer // CraftBukkit - always call event for players -+ || (level != null && (level.dimension() == serverLevel.dimension() || entity.canTeleport(serverLevel, level)))) { // CraftBukkit -+ entity.teleport(portalDestination); ++ if (this instanceof ServerPlayer // CraftBukkit - always call event for players ++ || (level != null && (level.dimension() == serverLevel.dimension() || this.canTeleport(serverLevel, level))) // CraftBukkit + ) +- { +- this.teleport(portalDestination); ++ { ++ this.teleport(portalDestination); + } } + @@ -675,16 +678,16 @@ index 5d5e125e55daf55764846c0d7ce2c3150847aeb8..56483d9e770e29526a36d4c8c5565092 } else if (this.portalProcess.hasExpired()) { this.portalProcess = null; } -@@ -4125,6 +4145,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -4145,6 +4165,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name + } - @Nullable - private Entity teleportCrossDimension(ServerLevel oldLevel, ServerLevel newLevel, TeleportTransition teleportTransition) { + private @Nullable Entity teleportCrossDimension(ServerLevel oldLevel, ServerLevel newLevel, TeleportTransition teleportTransition) { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(newLevel, "Cannot teleport entity to another world off-main, from world " + oldLevel.getWorld().getName() + " to world " + newLevel.getWorld().getName()); // DivineMC - Parallel world ticking List passengers = this.getPassengers(); List list = new ArrayList<>(passengers.size()); this.ejectPassengers(); diff --git a/net/minecraft/world/entity/PortalProcessor.java b/net/minecraft/world/entity/PortalProcessor.java -index 91f6d43b3785ddad7db8eb529ba3293c45f3588d..7fd5f40ee928330769bbe0c5e8da17fa65b30db6 100644 +index 54ab44c223465a8111afd98e5d135595902a6a27..9b06d760c768787968066b754671520a178e0035 100644 --- a/net/minecraft/world/entity/PortalProcessor.java +++ b/net/minecraft/world/entity/PortalProcessor.java @@ -11,6 +11,7 @@ public class PortalProcessor { @@ -703,7 +706,7 @@ index 91f6d43b3785ddad7db8eb529ba3293c45f3588d..7fd5f40ee928330769bbe0c5e8da17fa if (!this.insidePortalThisTick) { this.decayTick(); return false; -@@ -52,7 +54,7 @@ public class PortalProcessor { +@@ -51,7 +53,7 @@ public class PortalProcessor { } public boolean hasExpired() { @@ -712,7 +715,7 @@ index 91f6d43b3785ddad7db8eb529ba3293c45f3588d..7fd5f40ee928330769bbe0c5e8da17fa } public BlockPos getEntryPosition() { -@@ -78,4 +80,30 @@ public class PortalProcessor { +@@ -77,4 +79,30 @@ public class PortalProcessor { public boolean isSamePortal(Portal portal) { return this.portal == portal; } @@ -744,7 +747,7 @@ index 91f6d43b3785ddad7db8eb529ba3293c45f3588d..7fd5f40ee928330769bbe0c5e8da17fa + // DivineMC end - Parallel world ticking } diff --git a/net/minecraft/world/entity/ai/behavior/GoToPotentialJobSite.java b/net/minecraft/world/entity/ai/behavior/GoToPotentialJobSite.java -index 6adf1b2250234ede6e6f498ed0990ab523f09b8e..a8ae790a7b9bfd0d78cac0577bb7a4ddac7f064b 100644 +index eefc8f835f8818407612eadf3f2df5730a0bbe97..a627447b790a468a3aee8bc7b7eaae052dbc6328 100644 --- a/net/minecraft/world/entity/ai/behavior/GoToPotentialJobSite.java +++ b/net/minecraft/world/entity/ai/behavior/GoToPotentialJobSite.java @@ -43,15 +43,31 @@ public class GoToPotentialJobSite extends Behavior { @@ -786,11 +789,11 @@ index 6adf1b2250234ede6e6f498ed0990ab523f09b8e..a8ae790a7b9bfd0d78cac0577bb7a4dd }); entity.getBrain().eraseMemory(MemoryModuleType.POTENTIAL_JOB_SITE); } -diff --git a/net/minecraft/world/entity/npc/Villager.java b/net/minecraft/world/entity/npc/Villager.java -index a356da48b20ab38648d75f9066b2ed4a013c13c2..415b021c8f0b68e2aacd23b568ca35d95bf2ce66 100644 ---- a/net/minecraft/world/entity/npc/Villager.java -+++ b/net/minecraft/world/entity/npc/Villager.java -@@ -794,13 +794,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler +diff --git a/net/minecraft/world/entity/npc/villager/Villager.java b/net/minecraft/world/entity/npc/villager/Villager.java +index 2efa081b835779f16a3701a1f195e89475e73014..26d0ca93ee924151efb2b981897d86af357a50e6 100644 +--- a/net/minecraft/world/entity/npc/villager/Villager.java ++++ b/net/minecraft/world/entity/npc/villager/Villager.java +@@ -788,13 +788,24 @@ public class Villager extends AbstractVillager implements ReputationEventHandler this.brain.getMemory(moduleType).ifPresent(pos -> { ServerLevel level = server.getLevel(pos.dimension()); if (level != null) { @@ -821,11 +824,11 @@ index a356da48b20ab38648d75f9066b2ed4a013c13c2..415b021c8f0b68e2aacd23b568ca35d9 } }); } -diff --git a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -index 9213d25928066ee6722f1a145ae37e99d6e62582..28f0b59500d67bdd92c97a7e138c94887caa043b 100644 ---- a/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -+++ b/net/minecraft/world/entity/projectile/ThrownEnderpearl.java -@@ -104,43 +104,53 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { +diff --git a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java +index 6ad07d8f82c0f745d3c3c742f25d05b9b38193c2..034713574900d9d9193005514e89e5bfad6f232a 100644 +--- a/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java ++++ b/net/minecraft/world/entity/projectile/throwableitemprojectile/ThrownEnderpearl.java +@@ -102,43 +102,53 @@ public class ThrownEnderpearl extends ThrowableItemProjectile { Vec3 vec3 = this.oldPosition(); if (owner instanceof ServerPlayer serverPlayer) { if (serverPlayer.connection.isAcceptingMessages()) { @@ -913,10 +916,10 @@ index 9213d25928066ee6722f1a145ae37e99d6e62582..28f0b59500d67bdd92c97a7e138c9488 } else { Entity entity = owner.teleport( diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java -index 276b5e6ac82e6e55e0a19c25a7c966501aeaba44..c3021c0a8c588acf5ae8c9231e75bda984863267 100644 +index 8e82525f5aa164210aa52dac9b6f9ca5b0fa64ef..c794021c49b67463326d3c0335e623350ca27b27 100644 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -96,8 +96,14 @@ public abstract class AbstractContainerMenu { +@@ -93,8 +93,14 @@ public abstract class AbstractContainerMenu { public void startOpen() {} // CraftBukkit end @@ -932,10 +935,10 @@ index 276b5e6ac82e6e55e0a19c25a7c966501aeaba44..c3021c0a8c588acf5ae8c9231e75bda9 this.containerId = containerId; } diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index e4bcd4a3cbbc8942d52e5f3c7a4fb1572fdef91c..52a8a818a636e35b486b8aaf482cd68849a0bbcd 100644 +index fd90ba8eba88c8d4fa372cb1047e0af8528f914d..5f41d23d98ab1d762258a87a7af45a4e180e2fcf 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -399,8 +399,10 @@ public final class ItemStack implements DataComponentHolder { +@@ -404,8 +404,10 @@ public final class ItemStack implements DataComponentHolder { if (interactionResult.consumesAction() && serverLevel.captureTreeGeneration && !serverLevel.capturedBlockStates.isEmpty()) { serverLevel.captureTreeGeneration = false; org.bukkit.Location location = org.bukkit.craftbukkit.util.CraftLocation.toBukkit(clickedPos, serverLevel); @@ -949,7 +952,7 @@ index e4bcd4a3cbbc8942d52e5f3c7a4fb1572fdef91c..52a8a818a636e35b486b8aaf482cd688 serverLevel.capturedBlockStates.clear(); org.bukkit.event.world.StructureGrowEvent structureEvent = null; diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 21a20aa602f51bbd6c8cdcb52f6b485971834595..7fe5cb2ea1c81b12baf302999a2794f20018707c 100644 +index fafee0fe15564b47da3641858e60d10cdd860ef4..09395fa632835ae34bdf01002ae60b5b84b52398 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -171,6 +171,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -960,7 +963,7 @@ index 21a20aa602f51bbd6c8cdcb52f6b485971834595..7fe5cb2ea1c81b12baf302999a2794f2 // Purpur start - Add adjustable breeding cooldown to config private com.google.common.cache.Cache playerBreedingCooldowns; -@@ -921,6 +922,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -920,6 +921,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.damageSources = new DamageSources(registryAccess); this.entityLookup = new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.dfl.DefaultEntityLookup(this); // Paper - rewrite chunk system this.chunkPacketBlockController = this.paperConfig().anticheat.antiXray.enabled ? new io.papermc.paper.antixray.ChunkPacketBlockControllerAntiXray(this, executor) : io.papermc.paper.antixray.ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray @@ -968,15 +971,15 @@ index 21a20aa602f51bbd6c8cdcb52f6b485971834595..7fe5cb2ea1c81b12baf302999a2794f2 } // Paper start - Cancel hit for vanished players -@@ -1089,6 +1091,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1096,6 +1098,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override - public boolean setBlock(BlockPos pos, BlockState state, int flags, int recursionLeft) { + public boolean setBlock(BlockPos pos, BlockState state, @Block.UpdateFlags int flags, int recursionLeft) { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread((ServerLevel)this, pos, "Updating block asynchronously"); // DivineMC - Parallel world ticking (additional concurrency issues logs) // CraftBukkit start - tree generation if (this.captureTreeGeneration) { // Paper start - Protect Bedrock and End Portal/Frames from being destroyed -@@ -1472,11 +1475,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1467,11 +1470,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // DivineMC - optimize block entity removals - Fix MC-117075 } else if (runsNormally && this.shouldTickBlocksAt(tickingBlockEntity.getPos())) { tickingBlockEntity.tick(); @@ -993,7 +996,7 @@ index 21a20aa602f51bbd6c8cdcb52f6b485971834595..7fe5cb2ea1c81b12baf302999a2794f2 } } this.blockEntityTickers.removeMarkedEntries(); // DivineMC - optimize block entity removals - Fix MC-117075 -@@ -1496,7 +1500,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1491,7 +1495,11 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl entity.discard(org.bukkit.event.entity.EntityRemoveEvent.Cause.DISCARD); // Paper end - Prevent block entity and entity crashes } @@ -1006,23 +1009,23 @@ index 21a20aa602f51bbd6c8cdcb52f6b485971834595..7fe5cb2ea1c81b12baf302999a2794f2 } // Paper start - Option to prevent armor stands from doing entity lookups -@@ -1638,6 +1646,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl - @Nullable +@@ -1632,6 +1640,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl + @Override - public BlockEntity getBlockEntity(BlockPos pos) { + public @Nullable BlockEntity getBlockEntity(BlockPos pos) { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThreadOrAsyncThread((ServerLevel) this, "Cannot read world asynchronously"); // DivineMC - Parallel world ticking // Paper start - Perf: Optimize capturedTileEntities lookup net.minecraft.world.level.block.entity.BlockEntity blockEntity; if (!this.capturedTileEntities.isEmpty() && (blockEntity = this.capturedTileEntities.get(pos)) != null) { -@@ -1654,6 +1663,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1648,6 +1657,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl } public void setBlockEntity(BlockEntity blockEntity) { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread((ServerLevel) this, "Cannot modify world asynchronously"); // DivineMC - Parallel world ticking BlockPos blockPos = blockEntity.getBlockPos(); - if (!this.isOutsideBuildHeight(blockPos)) { + if (this.isInValidBounds(blockPos)) { // CraftBukkit start -@@ -1739,6 +1749,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1729,6 +1739,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @Override public List getEntities(@Nullable Entity entity, AABB boundingBox, Predicate predicate) { @@ -1030,7 +1033,7 @@ index 21a20aa602f51bbd6c8cdcb52f6b485971834595..7fe5cb2ea1c81b12baf302999a2794f2 List list = Lists.newArrayList(); // Paper start - rewrite chunk system -@@ -2088,8 +2099,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -2057,8 +2068,15 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public abstract RecipeAccess recipeAccess(); public BlockPos getBlockRandomPos(int x, int y, int z, int yMask) { @@ -1078,10 +1081,10 @@ index 9176cf8c47b19d76eb49a7c00fc6723836344d4b..05d173cb97b9c40d24b4c8485d509592 return true; } else { diff --git a/net/minecraft/world/level/block/RedStoneWireBlock.java b/net/minecraft/world/level/block/RedStoneWireBlock.java -index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..9f21d0a93a712538a15761c5834210856458bc78 100644 +index 6d98bc37d88459d1e0a171b52bbff5810d775c38..0b8bccbf8335d982c83c9b379cb78b96567401eb 100644 --- a/net/minecraft/world/level/block/RedStoneWireBlock.java +++ b/net/minecraft/world/level/block/RedStoneWireBlock.java -@@ -66,6 +66,7 @@ public class RedStoneWireBlock extends Block { +@@ -65,6 +65,7 @@ public class RedStoneWireBlock extends Block { private final BlockState crossState; private final RedstoneWireEvaluator evaluator = new DefaultRedstoneWireEvaluator(this); public boolean shouldSignal = true; @@ -1089,7 +1092,7 @@ index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..9f21d0a93a712538a15761c583421085 @Override public MapCodec codec() { -@@ -283,7 +284,13 @@ public class RedStoneWireBlock extends Block { +@@ -282,7 +283,13 @@ public class RedStoneWireBlock extends Block { if (orientation != null) { source = pos.relative(orientation.getFront().getOpposite()); } @@ -1104,7 +1107,7 @@ index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..9f21d0a93a712538a15761c583421085 return; } updatePowerStrength(worldIn, pos, state, orientation, blockAdded); -@@ -311,7 +318,13 @@ public class RedStoneWireBlock extends Block { +@@ -310,7 +317,13 @@ public class RedStoneWireBlock extends Block { // [Space Walker] suppress shape updates and emit those manually to // bypass the new neighbor update stack. if (level.setBlock(pos, state, Block.UPDATE_KNOWN_SHAPE | Block.UPDATE_CLIENTS)) { @@ -1119,7 +1122,7 @@ index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..9f21d0a93a712538a15761c583421085 } } } -@@ -328,10 +341,19 @@ public class RedStoneWireBlock extends Block { +@@ -327,10 +340,19 @@ public class RedStoneWireBlock extends Block { } public int getBlockSignal(Level level, BlockPos pos) { @@ -1143,7 +1146,7 @@ index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..9f21d0a93a712538a15761c583421085 } private void checkCornerChangeAt(Level level, BlockPos pos) { -@@ -422,12 +444,23 @@ public class RedStoneWireBlock extends Block { +@@ -421,12 +443,23 @@ public class RedStoneWireBlock extends Block { @Override protected int getDirectSignal(BlockState state, BlockGetter level, BlockPos pos, Direction side) { @@ -1169,7 +1172,7 @@ index a07d9237d227fe6d419d8a9bc44fc623b244ad3e..9f21d0a93a712538a15761c583421085 int powerValue = state.getValue(POWER); if (powerValue == 0) { return 0; -@@ -459,7 +492,13 @@ public class RedStoneWireBlock extends Block { +@@ -458,7 +491,13 @@ public class RedStoneWireBlock extends Block { @Override protected boolean isSignalSource(BlockState state) { @@ -1236,23 +1239,6 @@ index 23e9e5e7ef76fe3d6e1bbc41faf69ee65ca77d80..9d52904766fd48902b85bdc34ffafcd8 org.bukkit.Bukkit.getPluginManager().callEvent(event); } if (event == null || !event.isCancelled()) { -diff --git a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -index 1b2f8c4e1e362dc63fde2c7139039f0ce7eb762f..7c2acea8af6a3110d782b9b3afeac0915ac127da 100644 ---- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -+++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -@@ -76,6 +76,12 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co - } - - public static boolean canUnlock(Player player, LockCode code, Component displayName, @Nullable BlockEntity blockEntity) { -+ // DivineMC start - Parallel world ticking -+ if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking && player instanceof net.minecraft.server.level.ServerPlayer serverPlayer && blockEntity != null && blockEntity.getLevel() != serverPlayer.level()) { -+ net.minecraft.server.MinecraftServer.LOGGER.warn("Player {} ({}) attempted to open a BlockEntity @ {} {}, {}, {} while they were in a different world {} than the block themselves!", serverPlayer.getScoreboardName(), serverPlayer.getStringUUID(), blockEntity.getLevel().getWorld().getName(), blockEntity.getBlockPos().getX(), blockEntity.getBlockPos().getY(), blockEntity.getBlockPos().getZ(), serverPlayer.level().getWorld().getName()); -+ return false; -+ } -+ // DivineMC end - Parallel world ticking - if (player instanceof net.minecraft.server.level.ServerPlayer serverPlayer && blockEntity != null && blockEntity.getLevel() != null && blockEntity.getLevel().getBlockEntity(blockEntity.getBlockPos()) == blockEntity) { - final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); - net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(displayName)); diff --git a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java index ab7be4298be22af32c4726f178b93896b96f599d..d78dc310002ebb4149b60a35bf514f1fd49f95c9 100644 --- a/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java @@ -1268,10 +1254,10 @@ index ab7be4298be22af32c4726f178b93896b96f599d..d78dc310002ebb4149b60a35bf514f1f @Override diff --git a/net/minecraft/world/level/block/grower/TreeGrower.java b/net/minecraft/world/level/block/grower/TreeGrower.java -index 3efebec19a1b4fefd6071247c614693e44bc3eb4..e71eb14879afc59298c87714062f7c4ee5ad0a8a 100644 +index 5471619a0484ece08640e2b3fd26746c351dc3e0..1b3a332d02c443be592b6b55fe17a7eccf1aa393 100644 --- a/net/minecraft/world/level/block/grower/TreeGrower.java +++ b/net/minecraft/world/level/block/grower/TreeGrower.java -@@ -203,55 +203,59 @@ public final class TreeGrower { +@@ -201,55 +201,59 @@ public final class TreeGrower { // CraftBukkit start private void setTreeType(Holder> feature) { @@ -1355,22 +1341,22 @@ index 3efebec19a1b4fefd6071247c614693e44bc3eb4..e71eb14879afc59298c87714062f7c4e // CraftBukkit end } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 2d4807134e071254ce882e0bc4988242894c5d2f..40500e24156049e09a9970b120556f8aa49ffcaf 100644 +index 63e391441f655138ddfd303270f33c7a35655ca5..482029bc19a3a05aff8924257128ee9c9b5ca7a1 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -372,6 +372,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot - @Nullable +@@ -370,6 +370,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot + @Override - public BlockState setBlockState(BlockPos pos, BlockState state, int flags) { + public @Nullable BlockState setBlockState(BlockPos pos, BlockState state, @Block.UpdateFlags int flags) { + if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableParallelWorldTicking) ca.spottedleaf.moonrise.common.util.TickThread.ensureTickThread(this.level, pos, "Updating block asynchronously"); // DivineMC - Parallel world ticking int y = pos.getY(); LevelChunkSection section = this.getSection(this.getSectionIndex(y)); boolean hasOnlyAir = section.hasOnlyAir(); diff --git a/net/minecraft/world/level/entity/EntityTickList.java b/net/minecraft/world/level/entity/EntityTickList.java -index c89701d7bdc9b889038d3c52f2232fb17624b113..42cb7885a0073d872676e32cf6b1253a7166a561 100644 +index a8a5017de2ee0c00bed9b56f2f3c85d23e4056e9..608c70a8247f75f1367ca1e875b0b9c92030dab1 100644 --- a/net/minecraft/world/level/entity/EntityTickList.java +++ b/net/minecraft/world/level/entity/EntityTickList.java -@@ -11,25 +11,67 @@ import net.minecraft.world.entity.Entity; +@@ -11,25 +11,67 @@ import org.jspecify.annotations.Nullable; public class EntityTickList { public final ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet entities = new ca.spottedleaf.moonrise.common.list.IteratorSafeOrderedReferenceSet<>(); // Paper - rewrite chunk system diff --git a/divinemc-server/minecraft-patches/features/0049-MSPT-Tracking-for-each-world.patch b/divinemc-server/minecraft-patches/features/0049-MSPT-Tracking-for-each-world.patch index 984a792..e9723fd 100644 --- a/divinemc-server/minecraft-patches/features/0049-MSPT-Tracking-for-each-world.patch +++ b/divinemc-server/minecraft-patches/features/0049-MSPT-Tracking-for-each-world.patch @@ -5,10 +5,10 @@ Subject: [PATCH] MSPT Tracking for each world diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index c4c4c0c76a1763fa4c7dadffc89376f796b2d93b..01a75f0a3692b954f43993b586945e26163e91e0 100644 +index 53e1eb987ada082d241ce6f691c3ef2b22f5e709..fd183c0cb9bc9de2a717e9e6845ff76ec84ba438 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1730,7 +1730,15 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { +@@ -303,7 +303,7 @@ public class Connection extends SimpleChannelInboundHandler> { private static void syncAfterConfigurationChange(ChannelFuture future) { try { @@ -21,10 +21,10 @@ index 35b6f8365f4568da7bc0f4e47c39cb3690292aaf..e28d859b457ca0e24bc6dc9d6cd4a97f if (var2 instanceof ClosedChannelException) { LOGGER.info("Connection closed during protocol change"); diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index 04dd1bec1aff470e67a21fb0b25932685992ec82..d22088a2648f1394206131302d10708c9d3484db 100644 +index 27144f8572eba20e1ced8d8eff0205925d23df3f..34f45b931a86987412c6c23b3dcdaf5c916b87b1 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -737,19 +737,23 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -751,19 +751,23 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP // Paper start - optimise chunk tick iteration final ca.spottedleaf.moonrise.common.list.ReferenceList tickingChunks = ((ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickServerLevel)this.level).moonrise$getPlayerTickingChunks(); @@ -58,10 +58,10 @@ index 04dd1bec1aff470e67a21fb0b25932685992ec82..d22088a2648f1394206131302d10708c } diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef88297625272e7a597 100644 +index 809bd6e35b629f73b5a93cd00225a90aa7fa89b7..27b3d6109a4b1b82dd54aaf475a01a4250ed10f2 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -57,7 +57,7 @@ import org.slf4j.Logger; +@@ -56,7 +56,7 @@ import org.slf4j.Logger; public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moonrise.patches.chunk_system.world.ChunkSystemServerChunkCache { // Paper - rewrite chunk system private static final Logger LOGGER = LogUtils.getLogger(); private final DistanceManager distanceManager; @@ -70,29 +70,29 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 public final Thread mainThread; final ThreadedLevelLightEngine lightEngine; public final ServerChunkCache.MainThreadExecutor mainThreadProcessor; -@@ -71,8 +71,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -70,8 +70,10 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon private final long[] lastChunkPos = new long[4]; - private final ChunkStatus[] lastChunkStatus = new ChunkStatus[4]; - private final ChunkAccess[] lastChunk = new ChunkAccess[4]; + private final @Nullable ChunkStatus[] lastChunkStatus = new ChunkStatus[4]; + private final @Nullable ChunkAccess[] lastChunk = new ChunkAccess[4]; - private final List spawningChunks = new ObjectArrayList<>(); - private final Set chunkHoldersToBroadcast = new ReferenceOpenHashSet<>(); + // DivineMC start - Regionized Chunk Ticking + private final ObjectArrayList spawningChunks = new ObjectArrayList<>(); + private final Set chunkHoldersToBroadcast = java.util.Collections.synchronizedSet(new ReferenceOpenHashSet<>()); + // DivineMC end - Regionized Chunk Ticking - @Nullable @VisibleForDebug - private NaturalSpawner.SpawnState lastSpawnState; -@@ -156,7 +158,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon + private NaturalSpawner.@Nullable SpawnState lastSpawnState; + // DivineMC start - Pufferfish: Optimize mob spawning +@@ -158,7 +160,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // Paper end - rewrite chunk system // Paper start - chunk tick iteration optimisations private final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom shuffleRandom = new ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom(0L); - private void iterateTickingChunksFaster() { + protected void iterateTickingChunksFaster(final CompletableFuture spawns) { // DivineMC - private -> protected Regionized Chunk Ticking final ServerLevel world = this.level; - final int randomTickSpeed = world.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + final int randomTickSpeed = world.getGameRules().get(GameRules.RANDOM_TICK_SPEED); -@@ -176,14 +178,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -178,14 +180,16 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon // call mid-tick tasks for chunk system if ((i & 7) == 0) { @@ -115,7 +115,7 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 } // Paper end - chunk tick iteration optimisations -@@ -502,14 +506,21 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -496,14 +500,21 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon long gameTime = this.level.getGameTime(); long l = gameTime - this.lastInhabitedUpdate; this.lastInhabitedUpdate = gameTime; @@ -141,7 +141,7 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 // DivineMC start - Pufferfish: Optimize mob spawning if (org.bxteam.divinemc.config.DivineConfig.AsyncCategory.enableAsyncSpawning) { for (ServerPlayer player : this.level.players) { -@@ -553,14 +564,18 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -547,14 +558,18 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } private void broadcastChangedChunks() { @@ -166,7 +166,7 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 } private void tickChunks(long timeInhabited) { -@@ -610,6 +625,24 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -604,6 +619,24 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon filteredSpawningCategories = List.of(); } @@ -180,8 +180,8 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 + } + // DivineMC end - Regionized Chunk Ticking + -+ this.iterateTickingChunksFaster(spawns); // Paper - chunk tick iteration optimisations // DivineMC - Regionized Chunk Ticking -+ if (_boolean) { ++ this.iterateTickingChunksFaster(spawns); // Paper - chunk tick iteration optimizations // DivineMC - Regionized Chunk Ticking ++ if (flag) { + this.level.tickCustomSpawners(this.spawnEnemies); + } + } @@ -191,14 +191,14 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 List list = this.spawningChunks; try { -@@ -627,12 +660,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -621,12 +654,12 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } finally { list.clear(); } + } -- this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimisations -- if (_boolean) { +- this.iterateTickingChunksFaster(); // Paper - chunk tick iteration optimizations +- if (flag) { - this.level.tickCustomSpawners(this.spawnEnemies); - } + protected net.minecraft.world.level.entity.EntityTickList getEntityTickList() { @@ -209,10 +209,10 @@ index 6ea62fbffda38e477ef8e119608fc93793db95c3..66072f0851be5ca75f9fbef882976252 private void tickSpawningChunk(LevelChunk chunk, long timeInhabited, List spawnCategories, NaturalSpawner.SpawnState spawnState) { ChunkPos pos = chunk.getPos(); diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index d5fd3688f2a72ef09a6206a58565cf58a61e9498..a69876e036b711091f72afe0297bd719fae30174 100644 +index 259b1bd7f46acbe05681cb3e58bf7bf921fcf440..eb2ed61faac0d4803298325dc5aeec3c6b0a1ad2 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -197,7 +197,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -204,7 +204,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe private final LevelTicks blockTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded); private final LevelTicks fluidTicks = new LevelTicks<>(this::isPositionTickingWithEntitiesLoaded); private final PathTypeCache pathTypesByPosCache = new PathTypeCache(); @@ -221,7 +221,7 @@ index d5fd3688f2a72ef09a6206a58565cf58a61e9498..a69876e036b711091f72afe0297bd719 volatile boolean isUpdatingNavigations; protected final Raids raids; private final ObjectLinkedOpenHashSet blockEvents = new ObjectLinkedOpenHashSet<>(); -@@ -666,19 +666,37 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -672,19 +672,37 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe boolean flag = server.forceSynchronousWrites(); DataFixer fixerUpper = server.getFixerUpper(); // Paper - rewrite chunk system @@ -271,8 +271,8 @@ index d5fd3688f2a72ef09a6206a58565cf58a61e9498..a69876e036b711091f72afe0297bd719 + // DivineMC end - Regionized Chunk Ticking this.chunkSource.getGeneratorState().ensureStructuresGenerated(); this.portalForcer = new PortalForcer(this); - this.updateSkyBrightness(); -@@ -846,6 +864,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + if (this.canHaveWeather()) { +@@ -861,6 +879,12 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe this.dragonFight.tick(); } @@ -285,7 +285,7 @@ index d5fd3688f2a72ef09a6206a58565cf58a61e9498..a69876e036b711091f72afe0297bd719 io.papermc.paper.entity.activation.ActivationRange.activateEntities(this); // Paper - EAR this.entityTickList .forEach( -@@ -871,6 +895,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -886,6 +910,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe } ); this.tickBlockEntities(); @@ -293,7 +293,7 @@ index d5fd3688f2a72ef09a6206a58565cf58a61e9498..a69876e036b711091f72afe0297bd719 } // Paper - rewrite chunk system -@@ -1874,22 +1899,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1911,22 +1936,16 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe if (Shapes.joinIsNotEmpty(collisionShape, collisionShape1, BooleanOp.NOT_SAME)) { List list = new ObjectArrayList<>(); @@ -325,7 +325,7 @@ index d5fd3688f2a72ef09a6206a58565cf58a61e9498..a69876e036b711091f72afe0297bd719 try { this.isUpdatingNavigations = true; diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 7fe5cb2ea1c81b12baf302999a2794f20018707c..738cbde3595165e0f05c0a6fde21499e98dc850b 100644 +index 09395fa632835ae34bdf01002ae60b5b84b52398..2c6f6f3bf53529673415987904465a2362aad96e 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -113,7 +113,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -346,7 +346,7 @@ index 7fe5cb2ea1c81b12baf302999a2794f20018707c..738cbde3595165e0f05c0a6fde21499e public Map capturedTileEntities = new java.util.LinkedHashMap<>(); // Paper - Retain block place order when capturing blockstates @Nullable public List captureDrops; -@@ -1459,10 +1459,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1454,10 +1454,14 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl public void tickBlockEntities() { this.tickingBlockEntities = true; @@ -365,10 +365,10 @@ index 7fe5cb2ea1c81b12baf302999a2794f20018707c..738cbde3595165e0f05c0a6fde21499e // Spigot start boolean runsNormally = this.tickRateManager().runsNormally(); diff --git a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java -index 5d17213a692016d2f005c7820bf2cf1f42ce411f..ccb2e0c28aeaebbeef15fbb650fa3c2e5c241ceb 100644 +index 0a60ff97dc77108997568c75c94327cb6858018f..96f7621eccb446559fb069c99769c8b2cdc1e6a6 100644 --- a/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java +++ b/net/minecraft/world/level/redstone/CollectingNeighborUpdater.java -@@ -53,7 +53,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { +@@ -52,7 +52,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { this.addAndRun(pos, new CollectingNeighborUpdater.MultiNeighborUpdate(pos.immutable(), block, orientation, facing)); } @@ -377,7 +377,7 @@ index 5d17213a692016d2f005c7820bf2cf1f42ce411f..ccb2e0c28aeaebbeef15fbb650fa3c2e boolean flag = this.count > 0; boolean flag1 = this.maxChainedNeighborUpdates >= 0 && this.count >= this.maxChainedNeighborUpdates; this.count++; -@@ -72,7 +72,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { +@@ -71,7 +71,7 @@ public class CollectingNeighborUpdater implements NeighborUpdater { } } diff --git a/divinemc-server/minecraft-patches/features/0052-C2ME-Limit-NBT-cache.patch b/divinemc-server/minecraft-patches/features/0052-C2ME-Limit-NBT-cache.patch index c8de5e9..d4da369 100644 --- a/divinemc-server/minecraft-patches/features/0052-C2ME-Limit-NBT-cache.patch +++ b/divinemc-server/minecraft-patches/features/0052-C2ME-Limit-NBT-cache.patch @@ -10,10 +10,10 @@ As part of: C2ME (https://github.com/RelativityMC/C2ME-fabric) Licensed under: MIT (https://opensource.org/licenses/MIT) diff --git a/net/minecraft/world/level/chunk/storage/IOWorker.java b/net/minecraft/world/level/chunk/storage/IOWorker.java -index 27e1edbd8d8ffd80c1a3df17bc47f4a6936619f7..c3326e753ecf8a0ba1930d8c7573ebd2c594cf45 100644 +index b2b7c20a25bdefd42e8a36eb29935b8d5b24925d..d7ec29997bd03cf4807aab4961696cbba36d53a5 100644 --- a/net/minecraft/world/level/chunk/storage/IOWorker.java +++ b/net/minecraft/world/level/chunk/storage/IOWorker.java -@@ -212,7 +212,38 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { +@@ -213,7 +213,38 @@ public class IOWorker implements ChunkScanAccess, AutoCloseable { }); } diff --git a/divinemc-server/minecraft-patches/features/0053-C2ME-Optimize-Aquifer-and-Beardifier.patch b/divinemc-server/minecraft-patches/features/0053-C2ME-Optimize-Aquifer-and-Beardifier.patch index a1e60e5..ace25e3 100644 --- a/divinemc-server/minecraft-patches/features/0053-C2ME-Optimize-Aquifer-and-Beardifier.patch +++ b/divinemc-server/minecraft-patches/features/0053-C2ME-Optimize-Aquifer-and-Beardifier.patch @@ -11,10 +11,10 @@ As part of: C2ME (https://github.com/RelativityMC/C2ME-fabric) Licensed under: MIT (https://opensource.org/licenses/MIT) diff --git a/net/minecraft/world/level/levelgen/Aquifer.java b/net/minecraft/world/level/levelgen/Aquifer.java -index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fdc89d5293 100644 +index 2c9b447d8b0f8f817bfe5350678f97a36103ec02..28490fba2b0cd2d682fd085b105b247e3dd35ea1 100644 --- a/net/minecraft/world/level/levelgen/Aquifer.java +++ b/net/minecraft/world/level/levelgen/Aquifer.java -@@ -98,6 +98,13 @@ public interface Aquifer { +@@ -96,6 +96,13 @@ public interface Aquifer { private final int minGridZ; private final int gridSizeX; private final int gridSizeZ; @@ -28,7 +28,7 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd private static final int[][] SURFACE_SAMPLING_OFFSETS_IN_CHUNKS = new int[][]{ {0, 0}, {-2, -1}, {-1, -1}, {0, -1}, {1, -1}, {-3, 0}, {-2, 0}, {-1, 0}, {1, 0}, {-2, 1}, {-1, 1}, {0, 1}, {1, 1} }; -@@ -133,6 +140,41 @@ public interface Aquifer { +@@ -131,6 +138,41 @@ public interface Aquifer { this.aquiferCache = new Aquifer.FluidStatus[i4]; this.aquiferLocationCache = new long[i4]; Arrays.fill(this.aquiferLocationCache, Long.MAX_VALUE); @@ -70,7 +70,7 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd int i5 = this.adjustSurfaceLevel( noiseChunk.maxPreliminarySurfaceLevel(fromGridX(this.minGridX, 0), fromGridZ(this.minGridZ, 0), fromGridX(i, 9), fromGridZ(i3, 9)) ); -@@ -154,142 +196,23 @@ public interface Aquifer { +@@ -151,142 +193,23 @@ public interface Aquifer { this.shouldScheduleFluidUpdate = false; return null; } else { @@ -223,7 +223,7 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd } @Override -@@ -302,65 +225,28 @@ public interface Aquifer { +@@ -299,65 +222,28 @@ public interface Aquifer { return 1.0 - (secondDistance - firstDistance) / 25.0; } @@ -276,13 +276,13 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd - double d10x = 2.0; - double d12; - if (!(d11 < -2.0) && !(d11 > 2.0)) { -- double value = substance.getValue(); -- if (Double.isNaN(value)) { -- double d13 = this.barrierNoise.compute(context); -- substance.setValue(d13); -- d12 = d13; +- double d13 = substance.doubleValue(); +- if (Double.isNaN(d13)) { +- double d14 = this.barrierNoise.compute(context); +- substance.setValue(d14); +- d12 = d14; - } else { -- d12 = value; +- d12 = d13; - } - } else { - d12 = 0.0; @@ -299,7 +299,7 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd private static int gridX(int x) { return x >> 4; -@@ -441,22 +327,21 @@ public interface Aquifer { +@@ -438,22 +324,21 @@ public interface Aquifer { } private int computeSurfaceLevel(int x, int y, int z, Aquifer.FluidStatus fluidStatus, int maxSurfaceLevel, boolean fluidPresent) { @@ -330,7 +330,7 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd int i; if (d1 > 0.0) { -@@ -487,12 +372,12 @@ public interface Aquifer { +@@ -484,12 +369,12 @@ public interface Aquifer { private BlockState computeFluidType(int x, int y, int z, Aquifer.FluidStatus fluidStatus, int surfaceLevel) { BlockState blockState = fluidStatus.fluidType; if (surfaceLevel <= -10 && surfaceLevel != DimensionType.WAY_BELOW_MIN_Y && fluidStatus.fluidType != Blocks.LAVA.defaultBlockState()) { @@ -349,7 +349,7 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd if (Math.abs(d) > 0.3) { blockState = Blocks.LAVA.defaultBlockState(); } -@@ -500,5 +385,218 @@ public interface Aquifer { +@@ -497,5 +382,218 @@ public interface Aquifer { return blockState; } @@ -569,13 +569,13 @@ index d672f425368e4489b2477da7c049670e72b46306..c2c190a6d88691ae01613651c7dc21fd } } diff --git a/net/minecraft/world/level/levelgen/Beardifier.java b/net/minecraft/world/level/levelgen/Beardifier.java -index c9ddfc8670614c2d8629066b0cc805d18e4f662f..fc1f1fcac84197a2652dfd3869ef505f1a6140f1 100644 +index 3e8b852fe7630677f0497e36a176787a9400d5d6..9ef31dd54491509fa47a1c273c1552a4021fed64 100644 --- a/net/minecraft/world/level/levelgen/Beardifier.java +++ b/net/minecraft/world/level/levelgen/Beardifier.java -@@ -35,6 +35,15 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -34,6 +34,15 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { + private final List pieces; private final List junctions; - @Nullable - private final BoundingBox affectedBox; + private final @Nullable BoundingBox affectedBox; + // DivineMC start - C2ME: Optimize Beardifier + private Beardifier.Rigid[] c2me$pieceArray; + private JigsawJunction[] c2me$junctionArray; @@ -588,7 +588,7 @@ index c9ddfc8670614c2d8629066b0cc805d18e4f662f..fc1f1fcac84197a2652dfd3869ef505f public static Beardifier forStructuresInChunk(StructureManager structureManager, ChunkPos chunkPos) { List list = structureManager.startsForStructure(chunkPos, structure -> structure.terrainAdaptation() != TerrainAdjustment.NONE); -@@ -109,53 +118,54 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { +@@ -108,53 +117,54 @@ public class Beardifier implements DensityFunctions.BeardifierOrMarker { } } diff --git a/divinemc-server/minecraft-patches/features/0055-Crafter-1gt-delay.patch b/divinemc-server/minecraft-patches/features/0055-Crafter-1gt-delay.patch index 8c60a6a..b4aaf7c 100644 --- a/divinemc-server/minecraft-patches/features/0055-Crafter-1gt-delay.patch +++ b/divinemc-server/minecraft-patches/features/0055-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 a132883d85d515edb131049714915902444e4c3e..68e28ff810d6420dafc03cc43d7edbe5ee38d971 100644 +index c5fe15844d405a27cdae18c903dd481c25b437de..a42297906a632c937f3b8c98371304b98362f51f 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 { @@ -17,9 +17,9 @@ index a132883d85d515edb131049714915902444e4c3e..68e28ff810d6420dafc03cc43d7edbe5 level.setBlock(pos, state.setValue(TRIGGERED, true), Block.UPDATE_CLIENTS); this.setBlockEntityTriggered(blockEntity, true); } else if (!hasNeighborSignal && triggeredValue) { -@@ -125,7 +125,7 @@ public class CrafterBlock extends BaseEntityBlock { +@@ -124,7 +124,7 @@ public class CrafterBlock extends BaseEntityBlock { @Override - public void setPlacedBy(Level level, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { + public void setPlacedBy(Level level, BlockPos pos, BlockState state, @Nullable LivingEntity placer, ItemStack stack) { if (state.getValue(TRIGGERED)) { - level.scheduleTick(pos, this, 4); + level.scheduleTick(pos, this, !org.bxteam.divinemc.config.DivineConfig.MiscCategory.copperBulb1gt ? 4 : 1); // DivineMC - Crafter 1gt delay diff --git a/divinemc-server/minecraft-patches/features/0056-Raytrace-Entity-Tracker.patch b/divinemc-server/minecraft-patches/features/0056-Raytrace-Entity-Tracker.patch index 2ecfcaa..f0c67cb 100644 --- a/divinemc-server/minecraft-patches/features/0056-Raytrace-Entity-Tracker.patch +++ b/divinemc-server/minecraft-patches/features/0056-Raytrace-Entity-Tracker.patch @@ -10,19 +10,19 @@ Original project: https://github.com/LogisticsCraft/OcclusionCulling Original license: MIT diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 56483d9e770e29526a36d4c8c5565092acb227c7..9db43874a94770d49ea5ff48a46c4657e4819e98 100644 +index 65a72cedfd3f3da0323b553afe0e9a515d4f3986..5893372688c9355759602645577cdbab7e6e3716 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -147,7 +147,7 @@ import net.minecraft.world.waypoints.WaypointTransmitter; - import org.jetbrains.annotations.Contract; +@@ -150,7 +150,7 @@ import org.jetbrains.annotations.Contract; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; --public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker -+public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity, dev.tr7zw.entityculling.versionless.access.Cullable { // Paper - rewrite chunk system // Paper - optimise entity tracker // DivineMC - Raytrace Entity Tracker +-public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, SlotProvider, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity { // Paper - rewrite chunk system // Paper - optimise entity tracker ++public abstract class Entity implements SyncedDataHolder, DebugValueSource, Nameable, ItemOwner, SlotProvider, EntityAccess, ScoreHolder, DataComponentGetter, ca.spottedleaf.moonrise.patches.chunk_system.entity.ChunkSystemEntity, ca.spottedleaf.moonrise.patches.entity_tracker.EntityTrackerEntity, dev.tr7zw.entityculling.versionless.access.Cullable { // Paper - rewrite chunk system // Paper - optimise entity tracker // DivineMC - Raytrace Entity Tracker public static javax.script.ScriptEngine scriptEngine = new javax.script.ScriptEngineManager().getEngineByName("rhino"); // Purpur - Configurable entity base attributes // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -5531,4 +5531,47 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -5558,4 +5558,47 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name return false; } // Purpur end - Ridables @@ -71,10 +71,10 @@ index 56483d9e770e29526a36d4c8c5565092acb227c7..9db43874a94770d49ea5ff48a46c4657 + // DivineMC end - Raytrace Entity Tracker } diff --git a/net/minecraft/world/entity/EntityType.java b/net/minecraft/world/entity/EntityType.java -index d9d45a3e7436d5a211e3f2b6810f76e0a22766e8..4c6ca2979a370346008b981e045625668269e380 100644 +index 1ccab891e10f2a79435c12a9e58f5f3acc804323..e93610b35965b27d67aec10b011c7fa80bed2b06 100644 --- a/net/minecraft/world/entity/EntityType.java +++ b/net/minecraft/world/entity/EntityType.java -@@ -1202,6 +1202,7 @@ public class EntityType implements FeatureElement, EntityTypeT +@@ -1228,6 +1228,7 @@ public class EntityType implements FeatureElement, EntityTypeT private final float spawnDimensionsScale; private final FeatureFlagSet requiredFeatures; private final boolean allowedInPeaceful; @@ -83,10 +83,10 @@ index d9d45a3e7436d5a211e3f2b6810f76e0a22766e8..4c6ca2979a370346008b981e04562566 private static EntityType register(ResourceKey> key, EntityType.Builder builder) { return Registry.register(BuiltInRegistries.ENTITY_TYPE, key, builder.build(key)); diff --git a/net/minecraft/world/entity/player/Player.java b/net/minecraft/world/entity/player/Player.java -index 68942a2d15cfeddf1928a3ad270b1ce29685f8f0..149332116ff211c122b1dbf9b8010610174451db 100644 +index eb4ac239a90ccf8eb072fdbdd76202c4ac90f38a..5ef5f9eb3b0ceb66a9ad007b450b641ed403bf31 100644 --- a/net/minecraft/world/entity/player/Player.java +++ b/net/minecraft/world/entity/player/Player.java -@@ -184,6 +184,25 @@ public abstract class Player extends Avatar implements ContainerUser { +@@ -182,6 +182,25 @@ public abstract class Player extends Avatar implements ContainerUser { public int burpDelay = 0; // Purpur - Burp delay public boolean canPortalInstant = false; // Purpur - Add portal permission bypass public int sixRowEnderchestSlotCount = -1; // Purpur - Barrels and enderchests 6 rows @@ -112,7 +112,7 @@ index 68942a2d15cfeddf1928a3ad270b1ce29685f8f0..149332116ff211c122b1dbf9b8010610 // CraftBukkit start public boolean fauxSleeping; -@@ -270,6 +289,25 @@ public abstract class Player extends Avatar implements ContainerUser { +@@ -268,6 +287,25 @@ public abstract class Player extends Avatar implements ContainerUser { @Override public void tick() { @@ -138,7 +138,7 @@ index 68942a2d15cfeddf1928a3ad270b1ce29685f8f0..149332116ff211c122b1dbf9b8010610 // Purpur start - Burp delay if (this.burpDelay > 0 && --this.burpDelay == 0) { this.level().playSound(null, getX(), getY(), getZ(), SoundEvents.PLAYER_BURP, SoundSource.PLAYERS, 1.0F, this.level().random.nextFloat() * 0.1F + 0.9F); -@@ -1315,6 +1353,7 @@ public abstract class Player extends Avatar implements ContainerUser { +@@ -1393,6 +1431,7 @@ public abstract class Player extends Avatar implements ContainerUser { if (this.hasContainerOpen()) { this.doCloseContainer(); } diff --git a/divinemc-server/minecraft-patches/features/0057-Leaves-Protocol-Core.patch b/divinemc-server/minecraft-patches/features/0057-Leaves-Protocol-Core.patch index 97aac62..f587996 100644 --- a/divinemc-server/minecraft-patches/features/0057-Leaves-Protocol-Core.patch +++ b/divinemc-server/minecraft-patches/features/0057-Leaves-Protocol-Core.patch @@ -1,13 +1,13 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Thu, 10 Jul 2025 22:11:47 +0300 +Date: Thu, 11 Dec 2025 15:47:27 +0300 Subject: [PATCH] Leaves: Protocol Core Original project: https://github.com/LeavesMC/Leaves Original license: GPLv3 diff --git a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java -index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..c3be4c2fd4a544967322a45d3b8c0fe78a0684a5 100644 +index 1da034752064312962a4144f91be5265a9a08997..e583baf264e066238804a76e7ce7219a813096bb 100644 --- a/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java +++ b/net/minecraft/network/protocol/common/custom/CustomPacketPayload.java @@ -40,13 +40,22 @@ public interface CustomPacketPayload { @@ -25,30 +25,30 @@ index fb263fa1f30a7dfcb7ec2656abfb38e5fe88eac9..c3be4c2fd4a544967322a45d3b8c0fe7 @Override public CustomPacketPayload decode(B buffer) { - ResourceLocation resourceLocation = buffer.readResourceLocation(); -- return (CustomPacketPayload)this.findCodec(resourceLocation).decode(buffer); + Identifier identifier = buffer.readIdentifier(); +- return (CustomPacketPayload)this.findCodec(identifier).decode(buffer); + // DivineMC start - Leaves Protocol Core -+ var payload = org.leavesmc.leaves.protocol.core.LeavesProtocolManager.decode(resourceLocation, buffer); -+ return java.util.Objects.requireNonNullElseGet(payload, () -> this.findCodec(resourceLocation).decode(buffer)); ++ var payload = org.leavesmc.leaves.protocol.core.LeavesProtocolManager.decode(identifier, buffer); ++ return java.util.Objects.requireNonNullElseGet(payload, () -> this.findCodec(identifier).decode(buffer)); + // DivineMC end - Leaves Protocol Core } }; } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index dbb3a32da66472b3b075d155938e2b6fa4fb53f2..30f6b89227af4f78f447ae4c61fc33b4ac6202f2 100644 +index 9fdef6cda5eb9a160b4c1eff1934ccadb9f64e0c..2ce027c113c1b4b6ecfb84649e640e583c463626 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -1843,6 +1843,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> { +@@ -126,6 +126,7 @@ public class Connection extends SimpleChannelInboundHandler> { // Paper start - Optimize network public boolean isPending = true; public boolean queueImmunity; @@ -35,7 +35,7 @@ index e28d859b457ca0e24bc6dc9d6cd4a97f12ae0671..5b31eed8f91b45b46521da5169d8003d // Paper end - Optimize network public Connection(PacketFlow receiving) { -@@ -160,6 +161,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -136,6 +137,7 @@ public class Connection extends SimpleChannelInboundHandler> { public void channelActive(ChannelHandlerContext ctx) throws Exception { super.channelActive(ctx); this.channel = ctx.channel(); @@ -43,7 +43,7 @@ index e28d859b457ca0e24bc6dc9d6cd4a97f12ae0671..5b31eed8f91b45b46521da5169d8003d this.address = this.channel.remoteAddress(); this.preparing = false; // Spigot if (this.delayedDisconnect != null) { -@@ -472,7 +474,13 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -448,7 +450,13 @@ public class Connection extends SimpleChannelInboundHandler> { if (this.channel.eventLoop().inEventLoop()) { this.doSendPacket(packet, sendListener, flush); } else { diff --git a/divinemc-server/minecraft-patches/features/0059-Linear-region-file-format.patch b/divinemc-server/minecraft-patches/features/0059-Linear-region-file-format.patch index 2feac48..0a09a0f 100644 --- a/divinemc-server/minecraft-patches/features/0059-Linear-region-file-format.patch +++ b/divinemc-server/minecraft-patches/features/0059-Linear-region-file-format.patch @@ -60,10 +60,10 @@ index 51c126735ace8fdde89ad97b5cab62f244212db0..23f6ed26b531ea570fdf2ae48c1e2710 + public void moonrise$write(final org.bxteam.divinemc.region.IRegionFile regionFile) throws IOException; // DivineMC - Buffered Linear region format } diff --git a/net/minecraft/server/MinecraftServer.java b/net/minecraft/server/MinecraftServer.java -index 30f6b89227af4f78f447ae4c61fc33b4ac6202f2..fff6dac8b37a26dfacb1a0a40152518c5c227504 100644 +index 2ce027c113c1b4b6ecfb84649e640e583c463626..49acd83c18368271ce0de1cec28f5bc4f311a442 100644 --- a/net/minecraft/server/MinecraftServer.java +++ b/net/minecraft/server/MinecraftServer.java -@@ -959,10 +959,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> progressMap = Reference2FloatMaps.synchronize(new Reference2FloatOpenHashMap<>()); volatile Component status = Component.translatable("optimizeWorld.stage.counting"); @@ -89,7 +89,7 @@ index a55ae044386baa52f2c4388b4ae2f58a58469099..f6a1f524f03e8fb79c713baa94193b59 final DimensionDataStorage overworldDataStorage; public WorldUpgrader( -@@ -272,7 +272,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -270,7 +270,7 @@ public class WorldUpgrader implements AutoCloseable { } private static List getAllChunkPositions(RegionStorageInfo regionStorageInfo, Path path) { @@ -98,7 +98,7 @@ index a55ae044386baa52f2c4388b4ae2f58a58469099..f6a1f524f03e8fb79c713baa94193b59 if (files == null) { return List.of(); } else { -@@ -285,7 +285,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -283,7 +283,7 @@ public class WorldUpgrader implements AutoCloseable { int i1 = Integer.parseInt(matcher.group(2)) << 5; List list1 = Lists.newArrayList(); @@ -107,16 +107,16 @@ index a55ae044386baa52f2c4388b4ae2f58a58469099..f6a1f524f03e8fb79c713baa94193b59 for (int i2 = 0; i2 < 32; i2++) { for (int i3 = 0; i3 < 32; i3++) { ChunkPos chunkPos = new ChunkPos(i2 + i, i3 + i1); -@@ -333,7 +333,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -331,7 +331,7 @@ public class WorldUpgrader implements AutoCloseable { - protected abstract boolean tryProcessOnePosition(T chunkStorage, ChunkPos chunkPos, ResourceKey dimension); + protected abstract boolean tryProcessOnePosition(SimpleRegionStorage regionStorage, ChunkPos chunkPos, ResourceKey dimension); - private void onFileFinished(RegionFile regionFile) { + private void onFileFinished(org.bxteam.divinemc.region.IRegionFile regionFile) { // DivineMC - Buffered Linear region format if (WorldUpgrader.this.recreateRegionFiles) { if (this.previousWriteFuture != null) { this.previousWriteFuture.join(); -@@ -438,7 +438,7 @@ public class WorldUpgrader implements AutoCloseable { +@@ -441,7 +441,7 @@ public class WorldUpgrader implements AutoCloseable { } } @@ -126,11 +126,11 @@ index a55ae044386baa52f2c4388b4ae2f58a58469099..f6a1f524f03e8fb79c713baa94193b59 class PoiUpgrader extends WorldUpgrader.SimpleRegionStorageUpgrader { diff --git a/net/minecraft/world/level/chunk/storage/RegionFile.java b/net/minecraft/world/level/chunk/storage/RegionFile.java -index ae0a893498d0bfe90c14508f15b431d4885e06ff..00656cf8634e06f7ce1067ef7ba44edfb4519be3 100644 +index e4cbe8d6176c2174ed5fffb9ea28f69c12dc9f1e..70e9c7a649a7c5145ecdb679f5fe54f3d060b6bd 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/net/minecraft/world/level/chunk/storage/RegionFile.java -@@ -22,7 +22,7 @@ import net.minecraft.util.profiling.jfr.JvmProfiler; - import net.minecraft.world.level.ChunkPos; +@@ -22,7 +22,7 @@ import net.minecraft.world.level.ChunkPos; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; -public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile { // Paper - rewrite chunk system @@ -138,7 +138,7 @@ index ae0a893498d0bfe90c14508f15b431d4885e06ff..00656cf8634e06f7ce1067ef7ba44edf private static final Logger LOGGER = LogUtils.getLogger(); public static final int MAX_CHUNK_SIZE = 500 * 1024 * 1024; // Paper - don't write garbage data to disk if writing serialization fails private static final int SECTOR_BYTES = 4096; -@@ -912,7 +912,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche +@@ -909,7 +909,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche } @Override @@ -148,7 +148,7 @@ index ae0a893498d0bfe90c14508f15b431d4885e06ff..00656cf8634e06f7ce1067ef7ba44edf } // Paper end - rewrite chunk system diff --git a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..e92415ac17952831a14d048b12ee7b3e36c941d6 100644 +index dbea0449cebd448f5b165097aee8633e4d8bac67..d716b5edaf6e12210163ca90171dc64d5e4ee795 100644 --- a/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/net/minecraft/world/level/chunk/storage/RegionFileStorage.java @@ -19,7 +19,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @@ -300,16 +300,16 @@ index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..e92415ac17952831a14d048b12ee7b3e synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -347,7 +367,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise - @Nullable - public CompoundTag read(ChunkPos chunkPos) throws IOException { +@@ -346,7 +366,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + + public @Nullable CompoundTag read(ChunkPos chunkPos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing - RegionFile regionFile = this.getRegionFile(chunkPos, true); + org.bxteam.divinemc.region.IRegionFile regionFile = this.getRegionFile(chunkPos, true); // DivineMC - Buffered Linear region format if (regionFile == null) { return null; } -@@ -386,7 +406,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -385,7 +405,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void scanChunk(ChunkPos chunkPos, StreamTagVisitor visitor) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -318,7 +318,7 @@ index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..e92415ac17952831a14d048b12ee7b3e if (regionFile == null) { return; } -@@ -401,7 +421,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -400,7 +420,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void write(ChunkPos chunkPos, @Nullable CompoundTag chunkData) throws IOException { // Paper - rewrite chunk system - public if (!SharedConstants.DEBUG_DONT_SAVE_WORLD) { @@ -327,7 +327,7 @@ index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..e92415ac17952831a14d048b12ee7b3e // Paper start - rewrite chunk system if (regionFile == null) { // if the RegionFile doesn't exist, no point in deleting from it -@@ -432,7 +452,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -431,7 +451,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -336,7 +336,7 @@ index 8215edb0dbb5a9de66d5107786c338d2fd02d5ea..e92415ac17952831a14d048b12ee7b3e try { regionFile.close(); } catch (final IOException ex) { -@@ -448,7 +468,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -447,7 +467,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); diff --git a/divinemc-server/minecraft-patches/features/0060-Cleanup-dead-code-from-Paper.patch b/divinemc-server/minecraft-patches/features/0060-Cleanup-dead-code-from-Paper.patch index a31cd9c..f2ec4c6 100644 --- a/divinemc-server/minecraft-patches/features/0060-Cleanup-dead-code-from-Paper.patch +++ b/divinemc-server/minecraft-patches/features/0060-Cleanup-dead-code-from-Paper.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cleanup dead code from Paper diff --git a/net/minecraft/network/Connection.java b/net/minecraft/network/Connection.java -index 5b31eed8f91b45b46521da5169d8003dfd5ec669..bd0712025fd20fbbc24d86f29700f7a28ed81921 100644 +index 12f08893bddd1936403bf29323cb4d8c485bc7bd..73827925ce67343f21302c9c93644eb1a431412c 100644 --- a/net/minecraft/network/Connection.java +++ b/net/minecraft/network/Connection.java -@@ -608,13 +608,7 @@ public class Connection extends SimpleChannelInboundHandler> { +@@ -584,13 +584,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) { @@ -70,10 +70,10 @@ index 98b101fde04fbf5507f021bb8d8e6bed334de5b6..e76530da9641acc482aa0f030c4dc267 } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 8c98c2593eec14a8a378041e94cf52b8fbfedc30..4788686f0bd8ab67700bf3687560ff4a26a8e493 100644 +index eb2ed61faac0d4803298325dc5aeec3c6b0a1ad2..92521490b6ddc0ff4a102d870f5826f1b61ee68a 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -1415,13 +1415,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1453,13 +1453,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper end - log detailed entity tick information public void tickNonPassenger(Entity entity) { @@ -87,7 +87,7 @@ index 8c98c2593eec14a8a378041e94cf52b8fbfedc30..4788686f0bd8ab67700bf3687560ff4a entity.setOldPosAndRot(); entity.tickCount++; entity.totalEntityAge++; // Paper - age-like counter for all entities -@@ -1434,13 +1428,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1472,13 +1466,6 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (Entity entity1 : entity.getPassengers()) { this.tickPassenger(entity, entity1, isActive); // Paper - EAR 2 } @@ -102,10 +102,10 @@ index 8c98c2593eec14a8a378041e94cf52b8fbfedc30..4788686f0bd8ab67700bf3687560ff4a 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 9db43874a94770d49ea5ff48a46c4657e4819e98..013261aff0b9ecfeb51f3baf597d7ee211a8a095 100644 +index 5893372688c9355759602645577cdbab7e6e3716..e18f4d60e94054f7f7ebbd066ff3ae45ce441507 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -1116,29 +1116,10 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1131,29 +1131,10 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name return this.onGround; } @@ -135,7 +135,7 @@ index 9db43874a94770d49ea5ff48a46c4657e4819e98..013261aff0b9ecfeb51f3baf597d7ee2 if (this.noPhysics) { this.setPos(this.getX() + movement.x, this.getY() + movement.y, this.getZ() + movement.z); this.horizontalCollision = false; -@@ -1259,13 +1240,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -1274,13 +1255,6 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.setDeltaMovement(this.getDeltaMovement().multiply(blockSpeedFactor, 1.0, blockSpeedFactor)); } } @@ -149,17 +149,17 @@ index 9db43874a94770d49ea5ff48a46c4657e4819e98..013261aff0b9ecfeb51f3baf597d7ee2 } private void applyMovementEmissionAndPlaySound(Entity.MovementEmission movementEmission, Vec3 movement, BlockPos pos, BlockState state) { -@@ -4993,9 +4967,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name - } +@@ -5018,9 +4992,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name public void setDeltaMovement(Vec3 deltaMovement) { -- synchronized (this.posLock) { // Paper - detailed watchdog information - this.deltaMovement = deltaMovement; -- } // Paper - detailed watchdog information + if (deltaMovement.isFinite()) { +- synchronized (this.posLock) { // Paper - detailed watchdog information + this.deltaMovement = deltaMovement; +- } // Paper - detailed watchdog information + } } - public void addDeltaMovement(Vec3 addend) { -@@ -5093,9 +5065,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -5121,9 +5093,7 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name } // Paper end - Block invalid positions and bounding box if (this.position.x != x || this.position.y != y || this.position.z != z) { diff --git a/divinemc-server/minecraft-patches/features/0061-C2ME-The-End-Biome-Cache.patch b/divinemc-server/minecraft-patches/features/0061-C2ME-The-End-Biome-Cache.patch index da790b7..7d502f3 100644 --- a/divinemc-server/minecraft-patches/features/0061-C2ME-The-End-Biome-Cache.patch +++ b/divinemc-server/minecraft-patches/features/0061-C2ME-The-End-Biome-Cache.patch @@ -1,6 +1,6 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: NONPLAYT <76615486+NONPLAYT@users.noreply.github.com> -Date: Thu, 17 Jul 2025 20:53:13 +0300 +Date: Thu, 11 Dec 2025 15:58:04 +0300 Subject: [PATCH] C2ME: The End Biome Cache This patch is based on the following mixins: diff --git a/divinemc-server/minecraft-patches/features/0063-Do-not-send-spectator-change-packet.patch b/divinemc-server/minecraft-patches/features/0063-Do-not-send-spectator-change-packet.patch index 2683617..d07aff5 100644 --- a/divinemc-server/minecraft-patches/features/0063-Do-not-send-spectator-change-packet.patch +++ b/divinemc-server/minecraft-patches/features/0063-Do-not-send-spectator-change-packet.patch @@ -5,10 +5,10 @@ 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 9bbcffc77dcf0e062a7f3464aee7f8d0563a440f..4b0afe40a06c76b4378f7a5979d6217c4b947770 100644 +index df6ebb53ec75f4a66e397100f4ef85978a1db3c5..e80380d9de4fc6e2123ce582ad26bbfffb0ca55b 100644 --- a/net/minecraft/server/level/ServerPlayerGameMode.java +++ b/net/minecraft/server/level/ServerPlayerGameMode.java -@@ -86,10 +86,7 @@ public class ServerPlayerGameMode { +@@ -84,10 +84,7 @@ public class ServerPlayerGameMode { } this.player.onUpdateAbilities(); @@ -20,7 +20,7 @@ index 9bbcffc77dcf0e062a7f3464aee7f8d0563a440f..4b0afe40a06c76b4378f7a5979d6217c this.level.updateSleepingPlayerList(); if (gameModeForPlayer == GameType.CREATIVE) { this.player.resetCurrentImpulseContext(); -@@ -595,4 +592,17 @@ public class ServerPlayerGameMode { +@@ -592,4 +589,17 @@ public class ServerPlayerGameMode { return false; } // Purpur end - Shift right click to use exp for mending @@ -39,10 +39,10 @@ index 9bbcffc77dcf0e062a7f3464aee7f8d0563a440f..4b0afe40a06c76b4378f7a5979d6217c + // 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 bf26f788b3c77ef344f072e399cada116b95e757..551ba3a85f9bd3861512585939ab898d20e733a8 100644 +index d5b649811508b113326f459251522a962148fe9b..27ec5a0ed3211b6df2feb8fdc69d7a1f43fe2fa8 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -259,6 +259,7 @@ public abstract class PlayerList { +@@ -264,6 +264,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 @@ -50,7 +50,7 @@ index bf26f788b3c77ef344f072e399cada116b95e757..551ba3a85f9bd3861512585939ab898d 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) { -@@ -268,7 +269,7 @@ public abstract class PlayerList { +@@ -273,7 +274,7 @@ public abstract class PlayerList { // Paper start - Add Listing API for Player if (entityplayer1.getBukkitEntity().isListed(bukkitPlayer)) { // Paper end - Add Listing API for Player @@ -59,7 +59,7 @@ index bf26f788b3c77ef344f072e399cada116b95e757..551ba3a85f9bd3861512585939ab898d // Paper start - Add Listing API for Player } else { entityplayer1.connection.send(ClientboundPlayerInfoUpdatePacket.createSinglePlayerInitializing(player, false)); -@@ -284,7 +285,10 @@ public abstract class PlayerList { +@@ -289,7 +290,10 @@ public abstract class PlayerList { } // Paper start - Use single player info update packet on join if (!onlinePlayers.isEmpty()) { @@ -71,7 +71,7 @@ index bf26f788b3c77ef344f072e399cada116b95e757..551ba3a85f9bd3861512585939ab898d } // Paper end - Use single player info update packet on join player.sentListPacket = true; -@@ -1338,4 +1342,69 @@ public abstract class PlayerList { +@@ -1345,4 +1349,69 @@ public abstract class PlayerList { public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; } diff --git a/divinemc-server/minecraft-patches/features/0064-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch b/divinemc-server/minecraft-patches/features/0064-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch index 6039632..5200b33 100644 --- a/divinemc-server/minecraft-patches/features/0064-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch +++ b/divinemc-server/minecraft-patches/features/0064-Paper-PR-Fire-ServerListPingEvent-for-secondary-motd.patch @@ -8,10 +8,10 @@ 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 551ba3a85f9bd3861512585939ab898d20e733a8..eb3f3a2d70de239b8324b35529987daf70202042 100644 +index 27ec5a0ed3211b6df2feb8fdc69d7a1f43fe2fa8..e6e3491ec1aebf95d681fbd05e312cbcf968423e 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -210,10 +210,15 @@ public abstract class PlayerList { +@@ -215,10 +215,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()); diff --git a/divinemc-server/minecraft-patches/features/0065-Configurable-player-spawn-tracking-range.patch b/divinemc-server/minecraft-patches/features/0065-Configurable-player-spawn-tracking-range.patch index 8b097e8..faad1a8 100644 --- a/divinemc-server/minecraft-patches/features/0065-Configurable-player-spawn-tracking-range.patch +++ b/divinemc-server/minecraft-patches/features/0065-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 d22088a2648f1394206131302d10708c9d3484db..2f830a9418d4248e2d8bf1bae756e86a3a0b4aaa 100644 +index 34f45b931a86987412c6c23b3dcdaf5c916b87b1..b9eea26bb7e838a3b158b136d9e42f8ee93ddd8b 100644 --- a/net/minecraft/server/level/ChunkMap.java +++ b/net/minecraft/server/level/ChunkMap.java -@@ -834,10 +834,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -860,10 +860,10 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP final ServerPlayer[] raw = players.getRawDataUnchecked(); final int len = players.size(); @@ -35,7 +35,7 @@ index d22088a2648f1394206131302d10708c9d3484db..2f830a9418d4248e2d8bf1bae756e86a if (ret == null) { ret = new ArrayList<>(len - i); ret.add(player); -@@ -1261,6 +1261,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1294,6 +1294,7 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP for (int i = 0; i < playersLength; ++i) { // DivineMC - Multithreaded tracker final ServerPlayer player = playersRaw[i]; diff --git a/divinemc-server/minecraft-patches/features/0066-Optimize-collections.patch b/divinemc-server/minecraft-patches/features/0066-Optimize-collections.patch index 3a4386c..28c8f14 100644 --- a/divinemc-server/minecraft-patches/features/0066-Optimize-collections.patch +++ b/divinemc-server/minecraft-patches/features/0066-Optimize-collections.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize collections diff --git a/net/minecraft/core/NonNullList.java b/net/minecraft/core/NonNullList.java -index feefe51469843707afb2ecd4aaa3c9da2e089eb5..c7e418e5f7ca7f177df4e9432a0963f89b972a61 100644 +index b8cca20523ac848d32f76a490db36f9d6fe36e07..9f07a4f1c036c7578818067870ccee7057fbd179 100644 --- a/net/minecraft/core/NonNullList.java +++ b/net/minecraft/core/NonNullList.java -@@ -14,23 +14,23 @@ public class NonNullList extends AbstractList { - private final E defaultValue; +@@ -12,23 +12,23 @@ public class NonNullList extends AbstractList { + private final @Nullable E defaultValue; public static NonNullList create() { - return new NonNullList<>(Lists.newArrayList(), null); @@ -37,10 +37,10 @@ index feefe51469843707afb2ecd4aaa3c9da2e089eb5..c7e418e5f7ca7f177df4e9432a0963f8 protected NonNullList(List list, @Nullable E defaultValue) { diff --git a/net/minecraft/server/level/ChunkMap.java b/net/minecraft/server/level/ChunkMap.java -index 71fafa5cf67cd1e460b0be14ecfe0c922b666704..993c03f1957b6905ed943ff34ec9c530fdf69928 100644 +index b9eea26bb7e838a3b158b136d9e42f8ee93ddd8b..7721cad8962eb3f5d5f45ece9199c0d419bced2d 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 +@@ -137,8 +137,10 @@ public class ChunkMap extends SimpleRegionStorage implements ChunkHolder.PlayerP public final ChunkMap.DistanceManager distanceManager; private final String storageName; private final PlayerMap playerMap = new PlayerMap(); @@ -54,7 +54,7 @@ index 71fafa5cf67cd1e460b0be14ecfe0c922b666704..993c03f1957b6905ed943ff34ec9c530 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 738cbde3595165e0f05c0a6fde21499e98dc850b..4ec89234607f58ee32d0ea2ef056c8098e137041 100644 +index 2c6f6f3bf53529673415987904465a2362aad96e..01e844df3ed46ef5ae34ae56845ae3d011567157 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java @@ -260,7 +260,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl @@ -76,15 +76,15 @@ index 738cbde3595165e0f05c0a6fde21499e98dc850b..4ec89234607f58ee32d0ea2ef056c809 ((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 456d301d45350fb15de5ab663c482257e607f3aa..6fe4dd49256325908e49c02728a5b51964a96c12 100644 +index fd923d89d4456f0b13d97ef6fa90815a27e2e734..1201358ae5f75b61286e520001e7e5f7dbf2c7a1 100644 --- a/net/minecraft/world/level/chunk/ProtoChunk.java +++ b/net/minecraft/world/level/chunk/ProtoChunk.java -@@ -45,7 +45,7 @@ public class ProtoChunk extends ChunkAccess { - @Nullable - private volatile LevelLightEngine lightEngine; +@@ -44,7 +44,7 @@ public class ProtoChunk extends ChunkAccess { + private static final Logger LOGGER = LogUtils.getLogger(); + private volatile @Nullable LevelLightEngine lightEngine; private volatile ChunkStatus status = ChunkStatus.EMPTY; - private final List entities = Lists.newArrayList(); + private final List entities = Collections.synchronizedList(Lists.newArrayList()); // DivineMC - Optimize collections - @Nullable - private CarvingMask carvingMask; - @Nullable + private @Nullable CarvingMask carvingMask; + private @Nullable BelowZeroRetrogen belowZeroRetrogen; + private final ProtoChunkTicks blockTicks; diff --git a/divinemc-server/minecraft-patches/features/0067-Optimize-level-ticking.patch b/divinemc-server/minecraft-patches/features/0067-Optimize-level-ticking.patch index d9abfcd..12e51da 100644 --- a/divinemc-server/minecraft-patches/features/0067-Optimize-level-ticking.patch +++ b/divinemc-server/minecraft-patches/features/0067-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 c1c16b9b8dfef9c861d5f6456bf3b3d912128e9c..449a758cfd90b843ed719631b28c23c875a01aa0 100644 +index 92521490b6ddc0ff4a102d870f5826f1b61ee68a..c2c9cfd6dc953b6e50efd25f8bce5ace4b7d7f2e 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -974,9 +974,10 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -994,9 +994,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 c1c16b9b8dfef9c861d5f6456bf3b3d912128e9c..449a758cfd90b843ed719631b28c23c8 final ca.spottedleaf.moonrise.common.util.SimpleThreadUnsafeRandom simpleRandom = this.simpleRandom; final boolean doubleTickFluids = !ca.spottedleaf.moonrise.common.PlatformHooks.get().configFixMC224294(); -@@ -985,42 +986,38 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -1005,42 +1006,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 c1c16b9b8dfef9c861d5f6456bf3b3d912128e9c..449a758cfd90b843ed719631b28c23c8 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 40500e24156049e09a9970b120556f8aa49ffcaf..61016eaa5d1928cf72c013e8de5104ed1752ed3f 100644 +index 482029bc19a3a05aff8924257128ee9c9b5ca7a1..7f4bb62f0ea49ba28d11b6620c79000f65d1f5cb 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -82,7 +82,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -83,7 +83,7 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot return ""; } }; @@ -84,28 +84,27 @@ index 40500e24156049e09a9970b120556f8aa49ffcaf..61016eaa5d1928cf72c013e8de5104ed + private final Map tickersInLevel = new it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap<>(); // DivineMC - Optimize level ticking public boolean loaded; public final ServerLevel level; // CraftBukkit - type - @Nullable + private @Nullable Supplier fullStatus; diff --git a/net/minecraft/world/ticks/LevelChunkTicks.java b/net/minecraft/world/ticks/LevelChunkTicks.java -index 2e28cc201e4557ff603aba7a6ed997b8d36fbb4a..37d9459a905ef8e05400d821db24f61a2dd03f10 100644 +index 0b13971259f58876b778c0d28ad20c3510ed46ad..93b709d20ea26bca730c78a814f0ddfe0f4925db 100644 --- a/net/minecraft/world/ticks/LevelChunkTicks.java +++ b/net/minecraft/world/ticks/LevelChunkTicks.java -@@ -14,10 +14,10 @@ import javax.annotation.Nullable; - import net.minecraft.core.BlockPos; +@@ -14,9 +14,9 @@ import net.minecraft.core.BlockPos; + import org.jspecify.annotations.Nullable; public class LevelChunkTicks implements SerializableTickContainer, TickContainerAccess, ca.spottedleaf.moonrise.patches.chunk_system.ticks.ChunkSystemLevelChunkTicks { // Paper - rewrite chunk system - private final Queue> tickQueue = new PriorityQueue<>(ScheduledTick.DRAIN_ORDER); + private final Queue> tickQueue = new java.util.concurrent.PriorityBlockingQueue<>(11, ScheduledTick.DRAIN_ORDER); // DivineMC - Optimize level ticking - @Nullable - private List> pendingTicks; + private @Nullable List> pendingTicks; - private final Set> ticksPerPosition = new ObjectOpenCustomHashSet<>(ScheduledTick.UNIQUE_TICK_HASH); + private final Set> ticksPerPosition = it.unimi.dsi.fastutil.objects.ObjectSets.synchronize(new ObjectOpenCustomHashSet<>(ScheduledTick.UNIQUE_TICK_HASH)); // DivineMC - Optimize level ticking - @Nullable - private BiConsumer, ScheduledTick> onTickAdded; + private @Nullable BiConsumer, ScheduledTick> onTickAdded; -@@ -67,10 +67,18 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon + // Paper start - rewrite chunk system +@@ -63,10 +63,18 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon + } - @Nullable - public ScheduledTick poll() { + public @Nullable ScheduledTick poll() { - ScheduledTick scheduledTick = this.tickQueue.poll(); - if (scheduledTick != null) { - this.ticksPerPosition.remove(scheduledTick); this.dirty = true; // Paper - rewrite chunk system @@ -124,7 +123,7 @@ index 2e28cc201e4557ff603aba7a6ed997b8d36fbb4a..37d9459a905ef8e05400d821db24f61a return scheduledTick; } -@@ -83,6 +91,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -79,6 +87,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } private void scheduleUnchecked(ScheduledTick tick) { @@ -132,7 +131,7 @@ index 2e28cc201e4557ff603aba7a6ed997b8d36fbb4a..37d9459a905ef8e05400d821db24f61a this.tickQueue.add(tick); if (this.onTickAdded != null) { this.onTickAdded.accept(this, tick); -@@ -124,6 +133,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon +@@ -120,6 +129,7 @@ public class LevelChunkTicks implements SerializableTickContainer, TickCon } for (ScheduledTick scheduledTick : this.tickQueue) { @@ -141,7 +140,7 @@ index 2e28cc201e4557ff603aba7a6ed997b8d36fbb4a..37d9459a905ef8e05400d821db24f61a } diff --git a/net/minecraft/world/ticks/LevelTicks.java b/net/minecraft/world/ticks/LevelTicks.java -index c7f9485191dc797de78e6524c5c2c737581ed838..14f2d0088cd9e6d4a2eb084439bab18bd365c41f 100644 +index a1e2b0c4dca30b32e5bae6f99d38084128127325..dbea4faabebf4c71692c654cd9fb07bda2f31e95 100644 --- a/net/minecraft/world/ticks/LevelTicks.java +++ b/net/minecraft/world/ticks/LevelTicks.java @@ -30,17 +30,20 @@ public class LevelTicks implements LevelTickAccess { diff --git a/divinemc-server/minecraft-patches/features/0068-Optimize-Moonrise.patch b/divinemc-server/minecraft-patches/features/0068-Optimize-Moonrise.patch index b42eae4..3f8ef09 100644 --- a/divinemc-server/minecraft-patches/features/0068-Optimize-Moonrise.patch +++ b/divinemc-server/minecraft-patches/features/0068-Optimize-Moonrise.patch @@ -418,10 +418,10 @@ index 5c7b3804cdbcb0a873a0d195325c2658760a8914..4bb64bc5a31951a83d29d0c88919b1fa return false; } diff --git a/net/minecraft/server/level/DistanceManager.java b/net/minecraft/server/level/DistanceManager.java -index d03d075d5c56b7d2beb5f0aafecbb69f5b3bbf5b..ce3b8f4161dde3e2758c5d33445da15027fb0f33 100644 +index 8a5c37cf572abc6b9526648d3c8ec92b7af37e3d..0d0194fa48257168bdc23c50ea6b933204a0bce8 100644 --- a/net/minecraft/server/level/DistanceManager.java +++ b/net/minecraft/server/level/DistanceManager.java -@@ -128,15 +128,13 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches +@@ -126,15 +126,13 @@ public abstract class DistanceManager implements ca.spottedleaf.moonrise.patches public boolean inEntityTickingRange(long chunkPos) { // Paper start - rewrite chunk system @@ -440,10 +440,10 @@ index d03d075d5c56b7d2beb5f0aafecbb69f5b3bbf5b..ce3b8f4161dde3e2758c5d33445da150 } diff --git a/net/minecraft/server/level/ServerChunkCache.java b/net/minecraft/server/level/ServerChunkCache.java -index 66072f0851be5ca75f9fbef88297625272e7a597..629d6badbb53264b868580ac0d2b4cb82eb619e8 100644 +index 27b3d6109a4b1b82dd54aaf475a01a4250ed10f2..5237c69e2cfe02434c9973c557e1e3a5cc698276 100644 --- a/net/minecraft/server/level/ServerChunkCache.java +++ b/net/minecraft/server/level/ServerChunkCache.java -@@ -451,8 +451,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -445,8 +445,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon public boolean isPositionTicking(long chunkPos) { // Paper start - rewrite chunk system @@ -454,18 +454,18 @@ index 66072f0851be5ca75f9fbef88297625272e7a597..629d6badbb53264b868580ac0d2b4cb8 } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index 1ef8ac5985b9e3dd92e4741b1ee5eb2ab5c8b3fd..8415cde54fc30216f95ffe5bbf7eb9d5af2a22c8 100644 +index c2c9cfd6dc953b6e50efd25f8bce5ace4b7d7f2e..0e2d44f00e22654fef4b769b72af0f8e6c50ef05 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -186,6 +186,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -192,6 +192,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public final ServerChunkCache chunkSource; private final MinecraftServer server; public final net.minecraft.world.level.storage.PrimaryLevelData serverLevelData; // CraftBukkit - type + public final ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager.LevelHolderData chunkHolderData; // DivineMC - Optimize Moonrise final EntityTickList entityTickList = new EntityTickList(this); // DivineMC - Parallel world ticking private final ServerWaypointManager waypointManager; - // Paper - rewrite chunk system -@@ -733,6 +734,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe + private final EnvironmentAttributeSystem environmentAttributes; +@@ -743,6 +744,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper start - rewrite chunk system this.moonrise$setEntityLookup(new ca.spottedleaf.moonrise.patches.chunk_system.level.entity.server.ServerEntityLookup((ServerLevel)(Object)this, ((ServerLevel)(Object)this).new EntityCallbacks())); this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this); @@ -473,7 +473,7 @@ index 1ef8ac5985b9e3dd92e4741b1ee5eb2ab5c8b3fd..8415cde54fc30216f95ffe5bbf7eb9d5 this.entityDataController = new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController( new ca.spottedleaf.moonrise.patches.chunk_system.io.datacontroller.EntityDataController.EntityRegionFileStorage( new RegionStorageInfo(levelStorageAccess.getLevelId(), dimension, "entities"), -@@ -912,8 +914,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -928,8 +930,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe @Override public boolean shouldTickBlocksAt(long chunkPos) { // Paper start - rewrite chunk system @@ -483,7 +483,7 @@ index 1ef8ac5985b9e3dd92e4741b1ee5eb2ab5c8b3fd..8415cde54fc30216f95ffe5bbf7eb9d5 // Paper end - rewrite chunk system } -@@ -2668,16 +2669,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2699,16 +2700,13 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe public boolean isPositionTickingWithEntitiesLoaded(long chunkPos) { // Paper start - rewrite chunk system diff --git a/divinemc-server/minecraft-patches/features/0069-lithium-combined_heightmap_update.patch b/divinemc-server/minecraft-patches/features/0069-lithium-combined_heightmap_update.patch index b601ad3..7dcd4f8 100644 --- a/divinemc-server/minecraft-patches/features/0069-lithium-combined_heightmap_update.patch +++ b/divinemc-server/minecraft-patches/features/0069-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 61016eaa5d1928cf72c013e8de5104ed1752ed3f..5470b02a382a2c8a855a0f6b696c72f9b5b0c0b4 100644 +index 7f4bb62f0ea49ba28d11b6620c79000f65d1f5cb..4c9e76a6eaf4349c27dcc9cc425c6b586595a48e 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -387,10 +387,13 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -385,10 +385,13 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot return null; } else { Block block = state.getBlock(); diff --git a/divinemc-server/minecraft-patches/features/0071-lithium-sleeping_block_entity.patch b/divinemc-server/minecraft-patches/features/0071-lithium-sleeping_block_entity.patch index 35ca525..49e54cd 100644 --- a/divinemc-server/minecraft-patches/features/0071-lithium-sleeping_block_entity.patch +++ b/divinemc-server/minecraft-patches/features/0071-lithium-sleeping_block_entity.patch @@ -15,19 +15,19 @@ 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/component/PatchedDataComponentMap.java b/net/minecraft/core/component/PatchedDataComponentMap.java -index 766b6080160d87742ef4d8caa73b3b8fa52d5589..541d22fdc559717c7fda692c23abae581ee05a7f 100644 +index 4276819c6143b41886e26d359a562beb3b277afc..8e2bd11496ca71f87d4dc27d1651824022151891 100644 --- a/net/minecraft/core/component/PatchedDataComponentMap.java +++ b/net/minecraft/core/component/PatchedDataComponentMap.java @@ -14,7 +14,7 @@ import java.util.Map.Entry; import java.util.stream.Collectors; - import javax.annotation.Nullable; + import org.jspecify.annotations.Nullable; -public final class PatchedDataComponentMap implements DataComponentMap { +public final class PatchedDataComponentMap implements DataComponentMap, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangePublisher { // DivineMC - lithium: sleeping_block_entity private final DataComponentMap prototype; private Reference2ObjectMap, Optional> patch; private boolean copyOnWrite; -@@ -140,6 +140,7 @@ public final class PatchedDataComponentMap implements DataComponentMap { +@@ -136,6 +136,7 @@ public final class PatchedDataComponentMap implements DataComponentMap { } private void ensureMapOwnership() { @@ -35,7 +35,7 @@ index 766b6080160d87742ef4d8caa73b3b8fa52d5589..541d22fdc559717c7fda692c23abae58 if (this.copyOnWrite) { this.patch = new Reference2ObjectArrayMap<>(this.patch); this.copyOnWrite = false; -@@ -243,4 +244,22 @@ public final class PatchedDataComponentMap implements DataComponentMap { +@@ -239,4 +240,22 @@ public final class PatchedDataComponentMap implements DataComponentMap { public String toString() { return "{" + this.stream().map(TypedDataComponent::toString).collect(Collectors.joining(", ")) + "}"; } @@ -59,7 +59,7 @@ index 766b6080160d87742ef4d8caa73b3b8fa52d5589..541d22fdc559717c7fda692c23abae58 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/server/commands/data/EntityDataAccessor.java b/net/minecraft/server/commands/data/EntityDataAccessor.java -index 2b8d394dc30d459127289a1afeee0780003f4c79..2fd2712550a9b8ac79974f113ebcea5dab392bc5 100644 +index 6f01763c178324dd1741b996cd21cb9c23795b71..49c13be0c199f7544bb99e94f8c96d9e1464bcdc 100644 --- a/net/minecraft/server/commands/data/EntityDataAccessor.java +++ b/net/minecraft/server/commands/data/EntityDataAccessor.java @@ -55,6 +55,7 @@ public class EntityDataAccessor implements DataAccessor { @@ -71,10 +71,10 @@ index 2b8d394dc30d459127289a1afeee0780003f4c79..2fd2712550a9b8ac79974f113ebcea5d } } diff --git a/net/minecraft/server/level/ServerLevel.java b/net/minecraft/server/level/ServerLevel.java -index f166cf47d32ba4743fae5a7a76086334daa740cd..27990abd9c9f9e696988509fffca9bf2077cd520 100644 +index 0e2d44f00e22654fef4b769b72af0f8e6c50ef05..7887d1ff19a7525873ad6dab8a1fa34d28010275 100644 --- a/net/minecraft/server/level/ServerLevel.java +++ b/net/minecraft/server/level/ServerLevel.java -@@ -2520,6 +2520,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe +@@ -2550,6 +2550,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe for (TickingBlockEntity tickingBlockEntity : this.blockEntityTickers) { BlockPos pos = tickingBlockEntity.getPos(); @@ -83,23 +83,23 @@ index f166cf47d32ba4743fae5a7a76086334daa740cd..27990abd9c9f9e696988509fffca9bf2 } } diff --git a/net/minecraft/world/Container.java b/net/minecraft/world/Container.java -index 8e6f097b4d17aaaf8eccc16e11ce2bd01ad63322..ded99b157865f5bcfd64b3082c628a71d3747507 100644 +index 6489b47810b0431c350098d574469bbe0adcd726..9e67466397fe5cd903154e89e00e9a8a90385918 100644 --- a/net/minecraft/world/Container.java +++ b/net/minecraft/world/Container.java -@@ -13,7 +13,7 @@ import net.minecraft.world.item.ItemStack; - import net.minecraft.world.level.Level; +@@ -16,7 +16,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.block.entity.BlockEntity; + import org.jspecify.annotations.Nullable; --public interface Container extends Clearable, Iterable { -+public interface Container extends Clearable, Iterable, net.caffeinemc.mods.lithium.api.inventory.LithiumCooldownReceivingInventory, net.caffeinemc.mods.lithium.api.inventory.LithiumTransferConditionInventory { // DivineMC - lithium: sleeping_block_entity +-public interface Container extends Clearable, SlotProvider, Iterable { ++public interface Container extends Clearable, SlotProvider, Iterable, net.caffeinemc.mods.lithium.api.inventory.LithiumCooldownReceivingInventory, net.caffeinemc.mods.lithium.api.inventory.LithiumTransferConditionInventory { // DivineMC - lithium: sleeping_block_entity float DEFAULT_DISTANCE_BUFFER = 4.0F; int getContainerSize(); diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index 013261aff0b9ecfeb51f3baf597d7ee211a8a095..ef9c0258d3f9371ddfc9931dce2c2584139e6752 100644 +index e18f4d60e94054f7f7ebbd066ff3ae45ce441507..9f463bfa228d791eede8d1131749dd08aebe786a 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java -@@ -5099,6 +5099,18 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name +@@ -5127,6 +5127,18 @@ public abstract class Entity implements SyncedDataHolder, DebugValueSource, Name this.setBoundingBox(this.makeBoundingBox()); } // Paper end - Block invalid positions and bounding box @@ -119,19 +119,19 @@ index 013261aff0b9ecfeb51f3baf597d7ee211a8a095..ef9c0258d3f9371ddfc9931dce2c2584 public void checkDespawn() { diff --git a/net/minecraft/world/entity/item/ItemEntity.java b/net/minecraft/world/entity/item/ItemEntity.java -index 7525184fd5a801e39fbcba2afbcc968862a1cfbb..c074cd9b83015970028ac19c7afafb94d95713c9 100644 +index 4a6cda5dd6cdcd0fc7503eba6e74442637441268..8977023af55ab672742dcb7e4462907b4201d67c 100644 --- a/net/minecraft/world/entity/item/ItemEntity.java +++ b/net/minecraft/world/entity/item/ItemEntity.java -@@ -35,7 +35,7 @@ import net.minecraft.world.level.storage.ValueInput; - import net.minecraft.world.level.storage.ValueOutput; +@@ -35,7 +35,7 @@ import net.minecraft.world.level.storage.ValueOutput; import net.minecraft.world.phys.Vec3; + import org.jspecify.annotations.Nullable; -public class ItemEntity extends Entity implements TraceableEntity { +public class ItemEntity extends Entity implements TraceableEntity, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangePublisher, net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.CountChangeSubscriber { // DivineMC - lithium: sleeping_block_entity private static final EntityDataAccessor DATA_ITEM = SynchedEntityData.defineId(ItemEntity.class, EntityDataSerializers.ITEM_STACK); private static final float FLOAT_HEIGHT = 0.1F; public static final float EYE_HEIGHT = 0.2125F; -@@ -542,6 +542,25 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -538,6 +538,25 @@ public class ItemEntity extends Entity implements TraceableEntity { } public void setItem(ItemStack stack) { @@ -157,8 +157,8 @@ index 7525184fd5a801e39fbcba2afbcc968862a1cfbb..c074cd9b83015970028ac19c7afafb94 this.getEntityData().set(DATA_ITEM, stack); this.despawnRate = this.level().paperConfig().entities.spawning.altItemDespawnRate.enabled ? this.level().paperConfig().entities.spawning.altItemDespawnRate.items.getOrDefault(stack.getItem(), this.level().spigotConfig.itemDespawnRate) : this.level().spigotConfig.itemDespawnRate; // Paper - Alternative item-despawn-rate // Purpur start - Item entity immunities -@@ -623,4 +642,75 @@ public class ItemEntity extends Entity implements TraceableEntity { - public SlotAccess getSlot(int slot) { +@@ -619,4 +638,75 @@ public class ItemEntity extends Entity implements TraceableEntity { + public @Nullable SlotAccess getSlot(int slot) { return slot == 0 ? SlotAccess.of(this::getItem, this::setItem) : super.getSlot(slot); } + @@ -233,20 +233,20 @@ index 7525184fd5a801e39fbcba2afbcc968862a1cfbb..c074cd9b83015970028ac19c7afafb94 + } + // DivineMC end - lithium: sleeping_block_entity } -diff --git a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -index 0f9bfcd1eab023c1772e9fafcda85d110904bd1c..a54dbf14af2abcf0307c1c43fb82cfd6ab13bfd1 100644 ---- a/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -+++ b/net/minecraft/world/entity/vehicle/AbstractMinecartContainer.java -@@ -21,7 +21,7 @@ import net.minecraft.world.level.storage.ValueOutput; - import net.minecraft.world.level.storage.loot.LootTable; +diff --git a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java +index 79541b56a07d10de450f63945d0849a7f320da6c..bc09bd428ed2dc8c2b6e42cab2192f48e4e8e8df 100644 +--- a/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java ++++ b/net/minecraft/world/entity/vehicle/minecart/AbstractMinecartContainer.java +@@ -22,7 +22,7 @@ import net.minecraft.world.level.storage.loot.LootTable; import net.minecraft.world.phys.Vec3; + import org.jspecify.annotations.Nullable; -public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity { +public abstract class AbstractMinecartContainer extends AbstractMinecart implements ContainerEntity, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory { // DivineMC - lithium: sleeping_block_entity private NonNullList itemStacks = NonNullList.withSize(this.getContainerSize(), ItemStack.EMPTY); // CraftBukkit - SPIGOT-3513 - @Nullable - public ResourceKey lootTable; -@@ -218,4 +218,16 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme + public @Nullable ResourceKey lootTable; + public long lootTableSeed; +@@ -216,4 +216,16 @@ public abstract class AbstractMinecartContainer extends AbstractMinecart impleme return this.getBukkitEntity().getLocation(); } // CraftBukkit end @@ -264,10 +264,10 @@ index 0f9bfcd1eab023c1772e9fafcda85d110904bd1c..a54dbf14af2abcf0307c1c43fb82cfd6 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java -index c3021c0a8c588acf5ae8c9231e75bda984863267..0f3f9efdce86c3fb50247245eb5a3e1c1a14a794 100644 +index c794021c49b67463326d3c0335e623350ca27b27..f01ad6faeb14ebdd1972e4ff1d7a1c7a936d87fb 100644 --- a/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/net/minecraft/world/inventory/AbstractContainerMenu.java -@@ -901,6 +901,12 @@ public abstract class AbstractContainerMenu { +@@ -902,6 +902,12 @@ public abstract class AbstractContainerMenu { } else { float f = 0.0F; @@ -281,11 +281,11 @@ index c3021c0a8c588acf5ae8c9231e75bda984863267..0f3f9efdce86c3fb50247245eb5a3e1c ItemStack item = container.getItem(i); if (!item.isEmpty()) { diff --git a/net/minecraft/world/item/ItemStack.java b/net/minecraft/world/item/ItemStack.java -index 52a8a818a636e35b486b8aaf482cd68849a0bbcd..7706bf3cdd8017eb0591a4002489835b97bb4918 100644 +index 5f41d23d98ab1d762258a87a7af45a4e180e2fcf..11bda9a70889491f26a1252257b01344b3398367 100644 --- a/net/minecraft/world/item/ItemStack.java +++ b/net/minecraft/world/item/ItemStack.java -@@ -96,7 +96,7 @@ import org.apache.commons.lang3.function.TriConsumer; - import org.apache.commons.lang3.mutable.MutableBoolean; +@@ -102,7 +102,7 @@ import org.apache.commons.lang3.mutable.MutableBoolean; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; -public final class ItemStack implements DataComponentHolder { @@ -293,15 +293,15 @@ index 52a8a818a636e35b486b8aaf482cd68849a0bbcd..7706bf3cdd8017eb0591a4002489835b private static final List OP_NBT_WARNING = List.of( Component.translatable("item.op_warning.line1").withStyle(ChatFormatting.RED, ChatFormatting.BOLD), Component.translatable("item.op_warning.line2").withStyle(ChatFormatting.RED), -@@ -983,6 +983,7 @@ public final class ItemStack implements DataComponentHolder { +@@ -1022,6 +1022,7 @@ public final class ItemStack implements DataComponentHolder { + // CraftBukkit end - @Nullable - public T set(DataComponentType component, @Nullable T value) { + public @Nullable T set(DataComponentType component, @Nullable T value) { + if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.sleepingBlockEntity && component == DataComponents.ENCHANTMENTS && this.subscriber instanceof net.caffeinemc.mods.lithium.common.util.change_tracking.ChangeSubscriber.EnchantmentSubscriber enchantmentSubscriber) enchantmentSubscriber.lithium$notifyAfterEnchantmentChange(this, this.subscriberData); // DivineMC - lithium: sleeping_block_entity return this.components.set(component, value); } -@@ -1336,6 +1337,23 @@ public final class ItemStack implements DataComponentHolder { +@@ -1376,6 +1377,23 @@ public final class ItemStack implements DataComponentHolder { } public void setCount(int count) { @@ -325,9 +325,9 @@ index 52a8a818a636e35b486b8aaf482cd68849a0bbcd..7706bf3cdd8017eb0591a4002489835b this.count = count; } -@@ -1391,4 +1409,90 @@ public final class ItemStack implements DataComponentHolder { - public boolean canDestroyBlock(BlockState state, Level level, BlockPos pos, Player player) { - return this.getItem().canDestroyBlock(this, state, level, pos, player); +@@ -1444,4 +1462,90 @@ public final class ItemStack implements DataComponentHolder { + .or(() -> Optional.ofNullable(this.getItem().getItemDamageSource(attacker))) + .orElseGet(fallback); } + + // DivineMC start - lithium: sleeping_block_entity @@ -417,10 +417,10 @@ index 52a8a818a636e35b486b8aaf482cd68849a0bbcd..7706bf3cdd8017eb0591a4002489835b + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/Level.java b/net/minecraft/world/level/Level.java -index 4ec89234607f58ee32d0ea2ef056c8098e137041..e05c873814b6212ea61a4914e8a34cb9ac17822b 100644 +index 01e844df3ed46ef5ae34ae56845ae3d011567157..361daf6a270020fcf99177362007449f510b9aef 100644 --- a/net/minecraft/world/level/Level.java +++ b/net/minecraft/world/level/Level.java -@@ -1477,7 +1477,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -1472,7 +1472,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl // Spigot end if (tickingBlockEntity.isRemoved()) { this.blockEntityTickers.markAsRemoved(this.tileTickPosition); // DivineMC - optimize block entity removals - Fix MC-117075 @@ -429,7 +429,7 @@ index 4ec89234607f58ee32d0ea2ef056c8098e137041..e05c873814b6212ea61a4914e8a34cb9 tickingBlockEntity.tick(); // DivineMC start - Parallel world ticking ++tickedEntities; -@@ -2197,4 +2197,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -2175,4 +2175,25 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl return getWorld().getEnvironment() == org.bukkit.World.Environment.THE_END; } // Purpur end - Add allow water in end world option @@ -456,7 +456,7 @@ index 4ec89234607f58ee32d0ea2ef056c8098e137041..e05c873814b6212ea61a4914e8a34cb9 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/ComposterBlock.java b/net/minecraft/world/level/block/ComposterBlock.java -index 90ef0ea828303ccfa568c6acb3975c48f628261a..da18bce7cb9e99d207476471b511643e7eb609b9 100644 +index c87610c1854a8b845c13be547a0d7fe5da6874cc..d365939c90fa6bfdb202c2d07d830a94eafe36fc 100644 --- a/net/minecraft/world/level/block/ComposterBlock.java +++ b/net/minecraft/world/level/block/ComposterBlock.java @@ -440,7 +440,7 @@ public class ComposterBlock extends Block implements WorldlyContainerHolder { @@ -493,7 +493,7 @@ index 90ef0ea828303ccfa568c6acb3975c48f628261a..da18bce7cb9e99d207476471b511643e private final LevelAccessor level; private final BlockPos pos; diff --git a/net/minecraft/world/level/block/DiodeBlock.java b/net/minecraft/world/level/block/DiodeBlock.java -index 1158bdc1993a1c8f907070d6190c5a7d02d4bdb6..0fccdb394438bc35cdd38741a9c91bb022741c3d 100644 +index 02ffb5569e2405d86b3a4a695dd17c9372169ff7..d5258eb3fa07c63050e25731e43e7c031f0ba69a 100644 --- a/net/minecraft/world/level/block/DiodeBlock.java +++ b/net/minecraft/world/level/block/DiodeBlock.java @@ -173,6 +173,7 @@ public abstract class DiodeBlock extends HorizontalDirectionalBlock { @@ -505,19 +505,19 @@ index 1158bdc1993a1c8f907070d6190c5a7d02d4bdb6..0fccdb394438bc35cdd38741a9c91bb0 @Override diff --git a/net/minecraft/world/level/block/HopperBlock.java b/net/minecraft/world/level/block/HopperBlock.java -index 3140269761935201882173e568004488147a4110..288215bb11c0b63db7c354d12995ac5756382404 100644 +index 6789dd6c6f9c1683bcf0abb20319ccd6775e613c..74e20101eca81052b9b1558e2d744f9badca96d5 100644 --- a/net/minecraft/world/level/block/HopperBlock.java +++ b/net/minecraft/world/level/block/HopperBlock.java -@@ -38,7 +38,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; - import net.minecraft.world.phys.shapes.Shapes; +@@ -37,7 +37,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; + import org.jspecify.annotations.Nullable; -public class HopperBlock extends BaseEntityBlock { +public class HopperBlock extends BaseEntityBlock implements net.caffeinemc.mods.lithium.common.block.entity.ShapeUpdateHandlingBlockBehaviour { // DivineMC - lithium: sleeping_block_entity public static final MapCodec CODEC = simpleCodec(HopperBlock::new); public static final EnumProperty FACING = BlockStateProperties.FACING_HOPPER; public static final BooleanProperty ENABLED = BlockStateProperties.ENABLED; -@@ -101,6 +101,16 @@ public class HopperBlock extends BaseEntityBlock { +@@ -97,6 +97,16 @@ public class HopperBlock extends BaseEntityBlock { protected void onPlace(BlockState state, Level level, BlockPos pos, BlockState oldState, boolean movedByPiston) { if (!oldState.is(state.getBlock())) { this.checkPoweredState(level, pos, state); @@ -534,7 +534,7 @@ index 3140269761935201882173e568004488147a4110..288215bb11c0b63db7c354d12995ac57 } } -@@ -115,6 +125,7 @@ public class HopperBlock extends BaseEntityBlock { +@@ -111,6 +121,7 @@ public class HopperBlock extends BaseEntityBlock { @Override protected void neighborChanged(BlockState state, Level level, BlockPos pos, Block neighborBlock, @Nullable Orientation orientation, boolean movedByPiston) { @@ -542,7 +542,7 @@ index 3140269761935201882173e568004488147a4110..288215bb11c0b63db7c354d12995ac57 this.checkPoweredState(level, pos, state); } -@@ -168,4 +179,24 @@ public class HopperBlock extends BaseEntityBlock { +@@ -164,4 +175,24 @@ public class HopperBlock extends BaseEntityBlock { protected boolean isPathfindable(BlockState state, PathComputationType pathComputationType) { return false; } @@ -568,12 +568,12 @@ index 3140269761935201882173e568004488147a4110..288215bb11c0b63db7c354d12995ac57 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -index 3dfd539f4453d9c47c99af36e7ba64400fc89a5c..9d6928f886b7fc164553144ff985e0e93d8635d1 100644 +index a239f35a11d2934ceb97f65f9d4263f0f5313d56..bb81ab4105722ebfcd45487bbfc4d0a4604f8762 100644 --- a/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java +++ b/net/minecraft/world/level/block/entity/AbstractFurnaceBlockEntity.java -@@ -40,7 +40,7 @@ import net.minecraft.world.level.storage.ValueInput; - import net.minecraft.world.level.storage.ValueOutput; +@@ -40,7 +40,7 @@ import net.minecraft.world.level.storage.ValueOutput; import net.minecraft.world.phys.Vec3; + import org.jspecify.annotations.Nullable; -public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeCraftingHolder, StackedContentsCompatible { +public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, RecipeCraftingHolder, StackedContentsCompatible, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeTracker, net.caffeinemc.mods.lithium.common.block.entity.SleepingBlockEntity, net.caffeinemc.mods.lithium.common.block.entity.SetChangedHandlingBlockEntity, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory { // DivineMC - lithium: sleeping_block_entity @@ -601,7 +601,7 @@ index 3dfd539f4453d9c47c99af36e7ba64400fc89a5c..9d6928f886b7fc164553144ff985e0e9 if (usedLavaFromUnderneath) furnace.items.set(1, ItemStack.EMPTY); // Purpur - Furnace uses lava from underneath } -@@ -545,4 +552,53 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit +@@ -542,4 +549,53 @@ public abstract class AbstractFurnaceBlockEntity extends BaseContainerBlockEntit this.getRecipesToAwardAndPopExperience(serverLevel, Vec3.atCenterOf(pos)); } } @@ -694,19 +694,19 @@ index 04f6b3c328377091734a111f5a219379e32b5640..cec2996063356d0b1ac52d479b0e2ce3 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -index 7c2acea8af6a3110d782b9b3afeac0915ac127da..ccad8ed53e846ee0838420a74c8dc4b3e033e0d2 100644 +index edf3bc4adc9b1700b73f06ea940f17cd55b16860..9329e28fd1989735aeff55b5129ee93c2d526d10 100644 --- a/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -@@ -24,7 +24,7 @@ import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.storage.ValueInput; - import net.minecraft.world.level.storage.ValueOutput; +@@ -26,7 +26,7 @@ import net.minecraft.world.level.storage.ValueOutput; + import net.minecraft.world.phys.Vec3; + import org.jspecify.annotations.Nullable; -public abstract class BaseContainerBlockEntity extends BlockEntity implements Container, MenuProvider, Nameable { +public abstract class BaseContainerBlockEntity extends BlockEntity implements Container, MenuProvider, Nameable, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeEmitter { // DivineMC - lithium: sleeping_block_entity public LockCode lockKey = LockCode.NO_LOCK; - @Nullable - public Component name; -@@ -38,6 +38,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co + public @Nullable Component name; + +@@ -39,6 +39,7 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co super.loadAdditional(input); this.lockKey = LockCode.fromTag(input); this.name = parseCustomNameSafe(input, "CustomName"); @@ -714,7 +714,7 @@ index 7c2acea8af6a3110d782b9b3afeac0915ac127da..ccad8ed53e846ee0838420a74c8dc4b3 } @Override -@@ -210,4 +211,98 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co +@@ -183,4 +184,98 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co return org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.worldPosition, this.level); } // CraftBukkit end @@ -814,11 +814,11 @@ index 7c2acea8af6a3110d782b9b3afeac0915ac127da..ccad8ed53e846ee0838420a74c8dc4b3 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/entity/BlockEntity.java b/net/minecraft/world/level/block/entity/BlockEntity.java -index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc8709801d0e2839 100644 +index f2251f9233265c5c81d06abb8c5fdd2a9f81a183..e387088c7d2991fc83c6be4998f90de1a9018559 100644 --- a/net/minecraft/world/level/block/entity/BlockEntity.java +++ b/net/minecraft/world/level/block/entity/BlockEntity.java -@@ -36,7 +36,7 @@ import net.minecraft.world.level.storage.ValueInput; - import net.minecraft.world.level.storage.ValueOutput; +@@ -36,7 +36,7 @@ import net.minecraft.world.level.storage.ValueOutput; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; -public abstract class BlockEntity implements DebugValueSource { @@ -826,7 +826,7 @@ index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc870980 static boolean ignoreBlockEntityUpdates; // Paper - Perf: Optimize Hoppers // CraftBukkit start - data containers private static final org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new org.bukkit.craftbukkit.persistence.CraftPersistentDataTypeRegistry(); -@@ -58,6 +58,7 @@ public abstract class BlockEntity implements DebugValueSource { +@@ -57,6 +57,7 @@ public abstract class BlockEntity implements DebugValueSource { this.validateBlockState(blockState); this.blockState = blockState; this.persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY); // Paper - always init @@ -834,7 +834,7 @@ index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc870980 } private void validateBlockState(BlockState state) { -@@ -241,6 +242,7 @@ public abstract class BlockEntity implements DebugValueSource { +@@ -238,6 +239,7 @@ public abstract class BlockEntity implements DebugValueSource { if (this.level != null) { if (ignoreBlockEntityUpdates) return; // Paper - Perf: Optimize Hoppers setChanged(this.level, this.worldPosition, this.blockState); @@ -842,7 +842,7 @@ index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc870980 } } -@@ -273,7 +275,9 @@ public abstract class BlockEntity implements DebugValueSource { +@@ -269,7 +271,9 @@ public abstract class BlockEntity implements DebugValueSource { } public void setRemoved() { @@ -852,7 +852,7 @@ index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc870980 } public void clearRemoved() { -@@ -313,6 +317,7 @@ public abstract class BlockEntity implements DebugValueSource { +@@ -309,6 +313,7 @@ public abstract class BlockEntity implements DebugValueSource { public void setBlockState(BlockState blockState) { this.validateBlockState(blockState); this.blockState = blockState; @@ -860,7 +860,7 @@ index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc870980 } protected void applyImplicitComponents(DataComponentGetter componentGetter) { -@@ -430,4 +435,32 @@ public abstract class BlockEntity implements DebugValueSource { +@@ -423,4 +428,32 @@ public abstract class BlockEntity implements DebugValueSource { return this.persistentLore; } // Purpur end - Persistent BlockEntity Lore and DisplayName @@ -894,12 +894,12 @@ index 9a9208d3716c2ed7fbcc5ea8518d4b7d3cb2296a..6a2f56e9925185813b84a70fdc870980 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -index 5b28e257982c911f4d8ffe286dc125b3f9b64ee4..960bbd0b2e4b17768e0c152ec1160cfb17dd8065 100644 +index 74577d6523db1cce6413317c016887f2a7bb9977..5b0c92792b7269f173a6b0c3267ab15b7c197cc4 100644 --- a/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java +++ b/net/minecraft/world/level/block/entity/BrewingStandBlockEntity.java -@@ -26,7 +26,7 @@ import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.storage.ValueInput; +@@ -26,7 +26,7 @@ import net.minecraft.world.level.storage.ValueInput; import net.minecraft.world.level.storage.ValueOutput; + import org.jspecify.annotations.Nullable; -public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer { +public class BrewingStandBlockEntity extends BaseContainerBlockEntity implements WorldlyContainer, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeTracker, net.caffeinemc.mods.lithium.common.block.entity.SleepingBlockEntity, net.caffeinemc.mods.lithium.common.block.entity.SetChangedHandlingBlockEntity, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory { // DivineMC - lithium: sleeping_block_entity @@ -1002,11 +1002,11 @@ index 5b28e257982c911f4d8ffe286dc125b3f9b64ee4..960bbd0b2e4b17768e0c152ec1160cfb + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java b/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -index 78c4d1fc052d72f8599c82291d2233ec2e552137..306c5bf630b295d27e5b1885bd784bbfbc846812 100644 +index a27f578eb4d2dbcdb5cd72cb0aa3ec98cdb543c2..6f9a192af1af7b11bc0f7c3202f6f759fd37fc3d 100644 --- a/net/minecraft/world/level/block/entity/CampfireBlockEntity.java +++ b/net/minecraft/world/level/block/entity/CampfireBlockEntity.java -@@ -39,7 +39,7 @@ import net.minecraft.world.level.storage.ValueInput; - import net.minecraft.world.level.storage.ValueOutput; +@@ -39,7 +39,7 @@ import net.minecraft.world.level.storage.ValueOutput; + import org.jspecify.annotations.Nullable; import org.slf4j.Logger; -public class CampfireBlockEntity extends BlockEntity implements Clearable { @@ -1378,12 +1378,12 @@ index 775928cfe700202a70b19589ca72afd9768b62f1..2eda08301a3e3888c55a21390d1a718b + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index daf4f28d04a1ad1e034c6d7dedba9e4e2272f2ea..3afb0ce74c5378ce909c1a1e6182aaae5fddefb4 100644 +index 4eb65b8df8069aa678c82092248e6ac3dde04160..45cfeacda5ba9302be5452826c37d10a29720c2e 100644 --- a/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/net/minecraft/world/level/block/entity/HopperBlockEntity.java -@@ -28,7 +28,7 @@ import net.minecraft.world.level.storage.ValueInput; - import net.minecraft.world.level.storage.ValueOutput; +@@ -28,7 +28,7 @@ import net.minecraft.world.level.storage.ValueOutput; import net.minecraft.world.phys.AABB; + import org.jspecify.annotations.Nullable; -public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper { +public class HopperBlockEntity extends RandomizableContainerBlockEntity implements Hopper, net.caffeinemc.mods.lithium.common.block.entity.SleepingBlockEntity, net.caffeinemc.mods.lithium.common.tracking.entity.ChunkSectionEntityMovementListener, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeListener, net.caffeinemc.mods.lithium.common.hopper.UpdateReceiver, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeTracker { // DivineMC - lithium: sleeping_block_entity @@ -1472,16 +1472,16 @@ index daf4f28d04a1ad1e034c6d7dedba9e4e2272f2ea..3afb0ce74c5378ce909c1a1e6182aaae if (addItem(hopper, itemEntity)) { return true; } -@@ -721,7 +741,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -720,7 +740,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen + // CraftBukkit start - @Nullable - private static Container runHopperInventorySearchEvent( + private static @Nullable Container runHopperInventorySearchEvent( - Container container, + @Nullable Container container, org.bukkit.craftbukkit.block.CraftBlock hopper, org.bukkit.craftbukkit.block.CraftBlock searchLocation, org.bukkit.event.inventory.HopperInventorySearchEvent.ContainerType containerType -@@ -849,6 +869,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -841,6 +861,19 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen } public void setCooldown(int cooldownTime) { @@ -1501,7 +1501,7 @@ index daf4f28d04a1ad1e034c6d7dedba9e4e2272f2ea..3afb0ce74c5378ce909c1a1e6182aaae this.cooldownTime = cooldownTime; } -@@ -868,6 +901,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -860,6 +893,7 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen @Override protected void setItems(NonNullList items) { this.items = items; @@ -1509,7 +1509,7 @@ index daf4f28d04a1ad1e034c6d7dedba9e4e2272f2ea..3afb0ce74c5378ce909c1a1e6182aaae } public static void entityInside(Level level, BlockPos pos, BlockState state, Entity entity, HopperBlockEntity blockEntity) { -@@ -882,4 +916,749 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen +@@ -874,4 +908,749 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen protected AbstractContainerMenu createMenu(int id, Inventory player) { return new HopperMenu(id, player, this); } @@ -2260,19 +2260,19 @@ index daf4f28d04a1ad1e034c6d7dedba9e4e2272f2ea..3afb0ce74c5378ce909c1a1e6182aaae + } } diff --git a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -index 4d268864656ad67e6971b74534e25ac47d922cbd..a2af20103729392df0167a632672ae11caf05340 100644 +index 61b99c895c0e248f0e7c4c634644dcff54a964d9..f07fd97545fa31b47b7dad32a2ab4ee5214e0d3e 100644 --- a/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java +++ b/net/minecraft/world/level/block/entity/ShulkerBoxBlockEntity.java -@@ -32,7 +32,7 @@ import net.minecraft.world.level.storage.ValueOutput; - import net.minecraft.world.phys.AABB; +@@ -32,7 +32,7 @@ import net.minecraft.world.phys.AABB; import net.minecraft.world.phys.Vec3; + import org.jspecify.annotations.Nullable; -public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer { +public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity implements WorldlyContainer, net.caffeinemc.mods.lithium.common.block.entity.inventory_change_tracking.InventoryChangeTracker, net.caffeinemc.mods.lithium.common.block.entity.SleepingBlockEntity, net.caffeinemc.mods.lithium.api.inventory.LithiumInventory { // DivineMC - lithium: sleeping_block_entity public static final int COLUMNS = 9; public static final int ROWS = 3; public static final int CONTAINER_SIZE = 27; -@@ -135,6 +135,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl +@@ -134,6 +134,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl doNeighborUpdates(level, pos, state); } } @@ -2280,7 +2280,7 @@ index 4d268864656ad67e6971b74534e25ac47d922cbd..a2af20103729392df0167a632672ae11 } public ShulkerBoxBlockEntity.AnimationStatus getAnimationStatus() { -@@ -175,6 +176,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl +@@ -174,6 +175,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl @Override public boolean triggerEvent(int id, int type) { @@ -2288,7 +2288,7 @@ index 4d268864656ad67e6971b74534e25ac47d922cbd..a2af20103729392df0167a632672ae11 if (id == 1) { this.openCount = type; if (type == 0) { -@@ -266,6 +268,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl +@@ -265,6 +267,7 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl @Override protected void setItems(NonNullList items) { this.itemStacks = items; @@ -2296,7 +2296,7 @@ index 4d268864656ad67e6971b74534e25ac47d922cbd..a2af20103729392df0167a632672ae11 } @Override -@@ -307,4 +310,39 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl +@@ -305,4 +308,39 @@ public class ShulkerBoxBlockEntity extends RandomizableContainerBlockEntity impl OPENED, CLOSING; } @@ -2337,12 +2337,12 @@ index 4d268864656ad67e6971b74534e25ac47d922cbd..a2af20103729392df0167a632672ae11 + // DivineMC end - lithium: sleeping_block_entity } diff --git a/net/minecraft/world/level/block/state/BlockBehaviour.java b/net/minecraft/world/level/block/state/BlockBehaviour.java -index a6c99a119a923dd890169888ff4e9852f6e27855..754a4c463c3706512fc42fd3ad32841fc8320709 100644 +index 5ce545304d1ba80efaeb63367dbd34b2e17d64ed..00ecb0560b1224a5fcb528534b35648f3bbb1f94 100644 --- a/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -84,7 +84,7 @@ import net.minecraft.world.phys.shapes.CollisionContext; - import net.minecraft.world.phys.shapes.Shapes; +@@ -84,7 +84,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; + import org.jspecify.annotations.Nullable; -public abstract class BlockBehaviour implements FeatureElement { +public abstract class BlockBehaviour implements FeatureElement, net.caffeinemc.mods.lithium.common.block.entity.ShapeUpdateHandlingBlockBehaviour { // DivineMC - lithium: sleeping_block_entity @@ -2358,10 +2358,10 @@ index a6c99a119a923dd890169888ff4e9852f6e27855..754a4c463c3706512fc42fd3ad32841f } diff --git a/net/minecraft/world/level/chunk/LevelChunk.java b/net/minecraft/world/level/chunk/LevelChunk.java -index 5470b02a382a2c8a855a0f6b696c72f9b5b0c0b4..e83b75ee844b0619e39a8c3fd5920c4c7424cce4 100644 +index 4c9e76a6eaf4349c27dcc9cc425c6b586595a48e..42f65a05fd9e4ec8540f91ae6a095e1939f92b6d 100644 --- a/net/minecraft/world/level/chunk/LevelChunk.java +++ b/net/minecraft/world/level/chunk/LevelChunk.java -@@ -927,12 +927,14 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot +@@ -921,12 +921,14 @@ public class LevelChunk extends ChunkAccess implements DebugValueSource, ca.spot (pos, ticker1) -> { TickingBlockEntity tickingBlockEntity = this.createTicker(blockEntity, ticker); if (ticker1 != null) { diff --git a/divinemc-server/minecraft-patches/features/0072-lithium-equipment_tracking.patch b/divinemc-server/minecraft-patches/features/0072-lithium-equipment_tracking.patch index 2be99ca..afc3464 100644 --- a/divinemc-server/minecraft-patches/features/0072-lithium-equipment_tracking.patch +++ b/divinemc-server/minecraft-patches/features/0072-lithium-equipment_tracking.patch @@ -187,7 +187,7 @@ index 1e00a7bd89d885cabb4b9ca3c86fbd8cd93cebf5..4fb31f578c2a4a5dc137c38de8f64159 + // DivineMC end - lithium: equipment_tracking } diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 7ec1c2f39981b60343f152a5432b3677574ee46c..e3e64a0bf7b8b9e04114a2b0b363932517deea0f 100644 +index 2005a3787b4b74913d02b09dac27cee8db9ec0ca..4d14baa31657287b6e565bf7c64d964db28afebc 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -440,9 +440,17 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin @@ -210,7 +210,7 @@ index 7ec1c2f39981b60343f152a5432b3677574ee46c..e3e64a0bf7b8b9e04114a2b0b3639325 super.baseTick(); if (this.isAlive() && this.level() instanceof ServerLevel serverLevel1) { -@@ -3454,6 +3462,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3585,6 +3593,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin public void detectEquipmentUpdates() { Map map = this.collectEquipmentChanges(); if (map != null) { @@ -218,10 +218,10 @@ index 7ec1c2f39981b60343f152a5432b3677574ee46c..e3e64a0bf7b8b9e04114a2b0b3639325 this.handleHandSwap(map); if (!map.isEmpty()) { this.handleEquipmentChanges(map); -@@ -3463,6 +3472,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -3593,6 +3602,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin + } - @Nullable - private Map collectEquipmentChanges() { + private @Nullable Map collectEquipmentChanges() { + // DivineMC start - lithium: equipment_tracking + if (org.bxteam.divinemc.config.DivineConfig.PerformanceCategory.equipmentTracking) { + final boolean isArmorStandUpdateNoTick = this instanceof net.minecraft.world.entity.decoration.ArmorStand stand && !stand.canTick && stand.noTickEquipmentDirty; @@ -234,7 +234,7 @@ index 7ec1c2f39981b60343f152a5432b3677574ee46c..e3e64a0bf7b8b9e04114a2b0b3639325 // Paper start - EntityEquipmentChangedEvent record EquipmentChangeImpl(org.bukkit.inventory.ItemStack oldItem, org.bukkit.inventory.ItemStack newItem) implements io.papermc.paper.event.entity.EntityEquipmentChangedEvent.EquipmentChange { diff --git a/net/minecraft/world/entity/decoration/ArmorStand.java b/net/minecraft/world/entity/decoration/ArmorStand.java -index 9a298e111b9142dd878ee03b442d1110a9e0897e..ff3a4d740631d9f353cf1812f124b68aac144f64 100644 +index ae18b3a78075a72c927b7362bed18d4ec3dc2360..2bf4b7d9be2deb43b14bb907c2341ad1407f5dd0 100644 --- a/net/minecraft/world/entity/decoration/ArmorStand.java +++ b/net/minecraft/world/entity/decoration/ArmorStand.java @@ -529,8 +529,9 @@ public class ArmorStand extends LivingEntity { diff --git a/divinemc-server/minecraft-patches/features/0073-Configurable-Files-Locations.patch b/divinemc-server/minecraft-patches/features/0073-Configurable-Files-Locations.patch index 084fd33..d18bfd7 100644 --- a/divinemc-server/minecraft-patches/features/0073-Configurable-Files-Locations.patch +++ b/divinemc-server/minecraft-patches/features/0073-Configurable-Files-Locations.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable Files Locations diff --git a/net/minecraft/server/players/PlayerList.java b/net/minecraft/server/players/PlayerList.java -index eb3f3a2d70de239b8324b35529987daf70202042..c5c24720058be1782ec71905ae04c8448fc902d7 100644 +index e6e3491ec1aebf95d681fbd05e312cbcf968423e..9f75a353882426d78f031fe09dc0cf6f7bc60495 100644 --- a/net/minecraft/server/players/PlayerList.java +++ b/net/minecraft/server/players/PlayerList.java -@@ -100,10 +100,12 @@ import net.minecraft.world.scores.Team; +@@ -104,10 +104,12 @@ import org.jspecify.annotations.Nullable; import org.slf4j.Logger; public abstract class PlayerList { @@ -25,7 +25,7 @@ index eb3f3a2d70de239b8324b35529987daf70202042..c5c24720058be1782ec71905ae04c844 public static final Component CHAT_FILTERED_FULL = Component.translatable("chat.filtered_full"); public static final Component DUPLICATE_LOGIN_DISCONNECT_MESSAGE = Component.translatable("multiplayer.disconnect.duplicate_login"); private static final Logger LOGGER = LogUtils.getLogger(); -@@ -141,10 +143,17 @@ public abstract class PlayerList { +@@ -145,10 +147,17 @@ public abstract class PlayerList { this.server = server; this.registries = registries; this.playerIo = playerIo; diff --git a/divinemc-server/minecraft-patches/features/0074-Pufferfish-Cache-climbing-check-for-activation.patch b/divinemc-server/minecraft-patches/features/0074-Pufferfish-Cache-climbing-check-for-activation.patch index 5c3eb91..25fe97e 100644 --- a/divinemc-server/minecraft-patches/features/0074-Pufferfish-Cache-climbing-check-for-activation.patch +++ b/divinemc-server/minecraft-patches/features/0074-Pufferfish-Cache-climbing-check-for-activation.patch @@ -10,7 +10,7 @@ As part of: Pufferfish (https://github.com/pufferfish-gg/Pufferfish) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/io/papermc/paper/entity/activation/ActivationRange.java b/io/papermc/paper/entity/activation/ActivationRange.java -index 5d9089d98ed0daa8ee680123e50c3ce9abd2bca6..04623779031daa2f0d8e9c149f0b40388cb2bd8b 100644 +index 883504917170f59b04ad61304eb51bc5832e2c97..8aa3e78fcd64095b4f445158c18fccada043ab06 100644 --- a/io/papermc/paper/entity/activation/ActivationRange.java +++ b/io/papermc/paper/entity/activation/ActivationRange.java @@ -238,7 +238,7 @@ public final class ActivationRange { @@ -23,10 +23,10 @@ index 5d9089d98ed0daa8ee680123e50c3ce9abd2bca6..04623779031daa2f0d8e9c149f0b4038 } if (entity instanceof final Mob mob && mob.getTarget() != null) { diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index e3e64a0bf7b8b9e04114a2b0b363932517deea0f..ad3e68127ba84bdc18f738dbf709099a50aa8216 100644 +index 4d14baa31657287b6e565bf7c64d964db28afebc..9e098495ff487b319175e4a26db47127aac98089 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java -@@ -2244,6 +2244,20 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin +@@ -2259,6 +2259,20 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin return this.lastClimbablePos; } diff --git a/divinemc-server/minecraft-patches/features/0075-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch b/divinemc-server/minecraft-patches/features/0075-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch index e5de4ac..018b6ef 100644 --- a/divinemc-server/minecraft-patches/features/0075-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch +++ b/divinemc-server/minecraft-patches/features/0075-Pufferfish-Make-EntityCollisionContext-a-live-repres.patch @@ -10,11 +10,11 @@ As part of: Airplane (https://github.com/TECHNOVE/Airplane) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/world/phys/shapes/EntityCollisionContext.java b/net/minecraft/world/phys/shapes/EntityCollisionContext.java -index a2d7eb19fc8963f80c94761138b7c43af0e44fe9..c9b1f73cffd2bcfb426324dcbe15fd599fac0bbf 100644 +index 98787a3e5366c4964db278785fbbd578373be991..0a0f2b451ed2a82a699df0b0273945cfffaae295 100644 --- a/net/minecraft/world/phys/shapes/EntityCollisionContext.java +++ b/net/minecraft/world/phys/shapes/EntityCollisionContext.java -@@ -12,40 +12,35 @@ import net.minecraft.world.level.block.state.BlockState; - import net.minecraft.world.level.material.FluidState; +@@ -12,39 +12,34 @@ import net.minecraft.world.level.material.FluidState; + import org.jspecify.annotations.Nullable; public class EntityCollisionContext implements CollisionContext { - private final boolean descending; @@ -24,8 +24,7 @@ index a2d7eb19fc8963f80c94761138b7c43af0e44fe9..c9b1f73cffd2bcfb426324dcbe15fd59 - private final ItemStack heldItem; private final boolean alwaysCollideWithFluid; + // DivineMC end - Pufferfish: Make EntityCollisionContext a live representation - @Nullable - private final Entity entity; + private final @Nullable Entity entity; protected EntityCollisionContext( boolean descending, boolean placement, double entityBottom, ItemStack heldItem, boolean alwaysCollideWithFluid, @Nullable Entity entity @@ -64,7 +63,7 @@ index a2d7eb19fc8963f80c94761138b7c43af0e44fe9..c9b1f73cffd2bcfb426324dcbe15fd59 } @Override -@@ -65,12 +60,12 @@ public class EntityCollisionContext implements CollisionContext { +@@ -64,12 +59,12 @@ public class EntityCollisionContext implements CollisionContext { @Override public boolean isDescending() { @@ -78,4 +77,4 @@ index a2d7eb19fc8963f80c94761138b7c43af0e44fe9..c9b1f73cffd2bcfb426324dcbe15fd59 + return (this.entity == null ? -Double.MAX_VALUE : entity.getY()) > (double) pos.getY() + shape.max(Direction.Axis.Y) - (double) 1.0E-5F; // DivineMC - Pufferfish: Make EntityCollisionContext a live representation } - @Nullable + public @Nullable Entity getEntity() { diff --git a/divinemc-server/minecraft-patches/features/0076-Pufferfish-Better-checking-for-useless-move-packets.patch b/divinemc-server/minecraft-patches/features/0076-Pufferfish-Better-checking-for-useless-move-packets.patch index 749ef6e..1e5a0a9 100644 --- a/divinemc-server/minecraft-patches/features/0076-Pufferfish-Better-checking-for-useless-move-packets.patch +++ b/divinemc-server/minecraft-patches/features/0076-Pufferfish-Better-checking-for-useless-move-packets.patch @@ -10,7 +10,7 @@ As part of: Airplane (https://github.com/TECHNOVE/Airplane) Licensed under: GPL-3.0 (https://www.gnu.org/licenses/gpl-3.0.html) diff --git a/net/minecraft/server/level/ServerEntity.java b/net/minecraft/server/level/ServerEntity.java -index cfa2c3aa357a0dbb7edf7f0c8cebea5ed2f31cbc..d8ac41bacbb2303eacac6d96dd829865346f5b3b 100644 +index 615691b0f07380e5ce0c105d1f7eb469c7c0d5d6..70b92d9f9d75a42926c221bf53ec8051ececb1fa 100644 --- a/net/minecraft/server/level/ServerEntity.java +++ b/net/minecraft/server/level/ServerEntity.java @@ -181,18 +181,24 @@ public class ServerEntity { @@ -48,4 +48,4 @@ index cfa2c3aa357a0dbb7edf7f0c8cebea5ed2f31cbc..d8ac41bacbb2303eacac6d96dd829865 + // DivineMC end - Pufferfish: Better checking for useless move packets } - if (this.entity.hasImpulse || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { + if (this.entity.needsSync || this.trackDelta || this.entity instanceof LivingEntity && ((LivingEntity)this.entity).isFallFlying()) { diff --git a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index 81a9d94..f56700e 100644 --- a/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/divinemc-server/minecraft-patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -40,7 +40,7 @@ } public float getSpeed() { -@@ -3897,6 +_,7 @@ +@@ -3902,6 +_,7 @@ protected void updateFallFlying() { this.checkFallDistanceAccumulation(); if (!this.level().isClientSide()) { diff --git a/divinemc-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java b/divinemc-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java index c2a308a..338ebcc 100644 --- a/divinemc-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java +++ b/divinemc-server/src/main/java/gg/pufferfish/pufferfish/util/AsyncExecutor.java @@ -3,7 +3,7 @@ package gg.pufferfish.pufferfish.util; import it.unimi.dsi.fastutil.PriorityQueue; import it.unimi.dsi.fastutil.PriorityQueues; import it.unimi.dsi.fastutil.objects.ObjectArrayFIFOQueue; -import net.minecraft.Util; +import net.minecraft.util.Util; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bxteam.divinemc.spark.ThreadDumperRegistry; diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/async/rct/RegionizedChunkTicking.java b/divinemc-server/src/main/java/org/bxteam/divinemc/async/rct/RegionizedChunkTicking.java index bfce2be..bde71f1 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/async/rct/RegionizedChunkTicking.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/async/rct/RegionizedChunkTicking.java @@ -25,10 +25,10 @@ import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.Entity; import net.minecraft.world.level.ChunkPos; -import net.minecraft.world.level.GameRules; import net.minecraft.world.level.chunk.ChunkGenerator; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.entity.ChunkStatusUpdateListener; +import net.minecraft.world.level.gamerules.GameRules; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager; import net.minecraft.world.level.storage.DimensionDataStorage; import net.minecraft.world.level.storage.LevelStorageSource; @@ -50,7 +50,7 @@ public final class RegionizedChunkTicking extends ServerChunkCache { @Override protected void iterateTickingChunksFaster(final @NotNull CompletableFuture spawns) { final ServerLevel world = this.level; - final int randomTickSpeed = world.getGameRules().getInt(GameRules.RULE_RANDOMTICKING); + final int randomTickSpeed = world.getGameRules().get(GameRules.RANDOM_TICK_SPEED); final LevelChunk[] raw = world.moonrise$getEntityTickingChunks().toArray(new LevelChunk[0]); final TickPair tickPair = computePlayerRegionsParallel(); diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/command/DivineCommand.java b/divinemc-server/src/main/java/org/bxteam/divinemc/command/DivineCommand.java index 2a16973..86a95b1 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/command/DivineCommand.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/command/DivineCommand.java @@ -2,7 +2,7 @@ package org.bxteam.divinemc.command; import io.papermc.paper.command.CommandUtil; import it.unimi.dsi.fastutil.Pair; -import net.minecraft.Util; +import net.minecraft.util.Util; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.command.Command; 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 969dbab..6f8b5df 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 @@ -2,7 +2,7 @@ package org.bxteam.divinemc.config; import com.google.common.base.Throwables; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.entity.EntityType; import org.apache.logging.log4j.Level; import org.apache.logging.log4j.LogManager; @@ -518,7 +518,7 @@ public class DivineConfig { entityType.dabEnabled = true; } - final String DEFAULT_PREFIX = ResourceLocation.DEFAULT_NAMESPACE + ResourceLocation.NAMESPACE_SEPARATOR; + final String DEFAULT_PREFIX = Identifier.DEFAULT_NAMESPACE + Identifier.NAMESPACE_SEPARATOR; for (String name : dabBlackedEntities) { String lowerName = name.toLowerCase(Locale.ROOT); String typeId = lowerName.startsWith(DEFAULT_PREFIX) ? lowerName : DEFAULT_PREFIX + lowerName; @@ -756,7 +756,7 @@ public class DivineConfig { entityType.skipRaytracingCheck = retInvertSkippedEntities; } - final String DEFAULT_PREFIX = ResourceLocation.DEFAULT_NAMESPACE + ResourceLocation.NAMESPACE_SEPARATOR; + final String DEFAULT_PREFIX = Identifier.DEFAULT_NAMESPACE + Identifier.NAMESPACE_SEPARATOR; for (String name : retSkippedEntities) { String lowerName = name.toLowerCase(Locale.ROOT); diff --git a/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java b/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java index f88d834..1fe4f1d 100644 --- a/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java +++ b/divinemc-server/src/main/java/org/bxteam/divinemc/util/structure/GeneralUtils.java @@ -3,12 +3,11 @@ package org.bxteam.divinemc.util.structure; import it.unimi.dsi.fastutil.ints.Int2ObjectArrayMap; import it.unimi.dsi.fastutil.ints.IntArrayList; import it.unimi.dsi.fastutil.ints.IntComparators; -import net.minecraft.Util; import net.minecraft.core.FrontAndTop; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.NumericTag; import net.minecraft.nbt.StringTag; import net.minecraft.util.RandomSource; +import net.minecraft.util.Util; import net.minecraft.world.level.block.JigsawBlock; import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate; import org.jetbrains.annotations.NotNull; diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java index ac7126f..f8ba78e 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/AppleSkinProtocol.java @@ -1,10 +1,10 @@ package org.leavesmc.leaves.protocol; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.food.FoodData; -import net.minecraft.world.level.GameRules; +import net.minecraft.world.level.gamerules.GameRules; import org.bxteam.divinemc.config.DivineConfig; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; @@ -24,9 +24,9 @@ public class AppleSkinProtocol implements LeavesProtocol { public static final String PROTOCOL_ID = "appleskin"; - private static final ResourceLocation SATURATION_KEY = id("saturation"); - private static final ResourceLocation EXHAUSTION_KEY = id("exhaustion"); - private static final ResourceLocation NATURAL_REGENERATION_KEY = id("natural_regeneration"); + private static final Identifier SATURATION_KEY = id("saturation"); + private static final Identifier EXHAUSTION_KEY = id("exhaustion"); + private static final Identifier NATURAL_REGENERATION_KEY = id("natural_regeneration"); private static final float MINIMUM_EXHAUSTION_CHANGE_THRESHOLD = 0.01F; @@ -37,8 +37,8 @@ public class AppleSkinProtocol implements LeavesProtocol { private static final Map> subscribedChannels = new HashMap<>(); @Contract("_ -> new") - public static ResourceLocation id(String path) { - return ResourceLocation.tryBuild(PROTOCOL_ID, path); + public static Identifier id(String path) { + return Identifier.tryBuild(PROTOCOL_ID, path); } @ProtocolHandler.PlayerJoin @@ -53,7 +53,7 @@ public class AppleSkinProtocol implements LeavesProtocol { } @ProtocolHandler.MinecraftRegister(onlyNamespace = true) - public static void onPlayerSubscribed(@NotNull Context context, ResourceLocation id) { + public static void onPlayerSubscribed(@NotNull Context context, Identifier id) { subscribedChannels.computeIfAbsent(context.profile().id(), k -> new HashSet<>()).add(id.getPath()); } @@ -87,7 +87,7 @@ public class AppleSkinProtocol implements LeavesProtocol { } case "natural_regeneration" -> { - boolean regeneration = player.level().getGameRules().getBoolean(GameRules.RULE_NATURAL_REGENERATION); + boolean regeneration = player.level().getGameRules().get(GameRules.NATURAL_HEALTH_REGENERATION); Boolean previousRegeneration = previousNaturalRegeneration.get(player); if (previousRegeneration == null || regeneration != previousRegeneration) { ProtocolUtils.sendBytebufPacket(player, NATURAL_REGENERATION_KEY, buf -> buf.writeBoolean(regeneration)); diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java index 28c6f1c..77d91e1 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/XaeroMapProtocol.java @@ -1,6 +1,6 @@ package org.leavesmc.leaves.protocol; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import org.bxteam.divinemc.config.DivineConfig; import org.jetbrains.annotations.Contract; @@ -14,17 +14,17 @@ public class XaeroMapProtocol implements LeavesProtocol { public static final String PROTOCOL_ID_MINI = "xaerominimap"; public static final String PROTOCOL_ID_WORLD = "xaeroworldmap"; - private static final ResourceLocation MINIMAP_KEY = idMini("main"); - private static final ResourceLocation WORLDMAP_KEY = idWorld("main"); + private static final Identifier MINIMAP_KEY = idMini("main"); + private static final Identifier WORLDMAP_KEY = idWorld("main"); @Contract("_ -> new") - public static ResourceLocation idMini(String path) { - return ResourceLocation.tryBuild(PROTOCOL_ID_MINI, path); + public static Identifier idMini(String path) { + return Identifier.tryBuild(PROTOCOL_ID_MINI, path); } @Contract("_ -> new") - public static ResourceLocation idWorld(String path) { - return ResourceLocation.tryBuild(PROTOCOL_ID_WORLD, path); + public static Identifier idWorld(String path) { + return Identifier.tryBuild(PROTOCOL_ID_WORLD, path); } public static void onSendWorldInfo(@NotNull ServerPlayer player) { diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java index 59e4aff..6b62b2e 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesCustomPayload.java @@ -1,7 +1,7 @@ package org.leavesmc.leaves.protocol.core; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.jetbrains.annotations.NotNull; import java.lang.annotation.ElementType; @@ -11,7 +11,7 @@ import java.lang.annotation.Target; public interface LeavesCustomPayload extends CustomPacketPayload { - Type LEAVES_TYPE = new Type<>(ResourceLocation.fromNamespaceAndPath("leaves", "custom_payload")); + Type LEAVES_TYPE = new Type<>(Identifier.fromNamespaceAndPath("leaves", "custom_payload")); @Override default @NotNull Type type() { diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java index f6300c8..af1a5f8 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/LeavesProtocolManager.java @@ -4,7 +4,7 @@ import io.netty.buffer.ByteBuf; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.level.ServerPlayer; import org.leavesmc.leaves.LeavesLogger; import org.leavesmc.leaves.protocol.core.invoker.BytebufReceiverInvokerHolder; @@ -40,9 +40,9 @@ public class LeavesProtocolManager { private static final LeavesLogger LOGGER = LeavesLogger.LOGGER; private static final Map, PayloadReceiverInvokerHolder> PAYLOAD_RECEIVERS = new HashMap<>(); - private static final Map, ResourceLocation> IDS = new HashMap<>(); + private static final Map, Identifier> IDS = new HashMap<>(); private static final Map, StreamCodec> CODECS = new HashMap<>(); - private static final Map> ID2CODEC = new HashMap<>(); + private static final Map> ID2CODEC = new HashMap<>(); private static final Map STRICT_BYTEBUF_RECEIVERS = new HashMap<>(); private static final Map NAMESPACED_BYTEBUF_RECEIVERS = new HashMap<>(); @@ -70,8 +70,8 @@ public class LeavesProtocolManager { } try { final LeavesCustomPayload.ID id = field.getAnnotation(LeavesCustomPayload.ID.class); - if (id != null && field.getType().equals(ResourceLocation.class)) { - IDS.put((Class) clazz, (ResourceLocation) field.get(null)); + if (id != null && field.getType().equals(Identifier.class)) { + IDS.put((Class) clazz, (Identifier) field.get(null)); } final LeavesCustomPayload.Codec codec = field.getAnnotation(LeavesCustomPayload.Codec.class); if (codec != null && field.getType().equals(StreamCodec.class)) { @@ -200,7 +200,7 @@ public class LeavesProtocolManager { } } - public static LeavesCustomPayload decode(ResourceLocation location, FriendlyByteBuf buf) { + public static LeavesCustomPayload decode(Identifier location, FriendlyByteBuf buf) { var codec = ID2CODEC.get(location); if (codec == null) { return null; @@ -214,7 +214,7 @@ public class LeavesProtocolManager { if (location == null || codec == null) { throw new IllegalArgumentException("Payload " + payload.getClass() + " is not configured correctly " + location + " " + codec); } - buf.writeResourceLocation(location); + buf.writeIdentifier(location); codec.encode(ProtocolUtils.decorate(buf), payload); } @@ -225,7 +225,7 @@ public class LeavesProtocolManager { } } - public static boolean handleBytebuf(IdentifierSelector selector, ResourceLocation location, ByteBuf buf) { + public static boolean handleBytebuf(IdentifierSelector selector, Identifier location, ByteBuf buf) { RegistryFriendlyByteBuf buf1 = ProtocolUtils.decorate(buf); BytebufReceiverInvokerHolder holder; if ((holder = STRICT_BYTEBUF_RECEIVERS.get(location.toString())) != null) { @@ -279,7 +279,7 @@ public class LeavesProtocolManager { } public static void handleMinecraftRegister(String channelId, IdentifierSelector selector) { - ResourceLocation location = ResourceLocation.tryParse(channelId); + Identifier location = Identifier.tryParse(channelId); if (location == null) { return; } @@ -309,7 +309,7 @@ public class LeavesProtocolManager { set.add(key); } }); - ProtocolUtils.sendBytebufPacket(player, ResourceLocation.fromNamespaceAndPath("minecraft", "register"), buf -> { + ProtocolUtils.sendBytebufPacket(player, Identifier.fromNamespaceAndPath("minecraft", "register"), buf -> { for (String channel : set) { buf.writeBytes(channel.getBytes(StandardCharsets.US_ASCII)); buf.writeByte(0); @@ -392,4 +392,4 @@ public class LeavesProtocolManager { } } } -} \ No newline at end of file +} diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java index ec6771d..06452e9 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/ProtocolUtils.java @@ -8,7 +8,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.network.protocol.common.custom.DiscardedPayload; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.network.ServerCommonPacketListenerImpl; @@ -28,11 +28,11 @@ public class ProtocolUtils { return protocol + "-leaves-" + ServerBuildInfo.buildInfo().asString(ServerBuildInfo.StringRepresentation.VERSION_SIMPLE); } - public static void sendEmptyPacket(ServerPlayer player, ResourceLocation id) { + public static void sendEmptyPacket(ServerPlayer player, Identifier id) { player.connection.send(new ClientboundCustomPayloadPacket(new DiscardedPayload(id, EMPTY))); } - public static void sendBytebufPacket(@NotNull ServerPlayer player, ResourceLocation id, Consumer consumer) { + public static void sendBytebufPacket(@NotNull ServerPlayer player, Identifier id, Consumer consumer) { RegistryFriendlyByteBuf buf = decorate(Unpooled.buffer()); consumer.accept(buf); player.connection.send(new ClientboundCustomPayloadPacket(new DiscardedPayload(id, ByteBufUtil.getBytes(buf)))); @@ -42,11 +42,11 @@ public class ProtocolUtils { player.connection.send(new ClientboundCustomPayloadPacket(payload)); } - public static void sendEmptyPacket(Context context, ResourceLocation id) { + public static void sendEmptyPacket(Context context, Identifier id) { context.connection().send(new ClientboundCustomPayloadPacket(new DiscardedPayload(id, EMPTY))); } - public static void sendBytebufPacket(@NotNull Context context, ResourceLocation id, Consumer consumer) { + public static void sendBytebufPacket(@NotNull Context context, Identifier id, Consumer consumer) { RegistryFriendlyByteBuf buf = decorate(Unpooled.buffer()); consumer.accept(buf); context.connection().send(new ClientboundCustomPayloadPacket(new DiscardedPayload(id, ByteBufUtil.getBytes(buf)))); diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java index 5960042..8fdd804 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/core/invoker/MinecraftRegisterInvokerHolder.java @@ -1,6 +1,6 @@ package org.leavesmc.leaves.protocol.core.invoker; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.leavesmc.leaves.protocol.core.IdentifierSelector; import org.leavesmc.leaves.protocol.core.LeavesProtocol; import org.leavesmc.leaves.protocol.core.ProtocolHandler; @@ -9,10 +9,10 @@ import java.lang.reflect.Method; public class MinecraftRegisterInvokerHolder extends AbstractInvokerHolder { public MinecraftRegisterInvokerHolder(LeavesProtocol owner, Method invoker, ProtocolHandler.MinecraftRegister handler) { - super(owner, invoker, handler, null, handler.stage().identifier(), ResourceLocation.class); + super(owner, invoker, handler, null, handler.stage().identifier(), Identifier.class); } - public void invoke(IdentifierSelector selector, ResourceLocation id) { + public void invoke(IdentifierSelector selector, Identifier id) { invoke0(false, selector.select(handler.stage()), id); } } diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java index 3d5e053..f11fcd2 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/JadeProtocol.java @@ -5,7 +5,7 @@ import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.core.registries.Registries; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.MinecraftServer; import net.minecraft.server.level.ServerPlayer; import net.minecraft.util.Mth; @@ -14,12 +14,12 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.animal.Animal; -import net.minecraft.world.entity.animal.Chicken; +import net.minecraft.world.entity.animal.chicken.Chicken; import net.minecraft.world.entity.animal.allay.Allay; import net.minecraft.world.entity.animal.armadillo.Armadillo; import net.minecraft.world.entity.animal.frog.Tadpole; import net.minecraft.world.entity.animal.sniffer.Sniffer; -import net.minecraft.world.entity.monster.ZombieVillager; +import net.minecraft.world.entity.monster.zombie.ZombieVillager; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.Items; import net.minecraft.world.level.block.Block; @@ -98,17 +98,17 @@ public class JadeProtocol implements LeavesProtocol { private static final Set enabledPlayers = new HashSet<>(); private static final org.purpurmc.purpur.util.MinecraftInternalPlugin minecraftInternalPlugin = new org.purpurmc.purpur.util.MinecraftInternalPlugin(); - public static PriorityStore priorities; + public static PriorityStore priorities; private static List shearableBlocks = null; @Contract("_ -> new") - public static ResourceLocation id(String path) { - return ResourceLocation.tryBuild(PROTOCOL_ID, path); + public static Identifier id(String path) { + return Identifier.tryBuild(PROTOCOL_ID, path); } @Contract("_ -> new") - public static @NotNull ResourceLocation mc_id(String path) { - return ResourceLocation.withDefaultNamespace(path); + public static @NotNull Identifier mc_id(String path) { + return Identifier.withDefaultNamespace(path); } @ProtocolHandler.Init diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java index 1620d68..6135b7b 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ClientHandshakePayload.java @@ -3,17 +3,17 @@ package org.leavesmc.leaves.protocol.jade.payload; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.leavesmc.leaves.protocol.core.LeavesCustomPayload; import org.leavesmc.leaves.protocol.jade.JadeProtocol; public record ClientHandshakePayload(String protocolVersion) implements LeavesCustomPayload { @ID - private static final ResourceLocation PACKET_CLIENT_HANDSHAKE = JadeProtocol.id("client_handshake"); + private static final Identifier PACKET_CLIENT_HANDSHAKE = JadeProtocol.id("client_handshake"); @Codec private static final StreamCodec CODEC = StreamCodec.composite( ByteBufCodecs.STRING_UTF8, ClientHandshakePayload::protocolVersion, ClientHandshakePayload::new ); -} \ No newline at end of file +} diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java index b2630fc..ba188aa 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/ReceiveDataPayload.java @@ -4,14 +4,14 @@ import net.minecraft.nbt.CompoundTag; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.leavesmc.leaves.protocol.core.LeavesCustomPayload; import org.leavesmc.leaves.protocol.jade.JadeProtocol; public record ReceiveDataPayload(CompoundTag tag) implements LeavesCustomPayload { @ID - private static final ResourceLocation PACKET_RECEIVE_DATA = JadeProtocol.id("receive_data"); + private static final Identifier PACKET_RECEIVE_DATA = JadeProtocol.id("receive_data"); @Codec private static final StreamCodec CODEC = StreamCodec.composite( diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java index 9d32bf2..9b4b5e6 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/payload/RequestBlockPayload.java @@ -4,7 +4,7 @@ import io.netty.buffer.ByteBuf; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.jetbrains.annotations.Nullable; import org.leavesmc.leaves.protocol.core.LeavesCustomPayload; import org.leavesmc.leaves.protocol.jade.JadeProtocol; @@ -20,7 +20,7 @@ import static org.leavesmc.leaves.protocol.jade.JadeProtocol.blockDataProviders; public record RequestBlockPayload(BlockAccessorImpl.SyncData data, List<@Nullable IServerDataProvider> dataProviders) implements LeavesCustomPayload { @ID - private static final ResourceLocation PACKET_REQUEST_BLOCK = JadeProtocol.id("request_block"); + private static final Identifier PACKET_REQUEST_BLOCK = JadeProtocol.id("request_block"); @Codec private static final StreamCodec CODEC = StreamCodec.composite( @@ -32,4 +32,4 @@ public record RequestBlockPayload(BlockAccessorImpl.SyncData data, List<@Nullabl $ -> Objects.requireNonNull(blockDataProviders.idMapper()).getIdOrThrow($))), RequestBlockPayload::dataProviders, RequestBlockPayload::new); -} \ No newline at end of file +} diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java index d62fc8f..58a85e4 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/IJadeProvider.java @@ -1,10 +1,10 @@ package org.leavesmc.leaves.protocol.jade.provider; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; public interface IJadeProvider { - ResourceLocation getUid(); + Identifier getUid(); default int getDefaultPriority() { return 0; diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java index 7d6cd6d..8efbb2c 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/ItemStorageProvider.java @@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.provider; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.LockCode; import net.minecraft.world.RandomizableContainer; import net.minecraft.world.entity.player.Player; @@ -24,9 +24,9 @@ import java.util.Map; public abstract class ItemStorageProvider> implements IServerDataProvider { - private static final StreamCodec>>> STREAM_CODEC = ViewGroup.listCodec(ItemStack.OPTIONAL_STREAM_CODEC); + private static final StreamCodec>>> STREAM_CODEC = ViewGroup.listCodec(ItemStack.OPTIONAL_STREAM_CODEC); - private static final ResourceLocation UNIVERSAL_ITEM_STORAGE = JadeProtocol.mc_id("item_storage"); + private static final Identifier UNIVERSAL_ITEM_STORAGE = JadeProtocol.mc_id("item_storage"); public static ForBlock getBlock() { return ForBlock.INSTANCE; @@ -39,7 +39,7 @@ public abstract class ItemStorageProvider> implements ISer public static void putData(CompoundTag tag, @NotNull Accessor accessor) { Object target = accessor.getTarget(); Player player = accessor.getPlayer(); - Map.Entry>> entry = CommonUtil.getServerExtensionData(accessor, JadeProtocol.itemStorageProviders); + Map.Entry>> entry = CommonUtil.getServerExtensionData(accessor, JadeProtocol.itemStorageProviders); if (entry != null) { List> groups = entry.getValue(); for (ViewGroup group : groups) { @@ -60,7 +60,7 @@ public abstract class ItemStorageProvider> implements ISer } @Override - public ResourceLocation getUid() { + public Identifier getUid() { return UNIVERSAL_ITEM_STORAGE; } @@ -84,4 +84,4 @@ public abstract class ItemStorageProvider> implements ISer public static class ForEntity extends ItemStorageProvider { private static final ForEntity INSTANCE = new ForEntity(); } -} \ No newline at end of file +} diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java index ee92d79..a5100f2 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/BeehiveProvider.java @@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.provider.block; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import org.jetbrains.annotations.NotNull; import org.leavesmc.leaves.protocol.jade.JadeProtocol; @@ -13,7 +13,7 @@ import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider; public enum BeehiveProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_BEEHIVE = JadeProtocol.mc_id("beehive"); + private static final Identifier MC_BEEHIVE = JadeProtocol.mc_id("beehive"); @Override public @NotNull StreamCodec streamCodec() { @@ -28,7 +28,7 @@ public enum BeehiveProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation CORE_OBJECT_NAME = JadeProtocol.id("object_name"); + private static final Identifier CORE_OBJECT_NAME = JadeProtocol.id("object_name"); @Override @Nullable @@ -49,7 +49,7 @@ public enum BlockNameProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_BREWING_STAND = JadeProtocol.mc_id("brewing_stand"); + private static final Identifier MC_BREWING_STAND = JadeProtocol.mc_id("brewing_stand"); @Override public @NotNull Data streamData(@NotNull BlockAccessor accessor) { @@ -28,7 +28,7 @@ public enum BrewingStandProvider implements StreamServerDataProvider { INSTANCE; private static final MapCodec COOKING_TIME_CODEC = Codec.INT.fieldOf("jade:cooking"); - private static final ResourceLocation MC_CAMPFIRE = JadeProtocol.mc_id("campfire"); + private static final Identifier MC_CAMPFIRE = JadeProtocol.mc_id("campfire"); @Override public @Nullable @Unmodifiable List> getGroups(@NotNull Accessor request) { @@ -48,7 +48,7 @@ public enum CampfireProvider implements IServerExtensionProvider { } @Override - public ResourceLocation getUid() { + public Identifier getUid() { return MC_CAMPFIRE; } } diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java index 5f71fad..b4df423 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/block/CommandBlockProvider.java @@ -3,7 +3,7 @@ package org.leavesmc.leaves.protocol.jade.provider.block; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.world.level.block.entity.CommandBlockEntity; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,7 +14,7 @@ import org.leavesmc.leaves.protocol.jade.provider.StreamServerDataProvider; public enum CommandBlockProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_COMMAND_BLOCK = JadeProtocol.mc_id("command_block"); + private static final Identifier MC_COMMAND_BLOCK = JadeProtocol.mc_id("command_block"); @Nullable public String streamData(@NotNull BlockAccessor accessor) { @@ -34,7 +34,7 @@ public enum CommandBlockProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_FURNACE = JadeProtocol.mc_id("furnace"); + private static final Identifier MC_FURNACE = JadeProtocol.mc_id("furnace"); @Override public @NotNull Data streamData(@NotNull BlockAccessor accessor) { @@ -34,7 +34,7 @@ public enum FurnaceProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_HOPPER_LOCK = JadeProtocol.mc_id("hopper_lock"); + private static final Identifier MC_HOPPER_LOCK = JadeProtocol.mc_id("hopper_lock"); @Override public Boolean streamData(@NotNull BlockAccessor accessor) { @@ -26,7 +26,7 @@ public enum HopperLockProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_JUKEBOX = JadeProtocol.mc_id("jukebox"); + private static final Identifier MC_JUKEBOX = JadeProtocol.mc_id("jukebox"); @Override public @NotNull ItemStack streamData(BlockAccessor accessor) { @@ -26,7 +26,7 @@ public enum JukeboxProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_LECTERN = JadeProtocol.mc_id("lectern"); + private static final Identifier MC_LECTERN = JadeProtocol.mc_id("lectern"); @Override public @NotNull ItemStack streamData(@NotNull BlockAccessor accessor) { @@ -27,7 +27,7 @@ public enum LecternProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_MOB_SPAWNER_COOLDOWN = JadeProtocol.mc_id("mob_spawner.cooldown"); + private static final Identifier MC_MOB_SPAWNER_COOLDOWN = JadeProtocol.mc_id("mob_spawner.cooldown"); @Override public @Nullable Integer streamData(@NotNull BlockAccessor accessor) { @@ -36,7 +36,7 @@ public enum MobSpawnerCooldownProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_REDSTONE = JadeProtocol.mc_id("redstone"); + private static final Identifier MC_REDSTONE = JadeProtocol.mc_id("redstone"); @Override public void appendServerData(CompoundTag data, @NotNull BlockAccessor accessor) { @@ -30,7 +30,7 @@ public enum RedstoneProvider implements IServerDataProvider { } @Override - public ResourceLocation getUid() { + public Identifier getUid() { return MC_REDSTONE; } } diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java index 2f6bb86..3bf3440 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/provider/entity/AnimalOwnerProvider.java @@ -5,7 +5,7 @@ import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.chat.Component; import net.minecraft.network.chat.ComponentSerialization; import net.minecraft.network.codec.StreamCodec; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.Services; import net.minecraft.server.level.ServerLevel; import net.minecraft.server.players.NameAndId; @@ -24,7 +24,7 @@ import java.util.UUID; public enum AnimalOwnerProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_ANIMAL_OWNER = JadeProtocol.mc_id("animal_owner"); + private static final Identifier MC_ANIMAL_OWNER = JadeProtocol.mc_id("animal_owner"); public static UUID getOwnerUUID(Entity entity) { if (entity instanceof OwnableEntity ownableEntity) { @@ -67,7 +67,7 @@ public enum AnimalOwnerProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_MOB_BREEDING = JadeProtocol.mc_id("mob_breeding"); + private static final Identifier MC_MOB_BREEDING = JadeProtocol.mc_id("mob_breeding"); @Override public @Nullable Integer streamData(@NotNull EntityAccessor accessor) { @@ -38,7 +38,7 @@ public enum MobBreedingProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_MOB_GROWTH = JadeProtocol.mc_id("mob_growth"); + private static final Identifier MC_MOB_GROWTH = JadeProtocol.mc_id("mob_growth"); @Override public @Nullable Integer streamData(@NotNull EntityAccessor accessor) { @@ -37,7 +37,7 @@ public enum MobGrowthProvider implements StreamServerDataProvider { INSTANCE; - private static final ResourceLocation MC_NEXT_ENTITY_DROP = JadeProtocol.mc_id("next_entity_drop"); + private static final Identifier MC_NEXT_ENTITY_DROP = JadeProtocol.mc_id("next_entity_drop"); @Override public void appendServerData(CompoundTag tag, @NotNull EntityAccessor accessor) { @@ -36,7 +36,7 @@ public enum NextEntityDropProvider implements IServerDataProvider { INSTANCE; - private static final ResourceLocation MC_PET_ARMOR = JadeProtocol.mc_id("pet_armor"); + private static final Identifier MC_PET_ARMOR = JadeProtocol.mc_id("pet_armor"); @Nullable @Override @@ -29,7 +29,7 @@ public enum PetArmorProvider implements StreamServerDataProvider implements IHierarchyLooku } @Override - public void loadComplete(PriorityStore priorityStore) { + public void loadComplete(PriorityStore priorityStore) { objects.asMap().forEach((clazz, list) -> { if (list.size() < 2) { return; } - Set set = Sets.newHashSetWithExpectedSize(list.size()); + Set set = Sets.newHashSetWithExpectedSize(list.size()); for (T provider : list) { if (set.contains(provider.getUid())) { throw new IllegalStateException("Duplicate UID: %s for %s".formatted(provider.getUid(), list.stream() @@ -135,4 +135,4 @@ public class HierarchyLookup implements IHierarchyLooku idMapper = createIdMapper(); } } -} \ No newline at end of file +} diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java index c160eaa..1dad63e 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/IHierarchyLookup.java @@ -2,7 +2,7 @@ package org.leavesmc.leaves.protocol.jade.util; import com.google.common.collect.Streams; import net.minecraft.core.IdMapper; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.jetbrains.annotations.Nullable; import org.leavesmc.leaves.protocol.jade.JadeProtocol; import org.leavesmc.leaves.protocol.jade.provider.IJadeProvider; @@ -27,7 +27,7 @@ public interface IHierarchyLookup { @Nullable IdMapper idMapper(); - default List mappedIds() { + default List mappedIds() { return Streams.stream(Objects.requireNonNull(idMapper())) .map(IJadeProvider::getUid) .toList(); @@ -52,7 +52,7 @@ public interface IHierarchyLookup { void invalidate(); - void loadComplete(PriorityStore priorityStore); + void loadComplete(PriorityStore priorityStore); default IdMapper createIdMapper() { List list = entries().flatMap(entry -> entry.getValue().stream()).toList(); diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java index 9e0dd9c..b0dfd76 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/jade/util/PairHierarchyLookup.java @@ -5,7 +5,7 @@ import com.google.common.cache.CacheBuilder; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import net.minecraft.core.IdMapper; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import org.apache.commons.lang3.tuple.Pair; import org.jetbrains.annotations.Nullable; import org.leavesmc.leaves.LeavesLogger; @@ -105,11 +105,11 @@ public class PairHierarchyLookup implements IHierarchyL } @Override - public void loadComplete(PriorityStore priorityStore) { + public void loadComplete(PriorityStore priorityStore) { first.loadComplete(priorityStore); second.loadComplete(priorityStore); if (idMapped) { idMapper = createIdMapper(); } } -} \ No newline at end of file +} diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java index 0f45ef7..a2d6d26 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/Exchange.java @@ -1,14 +1,14 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; public interface Exchange { ExchangeTarget getPartner(); - boolean checkPacket(ResourceLocation id, FriendlyByteBuf packetBuf); + boolean checkPacket(Identifier id, FriendlyByteBuf packetBuf); - void handle(ResourceLocation id, FriendlyByteBuf packetBuf); + void handle(Identifier id, FriendlyByteBuf packetBuf); boolean isFinished(); diff --git a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java index b0da7ab..34217f8 100644 --- a/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java +++ b/divinemc-server/src/main/java/org/leavesmc/leaves/protocol/syncmatica/exchange/ExchangeTarget.java @@ -1,7 +1,7 @@ package org.leavesmc.leaves.protocol.syncmatica.exchange; import net.minecraft.network.FriendlyByteBuf; -import net.minecraft.resources.ResourceLocation; +import net.minecraft.resources.Identifier; import net.minecraft.server.network.ServerGamePacketListenerImpl; import org.leavesmc.leaves.protocol.core.ProtocolUtils; import org.leavesmc.leaves.protocol.syncmatica.FeatureSet; @@ -21,7 +21,7 @@ public class ExchangeTarget { this.client = client; } - public void sendPacket(final ResourceLocation id, final FriendlyByteBuf packetBuf) { + public void sendPacket(final Identifier id, final FriendlyByteBuf packetBuf) { ProtocolUtils.sendPayloadPacket(client.player, new SyncmaticaPayload(id, packetBuf)); } diff --git a/gradle.properties b/gradle.properties index 7e9cd08..0631441 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,8 @@ group = org.bxteam.divinemc version=1.21.11-rc3-R0.1-SNAPSHOT mcVersion=1.21.11-rc3 -purpurRef=c51992977fc626e2019cb8ca4194507536754cbc +apiVersion=1.21.11 +purpurRef=4db5f6cb4e8562a69e9f41d882cd111220a0f6e2 experimental=true org.gradle.configuration-cache=true