diff --git a/patches/server/0060-Moonrise-Bitstorage-optimisations.patch b/patches/removed/server/0060-Moonrise-Bitstorage-optimisations.patch similarity index 99% rename from patches/server/0060-Moonrise-Bitstorage-optimisations.patch rename to patches/removed/server/0060-Moonrise-Bitstorage-optimisations.patch index 817026cb1..e6db553a8 100644 --- a/patches/server/0060-Moonrise-Bitstorage-optimisations.patch +++ b/patches/removed/server/0060-Moonrise-Bitstorage-optimisations.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Wed, 22 May 2024 14:14:30 -0700 Subject: [PATCH] Moonrise: Bitstorage optimisations +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: https://github.com/Tuinity/Moonrise diff --git a/patches/server/0062-Moonrise-block-counting-optimisations.patch b/patches/removed/server/0062-Moonrise-block-counting-optimisations.patch similarity index 99% rename from patches/server/0062-Moonrise-block-counting-optimisations.patch rename to patches/removed/server/0062-Moonrise-block-counting-optimisations.patch index 001630122..648da5ec3 100644 --- a/patches/server/0062-Moonrise-block-counting-optimisations.patch +++ b/patches/removed/server/0062-Moonrise-block-counting-optimisations.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Tue, 13 Aug 2024 23:53:27 -0700 Subject: [PATCH] Moonrise: block counting optimisations +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: - https://github.com/Tuinity/Moonrise diff --git a/patches/server/0063-Moonrise-Optimise-BiomeManager-getFiddle.patch b/patches/removed/server/0063-Moonrise-Optimise-BiomeManager-getFiddle.patch similarity index 97% rename from patches/server/0063-Moonrise-Optimise-BiomeManager-getFiddle.patch rename to patches/removed/server/0063-Moonrise-Optimise-BiomeManager-getFiddle.patch index d8aca299d..1fdb7208b 100644 --- a/patches/server/0063-Moonrise-Optimise-BiomeManager-getFiddle.patch +++ b/patches/removed/server/0063-Moonrise-Optimise-BiomeManager-getFiddle.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Wed, 14 Aug 2024 17:52:47 -0700 Subject: [PATCH] Moonrise: Optimise BiomeManager#getFiddle +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: https://github.com/Tuinity/Moonrise diff --git a/patches/server/0064-Moonrise-Do-not-send-chunk-radius-packet-from-Player.patch b/patches/removed/server/0064-Moonrise-Do-not-send-chunk-radius-packet-from-Player.patch similarity index 98% rename from patches/server/0064-Moonrise-Do-not-send-chunk-radius-packet-from-Player.patch rename to patches/removed/server/0064-Moonrise-Do-not-send-chunk-radius-packet-from-Player.patch index 5fc3ce675..80cfa554a 100644 --- a/patches/server/0064-Moonrise-Do-not-send-chunk-radius-packet-from-Player.patch +++ b/patches/removed/server/0064-Moonrise-Do-not-send-chunk-radius-packet-from-Player.patch @@ -4,6 +4,8 @@ Date: Mon, 2 Sep 2024 16:36:20 -0700 Subject: [PATCH] Moonrise: Do not send chunk radius packet from PlayerList#setViewDistance +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: https://github.com/Tuinity/Moonrise diff --git a/patches/server/0065-Moonrise-Add-direct-lookup-by-chunk-for-NearbyPlayer.patch b/patches/removed/server/0065-Moonrise-Add-direct-lookup-by-chunk-for-NearbyPlayer.patch similarity index 99% rename from patches/server/0065-Moonrise-Add-direct-lookup-by-chunk-for-NearbyPlayer.patch rename to patches/removed/server/0065-Moonrise-Add-direct-lookup-by-chunk-for-NearbyPlayer.patch index ff5f5b520..dc7e616c5 100644 --- a/patches/server/0065-Moonrise-Add-direct-lookup-by-chunk-for-NearbyPlayer.patch +++ b/patches/removed/server/0065-Moonrise-Add-direct-lookup-by-chunk-for-NearbyPlayer.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Wed, 4 Sep 2024 11:25:19 -0700 Subject: [PATCH] Moonrise: Add direct lookup by chunk for NearbyPlayers +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: https://github.com/Tuinity/Moonrise diff --git a/patches/server/0068-Moonrise-Optimise-countEntries-for-low-size-SimpleBi.patch b/patches/removed/server/0068-Moonrise-Optimise-countEntries-for-low-size-SimpleBi.patch similarity index 98% rename from patches/server/0068-Moonrise-Optimise-countEntries-for-low-size-SimpleBi.patch rename to patches/removed/server/0068-Moonrise-Optimise-countEntries-for-low-size-SimpleBi.patch index fb8b0add9..987053973 100644 --- a/patches/server/0068-Moonrise-Optimise-countEntries-for-low-size-SimpleBi.patch +++ b/patches/removed/server/0068-Moonrise-Optimise-countEntries-for-low-size-SimpleBi.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Tue, 17 Sep 2024 16:29:23 -0700 Subject: [PATCH] Moonrise: Optimise countEntries for low size SimpleBitStorage +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: - https://github.com/Tuinity/Moonrise diff --git a/patches/server/0069-Moonrise-fluid-method-optimisations.patch b/patches/removed/server/0069-Moonrise-fluid-method-optimisations.patch similarity index 99% rename from patches/server/0069-Moonrise-fluid-method-optimisations.patch rename to patches/removed/server/0069-Moonrise-fluid-method-optimisations.patch index eccbba18f..6800b7173 100644 --- a/patches/server/0069-Moonrise-fluid-method-optimisations.patch +++ b/patches/removed/server/0069-Moonrise-fluid-method-optimisations.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Thu, 24 Oct 2024 08:20:45 -0700 Subject: [PATCH] Moonrise: fluid method optimisations +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: - https://github.com/Tuinity/Moonrise diff --git a/patches/server/0070-Moonrise-optimise-palette-reads.patch b/patches/removed/server/0070-Moonrise-optimise-palette-reads.patch similarity index 99% rename from patches/server/0070-Moonrise-optimise-palette-reads.patch rename to patches/removed/server/0070-Moonrise-optimise-palette-reads.patch index b35af3faa..a09ca21e5 100644 --- a/patches/server/0070-Moonrise-optimise-palette-reads.patch +++ b/patches/removed/server/0070-Moonrise-optimise-palette-reads.patch @@ -3,6 +3,8 @@ From: Spottedleaf Date: Thu, 24 Oct 2024 08:20:45 -0700 Subject: [PATCH] Moonrise: optimise palette reads +Removed since Leaf 1.21.3, Paper 1.21.3 included it + Original license: GPLv3 Original project: - https://github.com/Tuinity/Moonrise diff --git a/patches/server/0090-Remove-stream-in-RecipeManager-getRecipeFor.patch b/patches/removed/server/0090-Remove-stream-in-RecipeManager-getRecipeFor.patch similarity index 94% rename from patches/server/0090-Remove-stream-in-RecipeManager-getRecipeFor.patch rename to patches/removed/server/0090-Remove-stream-in-RecipeManager-getRecipeFor.patch index 8af10912d..5d1cade4f 100644 --- a/patches/server/0090-Remove-stream-in-RecipeManager-getRecipeFor.patch +++ b/patches/removed/server/0090-Remove-stream-in-RecipeManager-getRecipeFor.patch @@ -3,6 +3,7 @@ From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Fri, 23 Aug 2024 20:22:00 -0400 Subject: [PATCH] Remove stream in RecipeManager getRecipeFor +Removed since Leaf 1.21.3, Merged & moved to Carpet-Fixes-Use-optimized-RecipeManager.patch diff --git a/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java b/src/main/java/net/minecraft/world/item/crafting/RecipeManager.java index febf87b14125925f548393360e89077329a6c522..de7537c4eacf6fa549f74fd329102a2e4865194a 100644 diff --git a/patches/server/0025-Akarin-Save-Json-list-asynchronously.patch b/patches/server/0024-Akarin-Save-Json-list-asynchronously.patch similarity index 100% rename from patches/server/0025-Akarin-Save-Json-list-asynchronously.patch rename to patches/server/0024-Akarin-Save-Json-list-asynchronously.patch diff --git a/patches/server/0026-Slice-Smooth-Teleports.patch b/patches/server/0025-Slice-Smooth-Teleports.patch similarity index 100% rename from patches/server/0026-Slice-Smooth-Teleports.patch rename to patches/server/0025-Slice-Smooth-Teleports.patch diff --git a/patches/server/0027-Parchment-Make-FixLight-use-action-bar.patch b/patches/server/0026-Parchment-Make-FixLight-use-action-bar.patch similarity index 100% rename from patches/server/0027-Parchment-Make-FixLight-use-action-bar.patch rename to patches/server/0026-Parchment-Make-FixLight-use-action-bar.patch diff --git a/patches/server/0028-Leaves-Server-Utils.patch b/patches/server/0027-Leaves-Server-Utils.patch similarity index 100% rename from patches/server/0028-Leaves-Server-Utils.patch rename to patches/server/0027-Leaves-Server-Utils.patch diff --git a/patches/server/0029-Leaves-Protocol-Core.patch b/patches/server/0028-Leaves-Protocol-Core.patch similarity index 100% rename from patches/server/0029-Leaves-Protocol-Core.patch rename to patches/server/0028-Leaves-Protocol-Core.patch diff --git a/patches/server/0030-Leaves-Jade-Protocol.patch b/patches/server/0029-Leaves-Jade-Protocol.patch similarity index 100% rename from patches/server/0030-Leaves-Jade-Protocol.patch rename to patches/server/0029-Leaves-Jade-Protocol.patch diff --git a/patches/server/0031-Leaves-Appleskin-Protocol.patch b/patches/server/0030-Leaves-Appleskin-Protocol.patch similarity index 100% rename from patches/server/0031-Leaves-Appleskin-Protocol.patch rename to patches/server/0030-Leaves-Appleskin-Protocol.patch diff --git a/patches/server/0032-Leaves-Xaero-Map-Protocol.patch b/patches/server/0031-Leaves-Xaero-Map-Protocol.patch similarity index 100% rename from patches/server/0032-Leaves-Xaero-Map-Protocol.patch rename to patches/server/0031-Leaves-Xaero-Map-Protocol.patch diff --git a/patches/server/0033-Leaves-Syncmatica-Protocol.patch b/patches/server/0032-Leaves-Syncmatica-Protocol.patch similarity index 100% rename from patches/server/0033-Leaves-Syncmatica-Protocol.patch rename to patches/server/0032-Leaves-Syncmatica-Protocol.patch diff --git a/patches/server/0034-Chat-Image-protocol.patch b/patches/server/0033-Chat-Image-protocol.patch similarity index 100% rename from patches/server/0034-Chat-Image-protocol.patch rename to patches/server/0033-Chat-Image-protocol.patch diff --git a/patches/server/0035-Asteor-Bar-protocol.patch b/patches/server/0034-Asteor-Bar-protocol.patch similarity index 100% rename from patches/server/0035-Asteor-Bar-protocol.patch rename to patches/server/0034-Asteor-Bar-protocol.patch diff --git a/patches/server/0037-Leaves-Replay-Mod-API.patch b/patches/server/0035-Leaves-Replay-Mod-API.patch similarity index 91% rename from patches/server/0037-Leaves-Replay-Mod-API.patch rename to patches/server/0035-Leaves-Replay-Mod-API.patch index 422f8782c..6690460b8 100644 --- a/patches/server/0037-Leaves-Replay-Mod-API.patch +++ b/patches/server/0035-Leaves-Replay-Mod-API.patch @@ -116,20 +116,20 @@ index b455c7e9d18bac3654daa8510f85cc21202e254b..1f8d52ee2ad0463b8cb1072190f836ea if (((List) object).size() >= i) { return (List) object; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index bc4f50c55741c2a664f456a3b7555644ad224d53..7c8d28fe612ef2e37d5d02d449946dce2bb7d524 100644 +index f52eb8f076a007167647e49db2734cd43f88b0b6..2d231c01fe752d3a97965a0bef01e7c0f6cb1611 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1710,7 +1710,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop list = this.playerList.getPlayers(); -+ List list = this.playerList.realPlayers; // Leaves - skip ++ List list = this.playerList.realPlayers; // Leaves - only real player int i = this.getMaxPlayers(); if (this.hidesOnlinePlayers()) { diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index e06e4600066bab6a747d8ddd10cf6b51da82f521..6fd6afe9d6cf9076bf3c3ee224fe805f97f96c2d 100644 +index 67f7c397328c8fbdbd30e1f3b94821a785ff1036..d92fa5893fa030cedf63cab9cc5f2b941af02290 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -222,6 +222,11 @@ public class PlayerAdvancements { @@ -158,10 +158,10 @@ index e7b444a10b244828827b3c66c53465206ea8e0ec..47c0f4eec739c41b81a546dac97569c8 .filter(player -> !playerList.isOp(player.getGameProfile())) .map(player -> player.getGameProfile().getName()), diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 70b247cd559cb9814fbf8e3ab7839a40488dbef1..991859906cf1278663ba75bf0992f002e056b244 100644 +index e7e5dfcf465a5497d8f5ff5a06b479c495f28ef0..c8c777bc19e21fbf82b3a7e68d0e9753be7d41d3 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -230,6 +230,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -232,6 +232,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 @@ -169,15 +169,15 @@ index 70b247cd559cb9814fbf8e3ab7839a40488dbef1..991859906cf1278663ba75bf0992f002 public LevelChunk getChunkIfLoaded(int x, int z) { return this.chunkSource.getChunkAtIfLoadedImmediately(x, z); // Paper - Use getChunkIfLoadedImmediately -@@ -610,6 +611,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. - this.chunkTaskScheduler = new ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkTaskScheduler((ServerLevel)(Object)this, ca.spottedleaf.moonrise.common.util.MoonriseCommon.WORKER_POOL); +@@ -695,6 +696,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // Paper end - rewrite chunk system this.getCraftServer().addWorld(this.getWorld()); // CraftBukkit -+ this.realPlayers = Lists.newArrayList(); // Leaves - skip this.preciseTime = this.serverLevelData.getDayTime(); // Purpur ++ this.realPlayers = Lists.newArrayList(); // Leaves - skip } -@@ -2547,6 +2549,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. + // Paper start +@@ -2740,6 +2742,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe // ServerLevel.this.getChunkSource().addEntity(entity); // Paper - ignore and warn about illegal addEntity calls instead of crashing server; moved down below valid=true if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.add(entityplayer); @@ -189,7 +189,7 @@ index 70b247cd559cb9814fbf8e3ab7839a40488dbef1..991859906cf1278663ba75bf0992f002 ServerLevel.this.updateSleepingPlayerList(); } -@@ -2628,6 +2635,11 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -2821,6 +2828,11 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe ServerLevel.this.getChunkSource().removeEntity(entity); if (entity instanceof ServerPlayer entityplayer) { ServerLevel.this.players.remove(entityplayer); @@ -202,23 +202,23 @@ index 70b247cd559cb9814fbf8e3ab7839a40488dbef1..991859906cf1278663ba75bf0992f002 } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index b2ae3fdf128e7d66e3f3430266321a6a09fa0be6..7c6bda95b8b08cc70182f19cf0b991f78d28c235 100644 +index 35a73243ce9a27af0c12ef7fb8b1a183f3efaaa5..df6f21a7cc2be3e006814896c4a80ad53f9b02f5 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -425,7 +425,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple - public void dataChanged(AbstractContainerMenu handler, int property, int value) {} - }; - this.textFilter = server.createTextFilterForPlayer(this); -- this.gameMode = server.createGameModeForPlayer(this); -+ this.gameMode = this instanceof org.leavesmc.leaves.replay.ServerPhotographer ? new org.leavesmc.leaves.replay.ServerPhotographerGameMode((org.leavesmc.leaves.replay.ServerPhotographer) this) : server.createGameModeForPlayer(this); // Leaves - replay mod api - this.server = server; - this.stats = server.getPlayerList().getPlayerStats(this); - this.advancements = server.getPlayerList().getPlayerAdvancements(this); +@@ -232,7 +232,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple + private static final AttributeModifier CREATIVE_ENTITY_INTERACTION_RANGE_MODIFIER = new AttributeModifier(ResourceLocation.withDefaultNamespace("creative_mode_entity_range"), 2.0D, AttributeModifier.Operation.ADD_VALUE); + public ServerGamePacketListenerImpl connection; + public final MinecraftServer server; +- public final ServerPlayerGameMode gameMode; ++ public ServerPlayerGameMode gameMode; // Leaves - final -> null + private final PlayerAdvancements advancements; + private final ServerStatsCounter stats; + private float lastRecordedHealthAndAbsorption = Float.MIN_VALUE; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df8fbd6d17 100644 +index 243d5f479a11d9cbc867f034f9fa55ff7e27fb92..a4e8aaf7f35cb1277fc24c4cd240f224e4eedea3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -155,6 +155,7 @@ public abstract class PlayerList { +@@ -156,6 +156,7 @@ public abstract class PlayerList { private boolean allowCommandsForAllPlayers; private static final boolean ALLOW_LOGOUTIVATOR = false; private int sendAllPlayerInfoIn; @@ -226,7 +226,7 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df // CraftBukkit start private CraftServer cserver; -@@ -181,6 +182,105 @@ public abstract class PlayerList { +@@ -182,6 +183,105 @@ public abstract class PlayerList { } abstract public void loadAndSaveFiles(); // Paper - fix converting txt to json file; moved from DedicatedPlayerList constructor @@ -254,8 +254,9 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df + player.getBukkitEntity().sendSupportedChannels(); // CraftBukkit + playerconnection.send(new ClientboundChangeDifficultyPacket(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); + playerconnection.send(new ClientboundPlayerAbilitiesPacket(player.getAbilities())); -+ playerconnection.send(new ClientboundSetCarriedItemPacket(player.getInventory().selected)); -+ playerconnection.send(new ClientboundUpdateRecipesPacket(this.server.getRecipeManager().getRecipes())); ++ playerconnection.send(new ClientboundSetHeldSlotPacket(player.getInventory().selected)); ++ RecipeManager craftingmanager = this.server.getRecipeManager(); ++ playerconnection.send(new ClientboundUpdateRecipesPacket(craftingmanager.getSynchronizedItemProperties(), craftingmanager.getSynchronizedStonecutterRecipes())); + this.sendPlayerPermissionLevel(player); + player.getStats().markAllDirty(); + player.getRecipeBook().sendInitialRecipeBook(player); @@ -276,7 +277,6 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df + player.supressTrackerForLogin = true; + worldserver1.addNewPlayer(player); + this.server.getCustomBossEvents().onPlayerConnect(player); -+ mountSavedVehicle(player, worldserver1, Optional.empty()); + CraftPlayer bukkitPlayer = player.getBukkitEntity(); + + player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); @@ -312,18 +312,18 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df + } + + worldserver1 = player.serverLevel(); -+ Iterator iterator = player.getActiveEffects().iterator(); ++ Iterator iterator = player.getActiveEffects().iterator(); + while (iterator.hasNext()) { -+ MobEffectInstance mobeffect = (MobEffectInstance) iterator.next(); ++ MobEffectInstance mobeffect = iterator.next(); + playerconnection.send(new ClientboundUpdateMobEffectPacket(player.getId(), mobeffect, false)); + } + + if (player.isDeadOrDying()) { -+ net.minecraft.core.Holder plains = worldserver1.registryAccess().registryOrThrow(net.minecraft.core.registries.Registries.BIOME) -+ .getHolderOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); ++ net.minecraft.core.Holder plains = worldserver1.registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.BIOME) ++ .getOrThrow(net.minecraft.world.level.biome.Biomes.PLAINS); + player.connection.send(new net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket( + new net.minecraft.world.level.chunk.EmptyLevelChunk(worldserver1, player.chunkPosition(), plains), -+ worldserver1.getLightEngine(), (java.util.BitSet)null, (java.util.BitSet) null, false) ++ worldserver1.getLightEngine(), null, null, false) + ); + } + } @@ -332,7 +332,7 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df public void placeNewPlayer(Connection connection, ServerPlayer player, CommonListenerCookie clientData) { player.isRealPlayer = true; // Paper player.loginTime = System.currentTimeMillis(); // Paper - Replace OfflinePlayer#getLastPlayed -@@ -334,6 +434,7 @@ public abstract class PlayerList { +@@ -337,6 +437,7 @@ public abstract class PlayerList { // entityplayer.connection.send(ClientboundPlayerInfoUpdatePacket.createPlayerInitializing(this.players)); // CraftBukkit - replaced with loop below this.players.add(player); @@ -340,7 +340,7 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df this.addToSendAllPlayerInfoBuckets(player); // Gale - Purpur - spread out sending all player info this.playersByName.put(player.getScoreboardName().toLowerCase(java.util.Locale.ROOT), player); // Spigot this.playersByUUID.put(player.getUUID(), player); -@@ -393,6 +494,12 @@ public abstract class PlayerList { +@@ -397,6 +498,12 @@ public abstract class PlayerList { continue; } @@ -353,7 +353,7 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df onlinePlayers.add(entityplayer1); // Paper - Use single player info update packet on join } // Paper start - Use single player info update packet on join -@@ -604,6 +711,43 @@ public abstract class PlayerList { +@@ -554,6 +661,43 @@ public abstract class PlayerList { } @@ -397,7 +397,7 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df public net.kyori.adventure.text.Component remove(ServerPlayer entityplayer) { // CraftBukkit - return string // Paper - return Component // Paper start - Fix kick event leave message not being sent return this.remove(entityplayer, net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? entityplayer.getBukkitEntity().displayName() : io.papermc.paper.adventure.PaperAdventure.asAdventure(entityplayer.getDisplayName()))); -@@ -673,6 +817,7 @@ public abstract class PlayerList { +@@ -637,6 +781,7 @@ public abstract class PlayerList { entityplayer.retireScheduler(); // Paper - Folia schedulers entityplayer.getAdvancements().stopListening(); this.players.remove(entityplayer); @@ -405,20 +405,20 @@ index 135a53742607dfccff17aa86f80f106b4a31f6b0..94b43be23f1b6498a09e9c45d2ec02df this.removeFromSendAllPlayerInfoBuckets(entityplayer); // Gale - Purpur - spread out sending all player info this.playersByName.remove(entityplayer.getScoreboardName().toLowerCase(java.util.Locale.ROOT)); // Spigot this.server.getCustomBossEvents().onPlayerDisconnect(entityplayer); -@@ -768,7 +913,7 @@ public abstract class PlayerList { +@@ -732,7 +877,7 @@ public abstract class PlayerList { event.disallow(PlayerLoginEvent.Result.KICK_BANNED, io.papermc.paper.adventure.PaperAdventure.asAdventure(ichatmutablecomponent)); // Paper - Adventure } else { // return this.players.size() >= this.maxPlayers && !this.canBypassPlayerLimit(gameprofile) ? IChatBaseComponent.translatable("multiplayer.disconnect.server_full") : null; - if (this.players.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur -+ if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur // Leaves - skip ++ if (this.realPlayers.size() >= this.maxPlayers && !(player.hasPermission("purpur.joinfullserver") || this.canBypassPlayerLimit(gameprofile))) { // Purpur // Leaves - only real player event.disallow(PlayerLoginEvent.Result.KICK_FULL, net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer.legacySection().deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure } } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index b3cf26055a85aefe0ef19a843733b6dfe93d2641..31d0618a9e6495be579ef039288d9accdce05299 100644 +index 073ad95dc56f3b8d35913058a8eddcd610997124..b8a288da456c9cac7fd038f50c68548a0bb7b222 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -317,6 +317,8 @@ public final class CraftServer implements Server { +@@ -320,6 +320,8 @@ public final class CraftServer implements Server { private final io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler asyncScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaAsyncScheduler(); private final io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler globalRegionScheduler = new io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler(); @@ -427,16 +427,16 @@ index b3cf26055a85aefe0ef19a843733b6dfe93d2641..31d0618a9e6495be579ef039288d9acc @Override public final io.papermc.paper.threadedregions.scheduler.RegionScheduler getRegionScheduler() { return this.regionizedScheduler; -@@ -393,7 +395,7 @@ public final class CraftServer implements Server { +@@ -408,7 +410,7 @@ public final class CraftServer implements Server { public CraftServer(DedicatedServer console, PlayerList playerList) { this.console = console; this.playerList = (DedicatedPlayerList) playerList; - this.playerView = Collections.unmodifiableList(Lists.transform(playerList.players, new Function() { -+ this.playerView = Collections.unmodifiableList(Lists.transform(playerList.realPlayers, new Function() { // Leaves - skip ++ this.playerView = Collections.unmodifiableList(Lists.transform(playerList.realPlayers, new Function() { // Leaves - replay api @Override public CraftPlayer apply(ServerPlayer player) { return player.getBukkitEntity(); -@@ -3374,4 +3376,11 @@ public final class CraftServer implements Server { +@@ -3431,4 +3433,11 @@ public final class CraftServer implements Server { return getServer().lagging; } // Purpur end @@ -449,10 +449,10 @@ index b3cf26055a85aefe0ef19a843733b6dfe93d2641..31d0618a9e6495be579ef039288d9acc + // Leaves end - replay mod api } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 770606c4462d85d116f6d0bf91192dc49f438d0f..4317420bd5d3fc8e20ffd7f3a3d48c5a2a83672c 100644 +index 51aee9a468f4ebfa9672fd9ce84883cf080859e3..80ff6427fd944280c7cc28c287332ed6dfccafdb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -111,6 +111,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -112,6 +112,8 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return new CraftHumanEntity(server, (net.minecraft.world.entity.player.Player) entity); } @@ -462,10 +462,10 @@ index 770606c4462d85d116f6d0bf91192dc49f438d0f..4317420bd5d3fc8e20ffd7f3a3d48c5a if (entity instanceof EnderDragonPart complexPart) { if (complexPart.parentMob instanceof EnderDragon) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 75f1e56281014a8fc7e682478307d8f40ad4bdcc..8addddffe97751524f265241ac644a9291405c42 100644 +index 414e30430eb7bcb935ef2cc038fcb7c27747bdd4..4129d894d6604f3b2495a35ad2d026c462f68567 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -2273,7 +2273,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2285,7 +2285,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public boolean canSee(Player player) { @@ -601,15 +601,14 @@ index 0000000000000000000000000000000000000000..23c2f699f3ae12d1a36efc7860e869fa \ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java b/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java new file mode 100644 -index 0000000000000000000000000000000000000000..b1bbe2127a8673c4ca82473e11c9c0130a037d64 +index 0000000000000000000000000000000000000000..e87d1e72902207dbcea67e8300c7375aa9161269 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/entity/CraftPhotographerManager.java -@@ -0,0 +1,83 @@ +@@ -0,0 +1,82 @@ +package org.leavesmc.leaves.entity; + +import com.google.common.collect.Lists; +import org.bukkit.Location; -+import org.bukkit.util.Consumer; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.leavesmc.leaves.replay.BukkitRecorderOption; @@ -688,7 +687,6 @@ index 0000000000000000000000000000000000000000..b1bbe2127a8673c4ca82473e11c9c013 + return photographerViews; + } +} -\ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java b/src/main/java/org/leavesmc/leaves/replay/DigestOutputStream.java new file mode 100644 index 0000000000000000000000000000000000000000..ffb753377aea3a2c9fd653da8245d5e733fee0cf @@ -774,10 +772,10 @@ index 0000000000000000000000000000000000000000..f6b9d5d47dd957d30f725c2daad59622 \ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/Recorder.java b/src/main/java/org/leavesmc/leaves/replay/Recorder.java new file mode 100644 -index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec0402eaee53 +index 0000000000000000000000000000000000000000..d1fb2f08f2d357c6551de7832eb3cf6980d44fb5 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/replay/Recorder.java -@@ -0,0 +1,288 @@ +@@ -0,0 +1,285 @@ +package org.leavesmc.leaves.replay; + +import com.mojang.serialization.DynamicOps; @@ -796,6 +794,7 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 +import net.minecraft.network.protocol.common.ClientboundCustomPayloadPacket; +import net.minecraft.network.protocol.common.ClientboundDisconnectPacket; +import net.minecraft.network.protocol.common.ClientboundResourcePackPushPacket; ++import net.minecraft.network.protocol.common.ClientboundServerLinksPacket; +import net.minecraft.network.protocol.common.ClientboundUpdateTagsPacket; +import net.minecraft.network.protocol.common.custom.BrandPayload; +import net.minecraft.network.protocol.configuration.ClientboundFinishConfigurationPacket; @@ -807,7 +806,7 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 +import net.minecraft.network.protocol.game.ClientboundPlayerChatPacket; +import net.minecraft.network.protocol.game.ClientboundSetTimePacket; +import net.minecraft.network.protocol.game.ClientboundSystemChatPacket; -+import net.minecraft.network.protocol.login.ClientboundGameProfilePacket; ++import net.minecraft.network.protocol.login.ClientboundLoginFinishedPacket; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.RegistryLayer; +import net.minecraft.server.packs.repository.KnownPack; @@ -867,13 +866,12 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 + + metaData.singleplayer = false; + metaData.serverName = recorderOption.serverName; -+ metaData.generator = "leaves"; + metaData.date = startTime; + metaData.mcversion = SharedConstants.getCurrentVersion().getName(); + + // TODO start event -+ savePacket(new ClientboundGameProfilePacket(photographer.getGameProfile(), true), ConnectionProtocol.LOGIN); -+ startConfiguration(); ++ this.savePacket(new ClientboundLoginFinishedPacket(photographer.getGameProfile()), ConnectionProtocol.LOGIN); ++ this.startConfiguration(); + + if (recorderOption.forceWeather != null) { + setWeather(recorderOption.forceWeather); @@ -881,30 +879,29 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 + } + + public void startConfiguration() { -+ state = ConnectionProtocol.CONFIGURATION; ++ this.state = ConnectionProtocol.CONFIGURATION; + MinecraftServer server = MinecraftServer.getServer(); -+ savePacket(new ClientboundCustomPayloadPacket(new BrandPayload(server.getServerModName())), ConnectionProtocol.CONFIGURATION); + -+ savePacket(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(server.getWorldData().enabledFeatures())), ConnectionProtocol.CONFIGURATION); ++ this.savePacket(new ClientboundCustomPayloadPacket(new BrandPayload(server.getServerModName())), ConnectionProtocol.CONFIGURATION); ++ this.savePacket(new ClientboundServerLinksPacket(server.serverLinks().untrust()), ConnectionProtocol.CONFIGURATION); ++ this.savePacket(new ClientboundUpdateEnabledFeaturesPacket(FeatureFlags.REGISTRY.toNames(server.getWorldData().enabledFeatures())), ConnectionProtocol.CONFIGURATION); + + List knownPackslist = server.getResourceManager().listPacks().flatMap((iresourcepack) -> iresourcepack.location().knownPackInfo().stream()).toList(); -+ LayeredRegistryAccess layeredregistryaccess = server.registries(); ++ this.savePacket(new ClientboundSelectKnownPacks(knownPackslist), ConnectionProtocol.CONFIGURATION); ++ ++ server.getServerResourcePack().ifPresent((info) -> this.savePacket(new ClientboundResourcePackPushPacket( ++ info.id(), info.url(), info.hash(), info.isRequired(), Optional.ofNullable(info.prompt()) ++ ))); + -+ savePacket(new ClientboundSelectKnownPacks(knownPackslist), ConnectionProtocol.CONFIGURATION); ++ LayeredRegistryAccess layeredregistryaccess = server.registries(); + DynamicOps dynamicOps = layeredregistryaccess.compositeAccess().createSerializationContext(NbtOps.INSTANCE); -+ RegistrySynchronization.packRegistries( -+ dynamicOps, -+ layeredregistryaccess.getAccessFrom(RegistryLayer.WORLDGEN), -+ Set.copyOf(knownPackslist), -+ (key, entries) -> savePacket(new ClientboundRegistryDataPacket(key, entries), ConnectionProtocol.CONFIGURATION) ++ RegistrySynchronization.packRegistries(dynamicOps, layeredregistryaccess.getAccessFrom(RegistryLayer.WORLDGEN), Set.copyOf(knownPackslist), ++ (key, entries) -> ++ this.savePacket(new ClientboundRegistryDataPacket(key, entries), ConnectionProtocol.CONFIGURATION) + ); -+ savePacket(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(layeredregistryaccess)), ConnectionProtocol.CONFIGURATION); ++ this.savePacket(new ClientboundUpdateTagsPacket(TagNetworkSerialization.serializeTagsToNetwork(layeredregistryaccess)), ConnectionProtocol.CONFIGURATION); + -+ server.getServerResourcePack().ifPresent((info) -> { -+ savePacket(new ClientboundResourcePackPushPacket(info.id(), info.url(), info.hash(), info.isRequired(), Optional.ofNullable(info.prompt())), ConnectionProtocol.CONFIGURATION); -+ }); -+ -+ savePacket(ClientboundFinishConfigurationPacket.INSTANCE, ConnectionProtocol.CONFIGURATION); ++ this.savePacket(ClientboundFinishConfigurationPacket.INSTANCE, ConnectionProtocol.CONFIGURATION); + state = ConnectionProtocol.PLAY; + } + @@ -955,9 +952,7 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 + public void send(@NotNull Packet packet, @Nullable PacketSendListener callbacks, boolean flush) { + if (!stopped) { + if (packet instanceof BundlePacket packet1) { -+ packet1.subPackets().forEach(subPacket -> { -+ send(subPacket, null); -+ }); ++ packet1.subPackets().forEach(subPacket -> send(subPacket, null)); + return; + } + @@ -973,7 +968,7 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 + } + + if (recorderOption.forceDayTime != -1 && packet instanceof ClientboundSetTimePacket packet1) { -+ packet = new ClientboundSetTimePacket(packet1.getDayTime(), recorderOption.forceDayTime, false); ++ packet = new ClientboundSetTimePacket(packet1.dayTime(), recorderOption.forceDayTime, false); + } + + if (recorderOption.forceWeather != null && packet instanceof ClientboundGameEventPacket packet1) { @@ -1066,7 +1061,6 @@ index 0000000000000000000000000000000000000000..255261aa57780e622b7f4026c6f0ec04 + } + } +} -\ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java b/src/main/java/org/leavesmc/leaves/replay/RecorderOption.java new file mode 100644 index 0000000000000000000000000000000000000000..7183f7fc3eb4fc12aa90b94661b652f476de396b @@ -1133,10 +1127,10 @@ index 0000000000000000000000000000000000000000..7183f7fc3eb4fc12aa90b94661b652f4 \ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java b/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java new file mode 100644 -index 0000000000000000000000000000000000000000..f41657d4796a6bf60665d1ba4c1a8f9295a2e1d5 +index 0000000000000000000000000000000000000000..c6bb5431c3fe14935b0f0a871308830e476271d8 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/replay/ReplayFile.java -@@ -0,0 +1,199 @@ +@@ -0,0 +1,198 @@ +package org.leavesmc.leaves.replay; + +import com.google.gson.Gson; @@ -1145,19 +1139,16 @@ index 0000000000000000000000000000000000000000..f41657d4796a6bf60665d1ba4c1a8f92 +import io.netty.buffer.Unpooled; +import net.minecraft.SharedConstants; +import net.minecraft.network.ConnectionProtocol; -+import net.minecraft.network.FriendlyByteBuf; +import net.minecraft.network.ProtocolInfo; +import net.minecraft.network.RegistryFriendlyByteBuf; -+import net.minecraft.network.codec.StreamCodec; +import net.minecraft.network.protocol.Packet; -+import net.minecraft.network.protocol.PacketFlow; +import net.minecraft.network.protocol.configuration.ConfigurationProtocols; +import net.minecraft.network.protocol.game.GameProtocols; -+import net.minecraft.network.protocol.handshake.HandshakeProtocols; +import net.minecraft.network.protocol.login.LoginProtocols; +import net.minecraft.network.protocol.status.StatusProtocols; +import net.minecraft.server.MinecraftServer; +import org.jetbrains.annotations.NotNull; ++import org.leavesmc.leaves.protocol.core.ProtocolUtils; +import org.leavesmc.leaves.util.UUIDSerializer; + +import java.io.BufferedOutputStream; @@ -1224,7 +1215,8 @@ index 0000000000000000000000000000000000000000..f41657d4796a6bf60665d1ba4c1a8f92 + ); + } + -+ private byte @NotNull [] getPacketBytes(Packet packet, ConnectionProtocol state) { // TODO: Fix this ++ @SuppressWarnings({"rawtypes", "unchecked"}) ++ private byte @NotNull [] getPacketBytes(Packet packet, ConnectionProtocol state) { + ProtocolInfo protocol = this.protocols.get(state); + if (protocol == null) { + throw new IllegalArgumentException("Unknown protocol state " + state); @@ -1250,6 +1242,7 @@ index 0000000000000000000000000000000000000000..f41657d4796a6bf60665d1ba4c1a8f92 + data.fileFormat = "MCPR"; + data.fileFormatVersion = RecordMetaData.CURRENT_FILE_FORMAT_VERSION; + data.protocol = SharedConstants.getCurrentVersion().getProtocolVersion(); ++ data.generator = ProtocolUtils.buildProtocolVersion("replay"); + + try (Writer writer = new OutputStreamWriter(new FileOutputStream(metaFile), StandardCharsets.UTF_8)) { + writer.write(META_GSON.toJson(data)); @@ -1336,7 +1329,6 @@ index 0000000000000000000000000000000000000000..f41657d4796a6bf60665d1ba4c1a8f92 + return dir.delete(); + } +} -\ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java b/src/main/java/org/leavesmc/leaves/replay/ReplayMarker.java new file mode 100644 index 0000000000000000000000000000000000000000..219b9ea88f8cebaf8aab73b123d3efd586cc3147 @@ -1389,10 +1381,10 @@ index 0000000000000000000000000000000000000000..219b9ea88f8cebaf8aab73b123d3efd5 \ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java b/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java new file mode 100644 -index 0000000000000000000000000000000000000000..e2cc869cf9596c63ab8d28e905c92faec5e5976f +index 0000000000000000000000000000000000000000..d8f8f071c67cd0e29411d3f0f3b5e931abe86f65 --- /dev/null +++ b/src/main/java/org/leavesmc/leaves/replay/ServerPhotographer.java -@@ -0,0 +1,221 @@ +@@ -0,0 +1,222 @@ +package org.leavesmc.leaves.replay; + +import com.mojang.authlib.GameProfile; @@ -1433,6 +1425,7 @@ index 0000000000000000000000000000000000000000..e2cc869cf9596c63ab8d28e905c92fae + + private ServerPhotographer(MinecraftServer server, ServerLevel world, GameProfile profile) { + super(server, world, profile, ClientInformation.createDefault()); ++ this.gameMode = new ServerPhotographerGameMode(this); + this.followPlayer = null; + this.stats = new BotStatsCounter(server); + this.lastPos = this.position(); @@ -1496,12 +1489,12 @@ index 0000000000000000000000000000000000000000..e2cc869cf9596c63ab8d28e905c92fae + } + + @Override -+ public boolean isInvulnerableTo(@NotNull DamageSource damageSource) { ++ public boolean isInvulnerableTo(@NotNull ServerLevel world, @NotNull DamageSource damageSource) { + return true; + } + + @Override -+ public boolean hurt(@NotNull DamageSource source, float amount) { ++ public boolean hurtServer(@NotNull ServerLevel world, @NotNull DamageSource source, float amount) { + return false; + } + @@ -1614,7 +1607,6 @@ index 0000000000000000000000000000000000000000..e2cc869cf9596c63ab8d28e905c92fae + } + } +} -\ No newline at end of file diff --git a/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java b/src/main/java/org/leavesmc/leaves/replay/ServerPhotographerGameMode.java new file mode 100644 index 0000000000000000000000000000000000000000..41adf5787bdab11806c76fd379275403c00466a9 diff --git a/patches/server/0038-Leaves-Disable-moved-wrongly-threshold.patch b/patches/server/0036-Leaves-Disable-moved-wrongly-threshold.patch similarity index 94% rename from patches/server/0038-Leaves-Disable-moved-wrongly-threshold.patch rename to patches/server/0036-Leaves-Disable-moved-wrongly-threshold.patch index da4ce00da..9e6c3beeb 100644 --- a/patches/server/0038-Leaves-Disable-moved-wrongly-threshold.patch +++ b/patches/server/0036-Leaves-Disable-moved-wrongly-threshold.patch @@ -7,10 +7,10 @@ Original license: GPLv3 Original project: https://github.com/LeavesMC/Leaves diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 0abef2fd45d384583272a183bae42df5cbacfcec..39428db6c83527c085f4dcb012b4da297840bca6 100644 +index 6f00bc85205a4c481d85f95e30aeb61ab3db1e8a..68cf6f0f0d2d1eb23de070ea8471111a41a9f9bf 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -588,7 +588,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -593,7 +593,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper end - Prevent moving into unloaded chunks @@ -19,7 +19,7 @@ index 0abef2fd45d384583272a183bae42df5cbacfcec..39428db6c83527c085f4dcb012b4da29 // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", new Object[]{entity.getName().getString(), this.player.getName().getString(), d6, d7, d8}); this.send(new ClientboundMoveVehiclePacket(entity)); -@@ -624,7 +624,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -629,7 +629,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl d10 = d6 * d6 + d7 * d7 + d8 * d8; boolean flag2 = false; @@ -28,7 +28,7 @@ index 0abef2fd45d384583272a183bae42df5cbacfcec..39428db6c83527c085f4dcb012b4da29 flag2 = true; // Paper - diff on change, this should be moved wrongly ServerGamePacketListenerImpl.LOGGER.warn("{} (vehicle of {}) moved wrongly! {}", new Object[]{entity.getName().getString(), this.player.getName().getString(), Math.sqrt(d10)}); } -@@ -1478,7 +1478,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1490,7 +1490,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.MOVED_TOO_QUICKLY, toX, toY, toZ, toYaw, toPitch, true); if (!event.isAllowed()) { @@ -37,7 +37,7 @@ index 0abef2fd45d384583272a183bae42df5cbacfcec..39428db6c83527c085f4dcb012b4da29 ServerGamePacketListenerImpl.LOGGER.warn("{} moved too quickly! {},{},{}", new Object[]{this.player.getName().getString(), d6, d7, d8}); this.teleport(this.player.getX(), this.player.getY(), this.player.getZ(), this.player.getYRot(), this.player.getXRot()); return; -@@ -1548,7 +1548,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1560,7 +1560,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl d10 = d6 * d6 + d7 * d7 + d8 * d8; boolean movedWrongly = false; // Paper - Add fail move event; rename diff --git a/patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch b/patches/server/0037-Faster-Random-for-xaeroMapServerID-generation.patch similarity index 89% rename from patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch rename to patches/server/0037-Faster-Random-for-xaeroMapServerID-generation.patch index 134dd9aca..f06295477 100644 --- a/patches/server/0039-Faster-Random-for-xaeroMapServerID-generation.patch +++ b/patches/server/0037-Faster-Random-for-xaeroMapServerID-generation.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Faster Random for xaeroMapServerID generation diff --git a/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java b/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java -index 1d8d321ac3f6c8bf12afe22d8b3f37655fa8c46c..62fc12c13b8294dab45da4e250bf2e7680744c83 100644 +index a81c0a7bc71b86eb652abcd06099d36f4de71ae9..c17e3484ced6d1fb6083dde7c68f8a5a03de0c4e 100644 --- a/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java +++ b/src/main/java/org/dreeam/leaf/config/modules/network/ProtocolSupport.java @@ -3,7 +3,7 @@ package org.dreeam.leaf.config.modules.network; @@ -17,7 +17,7 @@ index 1d8d321ac3f6c8bf12afe22d8b3f37655fa8c46c..62fc12c13b8294dab45da4e250bf2e76 public class ProtocolSupport extends ConfigModules { -@@ -16,7 +16,7 @@ public class ProtocolSupport extends ConfigModules { +@@ -17,7 +17,7 @@ public class ProtocolSupport extends ConfigModules { public static boolean asteorBarProtocol = false; public static boolean chatImageProtocol = false; public static boolean xaeroMapProtocol = false; diff --git a/patches/server/0040-Petal-Async-Pathfinding.patch b/patches/server/0038-Petal-Async-Pathfinding.patch similarity index 95% rename from patches/server/0040-Petal-Async-Pathfinding.patch rename to patches/server/0038-Petal-Async-Pathfinding.patch index 4fc399d31..f821bc9ba 100644 --- a/patches/server/0040-Petal-Async-Pathfinding.patch +++ b/patches/server/0038-Petal-Async-Pathfinding.patch @@ -15,7 +15,7 @@ This patch was ported downstream from the Petal fork. Makes most pathfinding-related work happen asynchronously diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 63b827d91a935d6b6f04266eea682da97af79cf2..02d7180e5b932dd8c7e8867f1334cbc47e26f5bd 100644 +index 6c603c83d9caeed480f5d67854e40c3fa8ff20dd..eb547af300d8ecea19b3e02e5ebe6139330c9d62 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -297,6 +297,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -27,11 +27,11 @@ index 63b827d91a935d6b6f04266eea682da97af79cf2..02d7180e5b932dd8c7e8867f1334cbc4 } diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java -index e74c39e279c6af2742a158100578cb1a00ca07ef..45486f43cdc3f4c3f851ae50a72c89c7688f2e8b 100644 +index 93d17d93922841354fb0bfb15ce43776fafb19d2..5d18afe6db88393061656b18e2485e343d7769d6 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/AcquirePoi.java @@ -84,6 +84,38 @@ public class AcquirePoi { - io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); // Purpur + io.papermc.paper.util.PoiAccess.findNearestPoiPositions(poiManager, poiPredicate, predicate2, entity.blockPosition(), world.purpurConfig.villagerAcquirePoiSearchRadius, world.purpurConfig.villagerAcquirePoiSearchRadius*world.purpurConfig.villagerAcquirePoiSearchRadius, PoiManager.Occupancy.HAS_SPACE, false, 5, poiposes); Set, BlockPos>> set = new java.util.HashSet<>(poiposes); // Paper end - optimise POI access + // Kaiiju start - petal - Async path processing @@ -325,10 +325,10 @@ index a3e0c5af4cc9323c02e88e768cbda9e46854aea1..231664c516ded9bb4619d8afb41e5cb2 if (!this.isDone()) { if (this.canUpdatePath()) { diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -index 62634bedd97c5be9ecce24ab0cff205715a68da8..5266cee05a00fefba98a10eb91bb477f189e1ad1 100644 +index f73b559b8e60859020f762dab88b67b8c912bf8f..ce7dbad7bad5379679a757826a2eaac0ac98f718 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/GroundPathNavigation.java -@@ -23,10 +23,26 @@ public class GroundPathNavigation extends PathNavigation { +@@ -24,10 +24,26 @@ public class GroundPathNavigation extends PathNavigation { super(entity, world); } @@ -356,10 +356,10 @@ index 62634bedd97c5be9ecce24ab0cff205715a68da8..5266cee05a00fefba98a10eb91bb477f } diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31c14cb955 100644 +index 79342566ae54b5a8ccd8cab01b8282fada5b7bab..7ea1d007f9aeabb26f8e8c42a0d5bbc883fccb3e 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/PathNavigation.java -@@ -152,6 +152,10 @@ public abstract class PathNavigation { +@@ -166,6 +166,10 @@ public abstract class PathNavigation { return null; } else if (!this.canUpdatePath()) { return null; @@ -370,7 +370,7 @@ index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31 } else if (this.path != null && !this.path.isDone() && positions.contains(this.targetPos)) { return this.path; } else { -@@ -176,11 +180,29 @@ public abstract class PathNavigation { +@@ -190,11 +194,29 @@ public abstract class PathNavigation { int i = (int)(followRange + (float)range); PathNavigationRegion pathNavigationRegion = new PathNavigationRegion(this.level, blockPos.offset(-i, -i, -i), blockPos.offset(i, i, i)); Path path = this.pathFinder.findPath(pathNavigationRegion, this.mob, positions, followRange, distance, this.maxVisitedNodesMultiplier); @@ -400,7 +400,7 @@ index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31 return path; } -@@ -231,8 +253,8 @@ public abstract class PathNavigation { +@@ -245,8 +267,8 @@ public abstract class PathNavigation { if (this.isDone()) { return false; } else { @@ -411,7 +411,7 @@ index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31 return false; } else { this.speedModifier = speed; -@@ -255,6 +277,7 @@ public abstract class PathNavigation { +@@ -269,6 +291,7 @@ public abstract class PathNavigation { if (this.hasDelayedRecomputation) { this.recomputePath(); } @@ -419,7 +419,7 @@ index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31 if (!this.isDone()) { if (this.canUpdatePath()) { -@@ -281,6 +304,7 @@ public abstract class PathNavigation { +@@ -295,6 +318,7 @@ public abstract class PathNavigation { } protected void followThePath() { @@ -427,7 +427,7 @@ index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31 Vec3 vec3 = this.getTempMobPos(); this.maxDistanceToWaypoint = this.mob.getBbWidth() > 0.75F ? this.mob.getBbWidth() / 2.0F : 0.75F - this.mob.getBbWidth() / 2.0F; Vec3i vec3i = this.path.getNextNodePos(); -@@ -437,7 +461,7 @@ public abstract class PathNavigation { +@@ -451,7 +475,7 @@ public abstract class PathNavigation { public boolean shouldRecomputePath(BlockPos pos) { if (this.hasDelayedRecomputation) { return false; @@ -437,7 +437,7 @@ index aea01c46bf59ed811356180436fc0789e354d981..542c63c4304d97772988dea13edbcd31 Vec3 vec3 = new Vec3(((double)node.x + this.mob.getX()) / 2.0, ((double)node.y + this.mob.getY()) / 2.0, ((double)node.z + this.mob.getZ()) / 2.0); return pos.closerToCenterThan(vec3, (double)(this.path.getNodeCount() - this.path.getNextNodeIndex())); diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java -index ce7398a617abe6e800c1e014b3ac5c970eb15c8a..dbf43209417d8453ff39839392eba45b2bc625c1 100644 +index 0446ac540d8509a653abe1a8bc10f52fb43d6ae1..faa9a67bb0412caca005337d8c14b2e3098c2c45 100644 --- a/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java +++ b/src/main/java/net/minecraft/world/entity/ai/navigation/WaterBoundPathNavigation.java @@ -15,10 +15,26 @@ public class WaterBoundPathNavigation extends PathNavigation { @@ -507,10 +507,10 @@ index 9104d7010bda6f9f73b478c11490ef9c53f76da2..fb12b8581ebaccc12dc336cc73a847d7 } } diff --git a/src/main/java/net/minecraft/world/entity/animal/Bee.java b/src/main/java/net/minecraft/world/entity/animal/Bee.java -index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..1022ba7c522cc72cdbd73f7f98657072affebc01 100644 +index dc8df0912c1d18176e18a8f4dc43c4f60f81b659..a0e3ec138a1b9750afcc0e2712be377b26f58dcd 100644 --- a/src/main/java/net/minecraft/world/entity/animal/Bee.java +++ b/src/main/java/net/minecraft/world/entity/animal/Bee.java -@@ -1147,7 +1147,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -1206,7 +1206,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } else { Bee.this.pathfindRandomlyTowards(Bee.this.hivePos); } @@ -519,7 +519,7 @@ index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..1022ba7c522cc72cdbd73f7f98657072 boolean flag = this.pathfindDirectlyTowards(Bee.this.hivePos); if (!flag) { -@@ -1209,7 +1209,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { +@@ -1265,7 +1265,7 @@ public class Bee extends Animal implements NeutralMob, FlyingAnimal { } else { Path pathentity = Bee.this.navigation.getPath(); @@ -529,10 +529,10 @@ index 9a6ec5e465684be7f0d54b1f7e66bdf52603e442..1022ba7c522cc72cdbd73f7f98657072 } } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index 7c4e7d55874fa968d52eab683e9979ba38e91c2e..da026533b15a1981000e73bba6c5209c13de28dc 100644 +index 0f077f9be003a17b77e9b29fa2f398a4de1fa3c5..d8fe42996c8ba3d44e31197b24294b86b845e2a8 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -465,6 +465,17 @@ public class Frog extends Animal implements VariantHolder> { +@@ -475,6 +475,17 @@ public class Frog extends Animal implements VariantHolder> { super(frog, world); } @@ -550,7 +550,7 @@ index 7c4e7d55874fa968d52eab683e9979ba38e91c2e..da026533b15a1981000e73bba6c5209c @Override public boolean canCutCorner(PathType nodeType) { return nodeType != PathType.WATER_BORDER && super.canCutCorner(nodeType); -@@ -474,6 +485,11 @@ public class Frog extends Animal implements VariantHolder> { +@@ -484,6 +495,11 @@ public class Frog extends Animal implements VariantHolder> { protected PathFinder createPathFinder(int range) { this.nodeEvaluator = new Frog.FrogNodeEvaluator(true); this.nodeEvaluator.setCanPassDoors(true); @@ -563,23 +563,23 @@ index 7c4e7d55874fa968d52eab683e9979ba38e91c2e..da026533b15a1981000e73bba6c5209c } } diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -index 94de51bf9acb32421838ffe54602310f0263b3c4..16b8cab067f35c89db34394c1203209ae1b91cbd 100644 +index 949207eda199c874f2f14074b5a4fff5462b86b9..53ebc584a7eb8b18e959aff75a11a37fd0b8ace2 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -@@ -296,7 +296,7 @@ public class Drowned extends Zombie implements RangedAttackMob { - protected boolean closeToNextPos() { - Path pathentity = this.getNavigation().getPath(); - -- if (pathentity != null) { -+ if (pathentity != null && pathentity.isProcessed()) { // Kaiiju - petal - ensure path is processed - BlockPos blockposition = pathentity.getTarget(); +@@ -308,7 +308,7 @@ public class Drowned extends Zombie implements RangedAttackMob { - if (blockposition != null) { + protected boolean closeToNextPos() { + Path path = this.getNavigation().getPath(); +- if (path != null) { ++ if (path != null && path.isProcessed()) { // Kaiiju - petal - ensure path is processed + BlockPos blockPos = path.getTarget(); + if (blockPos != null) { + double d = this.distanceToSqr((double)blockPos.getX(), (double)blockPos.getY(), (double)blockPos.getZ()); diff --git a/src/main/java/net/minecraft/world/entity/monster/Strider.java b/src/main/java/net/minecraft/world/entity/monster/Strider.java -index 70650cc6f76bed79a31a9e8c86205910994a920f..844267738769506dc58f30d0396a3b5bab93a42a 100644 +index c3b5b34a54de945071692293645b8a8865aed961..531a71c45a573b6832230c2b2aac51b4187c3981 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Strider.java +++ b/src/main/java/net/minecraft/world/entity/monster/Strider.java -@@ -610,10 +610,26 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { +@@ -608,10 +608,26 @@ public class Strider extends Animal implements ItemSteerable, Saddleable { super(entity, world); } @@ -607,10 +607,10 @@ index 70650cc6f76bed79a31a9e8c86205910994a920f..844267738769506dc58f30d0396a3b5b } diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index f929b9e623eaea0e949a7af1828b9eb198fc66b8..1e31f20da2450e92228d511f060ff9f5a3207005 100644 +index d0f744597de323f6169e15cabe9b3a80dbdbf5bb..a429de1fdb4823b1f1df42dfe213853cc06ef1c2 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -614,6 +614,16 @@ public class Warden extends Monster implements VibrationSystem { +@@ -613,6 +613,16 @@ public class Warden extends Monster implements VibrationSystem { protected PathFinder createPathFinder(int range) { this.nodeEvaluator = new WalkNodeEvaluator(); this.nodeEvaluator.setCanPassDoors(true); @@ -628,10 +628,10 @@ index f929b9e623eaea0e949a7af1828b9eb198fc66b8..1e31f20da2450e92228d511f060ff9f5 @Override protected float distance(Node a, Node b) { diff --git a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java -index 6b2c3afa04a3564e435633b521d918ed795f9f65..d9da09ac78e1b67a666539089b70a097d7236ad3 100644 +index 155c7240b1112729333e6968122568c707d8f66b..57a0170439ac8dff818c89443bca62e5ceeb3003 100644 --- a/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java +++ b/src/main/java/net/minecraft/world/level/block/ShulkerBoxBlock.java -@@ -227,8 +227,15 @@ public class ShulkerBoxBlock extends BaseEntityBlock { +@@ -223,8 +223,15 @@ public class ShulkerBoxBlock extends BaseEntityBlock { @Override protected VoxelShape getShape(BlockState state, BlockGetter world, BlockPos pos, CollisionContext context) { @@ -678,10 +678,10 @@ index d9d0fff9962131808d54cca20f209df50b8e4af1..f2dcbb40ed43e6ddf6f3dc27fcff04f7 return false; } else if (o.nodes.size() != this.nodes.size()) { diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -index f890c27c960b6511b7961f380b23e9ca8f86ba0e..89b74ee7bd2b75c4eaee7c7bca6cbadad2d9165b 100644 +index d7ac3a6a1d7d5561aae153ecb1455b8972d9a61d..3cedcf0ae24a67d5bb1ac6b06bb5c0346d82a84a 100644 --- a/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java +++ b/src/main/java/net/minecraft/world/level/pathfinder/PathFinder.java -@@ -23,35 +23,80 @@ public class PathFinder { +@@ -22,10 +22,18 @@ public class PathFinder { public final NodeEvaluator nodeEvaluator; private static final boolean DEBUG = false; private final BinaryHeap openSet = new BinaryHeap(); @@ -700,6 +700,9 @@ index f890c27c960b6511b7961f380b23e9ca8f86ba0e..89b74ee7bd2b75c4eaee7c7bca6cbada + // Kaiiju end } + public void setMaxVisitedNodes(int range) { +@@ -34,27 +42,64 @@ public class PathFinder { + @Nullable public Path findPath(PathNavigationRegion world, Mob mob, Set positions, float followRange, int distance, float rangeMultiplier) { - this.openSet.clear(); @@ -725,7 +728,7 @@ index f890c27c960b6511b7961f380b23e9ca8f86ba0e..89b74ee7bd2b75c4eaee7c7bca6cbada + map.add(new java.util.AbstractMap.SimpleEntry<>(nodeEvaluator.getTarget(pos.getX(), pos.getY(), pos.getZ()), pos)); // Kaiiju - petal - handle nodeEvaluatorGenerator } // Paper end - Perf: remove streams and optimize collection -- Path path = this.findPath(node, map, followRange, distance, rangeMultiplier); // Gale - Purpur - remove vanilla profiler +- Path path = this.findPath(node, map, followRange, distance, rangeMultiplier); - this.nodeEvaluator.done(); - return path; + // Kaiiju start - petal - async path processing @@ -752,7 +755,7 @@ index f890c27c960b6511b7961f380b23e9ca8f86ba0e..89b74ee7bd2b75c4eaee7c7bca6cbada @Nullable // Paper start - Perf: remove streams and optimize collection - private Path findPath(Node startNode, List> positions, float followRange, int distance, float rangeMultiplier) { // Gale - Purpur - remove vanilla profiler + private Path findPath(Node startNode, List> positions, float followRange, int distance, float rangeMultiplier) { + // Kaiiju start - petal - split pathfinding into the original sync method for compat and processing for delaying + try { + return this.processPath(this.nodeEvaluator, startNode, positions, followRange, distance, rangeMultiplier); @@ -770,7 +773,7 @@ index f890c27c960b6511b7961f380b23e9ca8f86ba0e..89b74ee7bd2b75c4eaee7c7bca6cbada // Set set = positions.keySet(); startNode.g = 0.0F; startNode.h = this.getBestH(startNode, positions); // Paper - optimize collection -@@ -87,7 +132,7 @@ public class PathFinder { +@@ -90,7 +135,7 @@ public class PathFinder { } if (!(node.distanceTo(startNode) >= followRange)) { @@ -779,7 +782,7 @@ index f890c27c960b6511b7961f380b23e9ca8f86ba0e..89b74ee7bd2b75c4eaee7c7bca6cbada for (int l = 0; l < k; l++) { Node node2 = this.neighbors[l]; -@@ -119,6 +164,7 @@ public class PathFinder { +@@ -122,6 +167,7 @@ public class PathFinder { if (best == null || comparator.compare(path, best) < 0) best = path; } diff --git a/patches/server/0041-Petal-reduce-work-done-by-game-event-system.patch b/patches/server/0039-Petal-reduce-work-done-by-game-event-system.patch similarity index 93% rename from patches/server/0041-Petal-reduce-work-done-by-game-event-system.patch rename to patches/server/0039-Petal-reduce-work-done-by-game-event-system.patch index c190175d5..a0f8eeb7f 100644 --- a/patches/server/0041-Petal-reduce-work-done-by-game-event-system.patch +++ b/patches/server/0039-Petal-reduce-work-done-by-game-event-system.patch @@ -11,7 +11,7 @@ Original project: https://github.com/Bloom-host/Petal 2. EuclideanGameEventListenerRegistry is not used concurrently so we ban that usage for improved performance with allays diff --git a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java -index a74732902c0494c67e6acf2fc04581ff9c46b832..8b60c922750e71f526976782a1f156e94bc0aa35 100644 +index 4729befa12732a9fd65cce243b33b3b479026c41..f61295465d89d6aaab83666677617f5198b75f3c 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SculkCatalystBlockEntity.java @@ -68,7 +68,7 @@ public class SculkCatalystBlockEntity extends BlockEntity implements GameEventLi @@ -38,7 +38,7 @@ index a74732902c0494c67e6acf2fc04581ff9c46b832..8b60c922750e71f526976782a1f156e9 LivingEntity entityliving1 = deadEntity.getLastHurtByMob(); diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java -index 5ad94cabbab741d69363d40df359075da7165c97..308fde6ec1df5dce8e6c323f0cb07a99451a086e 100644 +index 370266dfa461432b9e22b3ce35d6094949dc2f49..b8246d7255bffc7e12a67772df2ceac1925b2a05 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -81,7 +81,18 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -60,17 +60,17 @@ index 5ad94cabbab741d69363d40df359075da7165c97..308fde6ec1df5dce8e6c323f0cb07a99 + // Leaf end - petal private final LevelChunkTicks blockTicks; private final LevelChunkTicks fluidTicks; - -@@ -105,7 +116,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p - super(pos, upgradeData, world, net.minecraft.server.MinecraftServer.getServer().registryAccess().registryOrThrow(Registries.BIOME), inhabitedTime, sectionArrayInitializer, blendingData); // Paper - Anti-Xray - The world isn't ready yet, use server singleton for registry - this.tickersInLevel = Maps.newHashMap(); + private LevelChunk.UnsavedListener unsavedListener; +@@ -108,7 +119,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p + this.unsavedListener = (chunkcoordintpair1) -> { + }; this.level = (ServerLevel) world; // CraftBukkit - type - this.gameEventListenerRegistrySections = new Int2ObjectOpenHashMap(); + this.gameEventListenerRegistrySections = new GameEventListenerRegistry[getGameEventSectionLength(this.getSectionsCount())]; // Leaf - petal Heightmap.Types[] aheightmap_type = Heightmap.Types.values(); int j = aheightmap_type.length; -@@ -244,9 +255,23 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -266,9 +277,23 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p Level world = this.level; if (world instanceof ServerLevel worldserver) { @@ -97,7 +97,7 @@ index 5ad94cabbab741d69363d40df359075da7165c97..308fde6ec1df5dce8e6c323f0cb07a99 } else { return super.getListenerRegistry(ySectionCoord); } -@@ -635,7 +660,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p +@@ -659,7 +684,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p } private void removeGameEventListenerRegistry(int ySectionCoord) { diff --git a/patches/server/0043-Reduce-canSee-work.patch b/patches/server/0040-Reduce-canSee-work.patch similarity index 69% rename from patches/server/0043-Reduce-canSee-work.patch rename to patches/server/0040-Reduce-canSee-work.patch index ccd847a0c..e4075b26a 100644 --- a/patches/server/0043-Reduce-canSee-work.patch +++ b/patches/server/0040-Reduce-canSee-work.patch @@ -7,10 +7,10 @@ Co-authored by: Martijn Muijsers Co-authored by: MachineBreaker diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index ad056c22eec4fae4f9d4a4b0ec901729f47b4774..02747911e13fc99df7a69f5d382782e07a375fd3 100644 +index c3b9a9904f7b34df3dbd0a25e52946ab45f0f4d6..859708f1ab4b9f1bd318ca08c73cb67b1c3fe010 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java -@@ -855,17 +855,19 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl +@@ -993,17 +993,19 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl for (int i = 0, len = entities.size(); i < len; ++i) { Entity entity = entities.get(i); @@ -35,15 +35,3 @@ index ad056c22eec4fae4f9d4a4b0ec901729f47b4774..02747911e13fc99df7a69f5d382782e0 if (net.minecraft.world.phys.shapes.Shapes.joinIsNotEmpty(voxelshape, net.minecraft.world.phys.shapes.Shapes.create(entity.getBoundingBox()), net.minecraft.world.phys.shapes.BooleanOp.AND)) { return false; -diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 7294c6cc2cf65e3c142d174025d24d854bbe68ae..c6964b6027e0ac57e3e01deae0da22665f2afc40 100644 ---- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -640,6 +640,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - return false; - } - OfflinePlayer other = (OfflinePlayer) obj; -+ if (this == obj) return true; // Leaf - reduce canSee work - if ((this.getUniqueId() == null) || (other.getUniqueId() == null)) { - return false; - } diff --git a/patches/server/0045-Fix-sprint-glitch.patch b/patches/server/0041-Fix-sprint-glitch.patch similarity index 84% rename from patches/server/0045-Fix-sprint-glitch.patch rename to patches/server/0041-Fix-sprint-glitch.patch index e99878d03..f1d729643 100644 --- a/patches/server/0045-Fix-sprint-glitch.patch +++ b/patches/server/0041-Fix-sprint-glitch.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix sprint glitch diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 1e2e90af2ab65938c6d711a187dd4d65a93b1280..d0755333e86009bbb584481f4796cfc60643a53f 100644 +index 6f3986ba57ce794a1f78b8960a7c8de8a3508c19..d5395553034c148bdc12b065328f52ef72b9bd86 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1428,7 +1428,8 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1456,7 +1456,8 @@ public abstract class LivingEntity extends Entity implements Attackable { player.setRealHealth(health); } diff --git a/patches/server/0046-Configurable-movement-speed-of-more-entities.patch b/patches/server/0042-Configurable-movement-speed-of-more-entities.patch similarity index 88% rename from patches/server/0046-Configurable-movement-speed-of-more-entities.patch rename to patches/server/0042-Configurable-movement-speed-of-more-entities.patch index 2e5c9470c..e7b34b43c 100644 --- a/patches/server/0046-Configurable-movement-speed-of-more-entities.patch +++ b/patches/server/0042-Configurable-movement-speed-of-more-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable movement speed of more entities diff --git a/src/main/java/net/minecraft/world/entity/monster/Drowned.java b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -index 16b8cab067f35c89db34394c1203209ae1b91cbd..1a3ec4b39f504d2006fd132d3c0c3dff7f042af7 100644 +index 53ebc584a7eb8b18e959aff75a11a37fd0b8ace2..03de4f06c461a17ec7a3516ca579f79472bb3919 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Drowned.java +++ b/src/main/java/net/minecraft/world/entity/monster/Drowned.java -@@ -92,6 +92,7 @@ public class Drowned extends Zombie implements RangedAttackMob { +@@ -93,6 +93,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); @@ -17,10 +17,10 @@ index 16b8cab067f35c89db34394c1203209ae1b91cbd..1a3ec4b39f504d2006fd132d3c0c3dff @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Husk.java b/src/main/java/net/minecraft/world/entity/monster/Husk.java -index a9285aac811067313c5609d2d5708783736e6cb5..53114ceb212ea341b227f59ebd302d7c4fd84f2a 100644 +index 7c8ec5cd88fb2083f458a945e716b6f118555db8..108a0874cf9c17809d31d0f3cf64ceeb52746f32 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Husk.java +++ b/src/main/java/net/minecraft/world/entity/monster/Husk.java -@@ -43,6 +43,7 @@ public class Husk extends Zombie { +@@ -44,6 +44,7 @@ public class Husk extends Zombie { @Override public void initAttributes() { this.getAttribute(net.minecraft.world.entity.ai.attributes.Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.huskMaxHealth); @@ -29,10 +29,10 @@ index a9285aac811067313c5609d2d5708783736e6cb5..53114ceb212ea341b227f59ebd302d7c @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/Zombie.java b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -index 479232d8dfaabdb3da5b825969d377aa437ea7d3..aa1fd8f2fba06292e93aba279cf18640b6909add 100644 +index 85b03e0bf7436cb846df13c575ad78ac6a17a151..5924509cbe36d3fee9d2f119d58e67c4b083e4c4 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -130,6 +130,7 @@ public class Zombie extends Monster { +@@ -132,6 +132,7 @@ public class Zombie extends Monster { public void initAttributes() { this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.level().purpurConfig.zombieMaxHealth); this.getAttribute(Attributes.SCALE).setBaseValue(this.level().purpurConfig.zombieScale); @@ -40,7 +40,7 @@ index 479232d8dfaabdb3da5b825969d377aa437ea7d3..aa1fd8f2fba06292e93aba279cf18640 } public boolean jockeyOnlyBaby() { -@@ -187,9 +188,15 @@ public class Zombie extends Monster { +@@ -189,9 +190,15 @@ public class Zombie extends Monster { this.targetSelector.addGoal(5, new NearestAttackableTargetGoal<>(this, Turtle.class, 10, true, false, Turtle.BABY_ON_LAND_SELECTOR)); } @@ -58,10 +58,10 @@ index 479232d8dfaabdb3da5b825969d377aa437ea7d3..aa1fd8f2fba06292e93aba279cf18640 @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -index 5ead916772c21d8db98e389984d531aae7f59700..7ac5f6fc44fd5f901c30fe93856ed6b04b86a265 100644 +index 6f6b32bf7f68d05e4173c31f2e631a409b858a05..160fcd1f8917d69dde01089111661337827da20a 100644 --- a/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java +++ b/src/main/java/net/minecraft/world/entity/monster/ZombieVillager.java -@@ -103,6 +103,7 @@ public class ZombieVillager extends Zombie implements VillagerDataHolder { +@@ -105,6 +105,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); @@ -70,7 +70,7 @@ index 5ead916772c21d8db98e389984d531aae7f59700..7ac5f6fc44fd5f901c30fe93856ed6b0 @Override diff --git a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java -index 1c04fbea0dce4167a0902b92b95d470f562825c2..4f1f816496f8f8564c1dc53ceae5cfb36ff7c880 100644 +index 8c3271dcc8c9aa58e2e007eba282c11e42b4e0c9..8afc2234a179840308ad371296d6f3247c80f3ae 100644 --- a/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java +++ b/src/main/java/net/minecraft/world/entity/monster/ZombifiedPiglin.java @@ -84,6 +84,7 @@ public class ZombifiedPiglin extends Zombie implements NeutralMob { @@ -97,10 +97,10 @@ index 1c04fbea0dce4167a0902b92b95d470f562825c2..4f1f816496f8f8564c1dc53ceae5cfb3 @Override public EntityDimensions getDefaultDimensions(Pose pose) { diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd29244478037909 100644 +index 36b875a1cb10f1704e8530b6eb7b7e9dc51ef995..8c9a6084f09f644bf22ac98edac797eea753277f 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -@@ -1541,6 +1541,7 @@ public class PurpurWorldConfig { +@@ -1554,6 +1554,7 @@ public class PurpurWorldConfig { public boolean drownedTakeDamageFromWater = false; public boolean drownedBreakDoors = false; public boolean drownedAlwaysDropExp = false; @@ -108,7 +108,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 private void drownedSettings() { drownedRidable = getBoolean("mobs.drowned.ridable", drownedRidable); drownedRidableInWater = getBoolean("mobs.drowned.ridable-in-water", drownedRidableInWater); -@@ -1559,6 +1560,7 @@ public class PurpurWorldConfig { +@@ -1572,6 +1573,7 @@ public class PurpurWorldConfig { drownedTakeDamageFromWater = getBoolean("mobs.drowned.takes-damage-from-water", drownedTakeDamageFromWater); drownedBreakDoors = getBoolean("mobs.drowned.can-break-doors", drownedBreakDoors); drownedAlwaysDropExp = getBoolean("mobs.drowned.always-drop-exp", drownedAlwaysDropExp); @@ -116,7 +116,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 } public boolean elderGuardianRidable = false; -@@ -1935,6 +1937,7 @@ public class PurpurWorldConfig { +@@ -1946,6 +1948,7 @@ public class PurpurWorldConfig { public boolean huskJockeyTryExistingChickens = true; public boolean huskTakeDamageFromWater = false; public boolean huskAlwaysDropExp = false; @@ -124,7 +124,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 private void huskSettings() { huskRidable = getBoolean("mobs.husk.ridable", huskRidable); huskRidableInWater = getBoolean("mobs.husk.ridable-in-water", huskRidableInWater); -@@ -1952,6 +1955,7 @@ public class PurpurWorldConfig { +@@ -1963,6 +1966,7 @@ public class PurpurWorldConfig { huskJockeyTryExistingChickens = getBoolean("mobs.husk.jockey.try-existing-chickens", huskJockeyTryExistingChickens); huskTakeDamageFromWater = getBoolean("mobs.husk.takes-damage-from-water", huskTakeDamageFromWater); huskAlwaysDropExp = getBoolean("mobs.husk.always-drop-exp", huskAlwaysDropExp); @@ -132,7 +132,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 } public boolean illusionerRidable = false; -@@ -3245,6 +3249,7 @@ public class PurpurWorldConfig { +@@ -3260,6 +3264,7 @@ public class PurpurWorldConfig { public boolean zombieTakeDamageFromWater = false; public boolean zombieAlwaysDropExp = false; public double zombieHeadVisibilityPercent = 0.5D; @@ -140,7 +140,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 private void zombieSettings() { zombieRidable = getBoolean("mobs.zombie.ridable", zombieRidable); zombieRidableInWater = getBoolean("mobs.zombie.ridable-in-water", zombieRidableInWater); -@@ -3265,6 +3270,7 @@ public class PurpurWorldConfig { +@@ -3280,6 +3285,7 @@ public class PurpurWorldConfig { zombieTakeDamageFromWater = getBoolean("mobs.zombie.takes-damage-from-water", zombieTakeDamageFromWater); zombieAlwaysDropExp = getBoolean("mobs.zombie.always-drop-exp", zombieAlwaysDropExp); zombieHeadVisibilityPercent = getDouble("mobs.zombie.head-visibility-percent", zombieHeadVisibilityPercent); @@ -148,7 +148,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 } public boolean zombieHorseRidable = false; -@@ -3314,6 +3320,7 @@ public class PurpurWorldConfig { +@@ -3329,6 +3335,7 @@ public class PurpurWorldConfig { public int zombieVillagerCuringTimeMax = 6000; public boolean zombieVillagerCureEnabled = true; public boolean zombieVillagerAlwaysDropExp = false; @@ -156,7 +156,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 private void zombieVillagerSettings() { zombieVillagerRidable = getBoolean("mobs.zombie_villager.ridable", zombieVillagerRidable); zombieVillagerRidableInWater = getBoolean("mobs.zombie_villager.ridable-in-water", zombieVillagerRidableInWater); -@@ -3334,6 +3341,7 @@ public class PurpurWorldConfig { +@@ -3349,6 +3356,7 @@ public class PurpurWorldConfig { zombieVillagerCuringTimeMax = getInt("mobs.zombie_villager.curing_time.max", zombieVillagerCuringTimeMax); zombieVillagerCureEnabled = getBoolean("mobs.zombie_villager.cure.enabled", zombieVillagerCureEnabled); zombieVillagerAlwaysDropExp = getBoolean("mobs.zombie_villager.always-drop-exp", zombieVillagerAlwaysDropExp); @@ -164,7 +164,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 } public boolean zombifiedPiglinRidable = false; -@@ -3348,6 +3356,7 @@ public class PurpurWorldConfig { +@@ -3363,6 +3371,7 @@ public class PurpurWorldConfig { public boolean zombifiedPiglinCountAsPlayerKillWhenAngry = true; public boolean zombifiedPiglinTakeDamageFromWater = false; public boolean zombifiedPiglinAlwaysDropExp = false; @@ -172,7 +172,7 @@ index d2021197a100279f2e9bcad4cadd715ac0bb9d4a..58ec0b2158052f81c00a78d3bd292444 private void zombifiedPiglinSettings() { zombifiedPiglinRidable = getBoolean("mobs.zombified_piglin.ridable", zombifiedPiglinRidable); zombifiedPiglinRidableInWater = getBoolean("mobs.zombified_piglin.ridable-in-water", zombifiedPiglinRidableInWater); -@@ -3366,6 +3375,7 @@ public class PurpurWorldConfig { +@@ -3381,6 +3390,7 @@ public class PurpurWorldConfig { zombifiedPiglinCountAsPlayerKillWhenAngry = getBoolean("mobs.zombified_piglin.count-as-player-kill-when-angry", zombifiedPiglinCountAsPlayerKillWhenAngry); zombifiedPiglinTakeDamageFromWater = getBoolean("mobs.zombified_piglin.takes-damage-from-water", zombifiedPiglinTakeDamageFromWater); zombifiedPiglinAlwaysDropExp = getBoolean("mobs.zombified_piglin.always-drop-exp", zombifiedPiglinAlwaysDropExp); diff --git a/patches/server/0047-Faster-sequencing-of-futures-for-chunk-structure-gen.patch b/patches/server/0043-Faster-sequencing-of-futures-for-chunk-structure-gen.patch similarity index 64% rename from patches/server/0047-Faster-sequencing-of-futures-for-chunk-structure-gen.patch rename to patches/server/0043-Faster-sequencing-of-futures-for-chunk-structure-gen.patch index 7e2c74fb2..9575f9f99 100644 --- a/patches/server/0047-Faster-sequencing-of-futures-for-chunk-structure-gen.patch +++ b/patches/server/0043-Faster-sequencing-of-futures-for-chunk-structure-gen.patch @@ -7,20 +7,27 @@ Replace `thenApply` with `thenCompose`. Once one task is completed then the next to prevent blocking threads while waiting to complete all tasks. But may cause the sequence of future compose disorder. diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java -index 0e38a641d8e537750166b56c57aca4a90d418af1..815253d03b85a7a476c1efdeca9496fd64afc137 100644 +index 1360aa8202542d3d0f32247f1123575fc2c38ff1..b177428857e17a0fb9df0031d60e3027d5b996a1 100644 --- a/src/main/java/net/minecraft/Util.java +++ b/src/main/java/net/minecraft/Util.java -@@ -490,13 +490,27 @@ public class Util { - return object; +@@ -40,6 +40,7 @@ import java.time.Duration; + import java.time.Instant; + import java.time.ZonedDateTime; + import java.time.format.DateTimeFormatter; ++import java.util.ArrayList; + import java.util.Arrays; + import java.util.EnumMap; + import java.util.Iterator; +@@ -586,17 +587,44 @@ public class Util { + return enumMap; } + // Leaf start - Faster sequencing of futures for chunk structure gen public static CompletableFuture> sequence(List> futures) { + return sequence(futures, false); + } -+ // Leaf end - Faster sequencing of futures for chunk structure gen -+ + public static CompletableFuture> sequence(List> futures, boolean useFaster) { ++ // Leaf end - Faster sequencing of futures for chunk structure gen if (futures.isEmpty()) { return CompletableFuture.completedFuture(List.of()); } else if (futures.size() == 1) { @@ -29,30 +36,48 @@ index 0e38a641d8e537750166b56c57aca4a90d418af1..815253d03b85a7a476c1efdeca9496fd CompletableFuture completableFuture = CompletableFuture.allOf(futures.toArray(new CompletableFuture[0])); + // Leaf start - Faster sequencing of futures for chunk structure gen + if (org.dreeam.leaf.config.modules.opt.FasterStructureGenFutureSequencing.enabled && useFaster) { -+ return completableFuture.thenCompose(void_ -> -+ CompletableFuture.supplyAsync(() -> -+ futures.stream().map(CompletableFuture::join).toList())); ++ return sequenceFaster(futures, completableFuture); + } -+ // Leaf end ++ // Leaf end - Faster sequencing of futures for chunk structure gen + return completableFuture.thenApply(void_ -> futures.stream().map(CompletableFuture::join).toList()); } } + ++ // Leaf start - Faster sequencing of futures for chunk structure gen ++ private static CompletableFuture> sequenceFaster(List> futures, CompletableFuture completableFuture) { ++ return completableFuture.thenCompose(void_ -> ++ CompletableFuture.supplyAsync(() -> { ++ List list = new ArrayList<>(); ++ ++ for (CompletableFuture future : futures) { ++ list.add(future.join()); ++ } ++ ++ return list; ++ } ++ )); ++ } ++ // Leaf end - Faster sequencing of futures for chunk structure gen ++ + public static CompletableFuture> sequenceFailFast(List> futures) { + CompletableFuture> completableFuture = new CompletableFuture<>(); + return fallibleSequence(futures, completableFuture::completeExceptionally).applyToEither(completableFuture, Function.identity()); diff --git a/src/main/java/net/minecraft/server/ReloadableServerRegistries.java b/src/main/java/net/minecraft/server/ReloadableServerRegistries.java -index 908431652a0fea79b5a0cee1efd0c7a7d524b614..f4386490897549c898c0755e82bac3b387479e93 100644 +index ea1cbd7a3897ea4a86877a557da264387ef78a38..d551d9c00ef0eec405f78c9caa482d3bbaf23538 100644 --- a/src/main/java/net/minecraft/server/ReloadableServerRegistries.java +++ b/src/main/java/net/minecraft/server/ReloadableServerRegistries.java -@@ -51,7 +51,7 @@ public class ReloadableServerRegistries { - List>> list = LootDataType.values() - .map(type -> scheduleElementParse((LootDataType)type, registryOps, resourceManager, prepareExecutor, conversions)) // Paper +@@ -54,7 +54,7 @@ public class ReloadableServerRegistries { + List>> list2 = LootDataType.values() + .map(type -> scheduleRegistryLoad((LootDataType)type, registryOps, resourceManager, prepareExecutor, conversions)) // Paper .toList(); -- CompletableFuture>> completableFuture = Util.sequence(list); -+ CompletableFuture>> completableFuture = Util.sequence(list, false); // Leaf - Faster sequencing of futures for chunk structure gen - return completableFuture.thenApplyAsync(registries -> apply(dynamicRegistries, (List>)registries), prepareExecutor); - } - +- CompletableFuture>> completableFuture = Util.sequence(list2); ++ CompletableFuture>> completableFuture = Util.sequence(list2, false); // Leaf - Faster sequencing of futures for chunk structure gen + return completableFuture.thenApplyAsync( + registries -> createAndValidateFullContext(dynamicRegistries, provider, (List>)registries), prepareExecutor + ); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java -index a6b6e5ea191c0e2cd7a2e4f01b89d8af40a83c1b..713fced29fbd819ee6f151c7f3e462f58a21d5e6 100644 +index a20520a6bd28bae1cee82258ac49d9753faba2bd..b4d9e43b524b9cc6da4bb50d28ce1e854f5abcce 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -270,7 +270,7 @@ public class ChunkGeneratorStructureState { diff --git a/patches/server/0048-Reduce-items-finding-hopper-nearby-check.patch b/patches/server/0044-Reduce-items-finding-hopper-nearby-check.patch similarity index 91% rename from patches/server/0048-Reduce-items-finding-hopper-nearby-check.patch rename to patches/server/0044-Reduce-items-finding-hopper-nearby-check.patch index 394ea4807..e69451df2 100644 --- a/patches/server/0048-Reduce-items-finding-hopper-nearby-check.patch +++ b/patches/server/0044-Reduce-items-finding-hopper-nearby-check.patch @@ -9,10 +9,10 @@ But still recommend to turn-off `checkForMinecartNearItemWhileActive` Since `Reduce-hopper-item-checks.patch` will cause lag under massive dropped items diff --git a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -index a5b392364c2dfceafbee4523699431381db7e7f9..af0f7ce6efa799e6f5ea6d34250d462f51b1c4e3 100644 +index 186fb46e491bcf5d2a85e68ecf8e13b87381875c..8eed7d70d5716f6d58c46b31a526b5de2a891f16 100644 --- a/src/main/java/net/minecraft/world/entity/item/ItemEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/ItemEntity.java -@@ -241,7 +241,9 @@ public class ItemEntity extends Entity implements TraceableEntity { +@@ -242,7 +242,9 @@ public class ItemEntity extends Entity implements TraceableEntity { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause return; // Gale - EMC - reduce hopper item checks } @@ -24,7 +24,7 @@ index a5b392364c2dfceafbee4523699431381db7e7f9..af0f7ce6efa799e6f5ea6d34250d462f } } diff --git a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java -index 9df60b85bb47d25f375132b775163befb36987f7..af052b2d746ccb28ffff386c63fd839b2fb4df62 100644 +index 838d15a8c81f168b6d94adb602a996123313aaea..bbc47a0d6038c4339e1c29d58bd6a9f744e896a9 100644 --- a/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java +++ b/src/main/java/org/galemc/gale/configuration/GaleWorldConfiguration.java @@ -75,10 +75,11 @@ public class GaleWorldConfiguration extends ConfigurationPart { diff --git a/patches/server/0049-Linear-region-file-format.patch b/patches/server/0045-Linear-region-file-format.patch similarity index 82% rename from patches/server/0049-Linear-region-file-format.patch rename to patches/server/0045-Linear-region-file-format.patch index 42a9ddee5..bc053acbf 100644 --- a/patches/server/0049-Linear-region-file-format.patch +++ b/patches/server/0045-Linear-region-file-format.patch @@ -12,10 +12,10 @@ This format saves about 50% of disk space. Documentation: https://github.com/xymb-endcrystalme/LinearRegionFileFormatTools diff --git a/build.gradle.kts b/build.gradle.kts -index 47ade0d7de17d2ad306b1f872d9399edcc295cf2..6aefe4052d410dee3f18671119252ea799988e74 100644 +index c35ffb8565218d9368cc583ae96ea86424184eed..1e3dc0cf613a621bbf0873bcffb01c69aa119e92 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -21,6 +21,11 @@ dependencies { +@@ -33,6 +33,11 @@ dependencies { } // Leaf end - Leaf Config @@ -25,56 +25,53 @@ index 47ade0d7de17d2ad306b1f872d9399edcc295cf2..6aefe4052d410dee3f18671119252ea7 + // LinearPaper end + // Paper start - implementation("org.jline:jline-terminal-jansi:3.27.1") // Leaf - Bump Dependencies - implementation("net.minecrell:terminalconsoleappender:1.3.0") + implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ + implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java -index 73df26b27146bbad2106d57b22dd3c792ed3dd1d..d2f209dd61f4412478a4b8fbe3489787d30bf74b 100644 +index a814512fcfb85312474ae2c2c21443843bf57831..f80c75c561313625b694b433692aa429b8f8fde9 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/ChunkSystemRegionFileStorage.java -@@ -7,8 +7,8 @@ public interface ChunkSystemRegionFileStorage { +@@ -8,9 +8,9 @@ public interface ChunkSystemRegionFileStorage { public boolean moonrise$doesRegionFileNotExistNoIO(final int chunkX, final int chunkZ); - public RegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); -+ public org.stupidcraft.linearpaper.region.IRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // LinearPaper // Leaf ++ public org.stupidcraft.linearpaper.region.IRegionFile moonrise$getRegionFileIfLoaded(final int chunkX, final int chunkZ); // LinearPaper - public RegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; -+ public org.stupidcraft.linearpaper.region.IRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // LinearPaper // Leaf ++ public org.stupidcraft.linearpaper.region.IRegionFile moonrise$getRegionFileIfExists(final int chunkX, final int chunkZ) throws IOException; // LinearPaper - } -diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java -index 3218cbf84f54daf06e84442d5eb1a36d8da6b215..ec9b27177dc526510e86d85f48f167b44c01ac62 100644 ---- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java -+++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/RegionFileIOThread.java -@@ -1043,9 +1043,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread { - return ((ChunkSystemRegionFileStorage)(Object)this.getCache()).moonrise$doesRegionFileNotExistNoIO(chunkX, chunkZ); - } + public MoonriseRegionFileIO.RegionDataController.WriteData moonrise$startWrite( + final int chunkX, final int chunkZ, final CompoundTag compound +diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java +index 1acea58838f057ab87efd103cbecb6f5aeaef393..48a6d8b534943393c26180fbf341b77bd2d5bc48 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java ++++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/io/MoonriseRegionFileIO.java +@@ -1462,7 +1462,7 @@ public final class MoonriseRegionFileIO { + + public static interface IORunnable { + +- public void run(final RegionFile regionFile) throws IOException; ++ public void run(final org.stupidcraft.linearpaper.region.IRegionFile regionFile) throws IOException; // LinearPaper -- public T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function function) { -+ public T computeForRegionFile(final int chunkX, final int chunkZ, final boolean existingOnly, final Function function) { // LinearPaper - final RegionFileStorage cache = this.getCache(); -- final RegionFile regionFile; -+ final org.stupidcraft.linearpaper.region.IRegionFile regionFile; // LinearPaper - synchronized (cache) { - try { - if (existingOnly) { -@@ -1061,9 +1061,9 @@ public final class RegionFileIOThread extends PrioritisedQueueExecutorThread { - } } + } +diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java +index 51c126735ace8fdde89ad97b5cab62f244212db0..4046f0aaa153e00277bf14f009fbe14aa8859fec 100644 +--- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java ++++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/storage/ChunkSystemChunkBuffer.java +@@ -8,5 +8,5 @@ public interface ChunkSystemChunkBuffer { -- public T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function function) { -+ public T computeForRegionFileIfLoaded(final int chunkX, final int chunkZ, final Function function) { // LinearPaper - final RegionFileStorage cache = this.getCache(); -- final RegionFile regionFile; -+ final org.stupidcraft.linearpaper.region.IRegionFile regionFile; // LinearPaper + public void moonrise$setWriteOnClose(final boolean value); - synchronized (cache) { - regionFile = ((ChunkSystemRegionFileStorage)(Object)cache).moonrise$getRegionFileIfLoaded(chunkX, chunkZ); +- public void moonrise$write(final RegionFile regionFile) throws IOException; ++ public void moonrise$write(final org.stupidcraft.linearpaper.region.IRegionFile regionFile) throws IOException; // LinearPaper + } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7c8d28fe612ef2e37d5d02d449946dce2bb7d524..a226a8f066754fe609583071004395abef9d4709 100644 +index 2d231c01fe752d3a97965a0bef01e7c0f6cb1611..87e52d6dcd855c80b3e6b4f4010b596bf8649c80 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -967,10 +967,10 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop> progressMap = Reference2FloatMaps.synchronize(new Reference2FloatOpenHashMap()); volatile Component status = Component.translatable("optimizeWorld.stage.counting"); @@ -100,7 +97,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..dc41c7c4616fa925427cd5a862f3923c final DimensionDataStorage overworldDataStorage; public WorldUpgrader(LevelStorageSource.LevelStorageAccess session, DataFixer dataFixer, RegistryAccess dynamicRegistryManager, boolean eraseCache, boolean recreateRegionFiles) { -@@ -400,7 +400,7 @@ public class WorldUpgrader { +@@ -399,7 +399,7 @@ public class WorldUpgrader implements AutoCloseable { private static List getAllChunkPositions(RegionStorageInfo key, Path regionDirectory) { File[] afile = regionDirectory.toFile().listFiles((file, s) -> { @@ -109,7 +106,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..dc41c7c4616fa925427cd5a862f3923c }); if (afile == null) { -@@ -420,7 +420,7 @@ public class WorldUpgrader { +@@ -419,7 +419,7 @@ public class WorldUpgrader implements AutoCloseable { List list1 = Lists.newArrayList(); try { @@ -118,7 +115,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..dc41c7c4616fa925427cd5a862f3923c try { for (int i1 = 0; i1 < 32; ++i1) { -@@ -483,7 +483,7 @@ public class WorldUpgrader { +@@ -482,7 +482,7 @@ public class WorldUpgrader implements AutoCloseable { protected abstract boolean tryProcessOnePosition(T storage, ChunkPos chunkPos, ResourceKey worldKey); @@ -127,7 +124,7 @@ index cb39c629af1827078f35904a373d35a63fea17ff..dc41c7c4616fa925427cd5a862f3923c if (WorldUpgrader.this.recreateRegionFiles) { if (this.previousWriteFuture != null) { this.previousWriteFuture.join(); -@@ -508,7 +508,7 @@ public class WorldUpgrader { +@@ -507,7 +507,7 @@ public class WorldUpgrader implements AutoCloseable { } } @@ -137,19 +134,19 @@ index cb39c629af1827078f35904a373d35a63fea17ff..dc41c7c4616fa925427cd5a862f3923c } diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java -index b0ef7d56d736353722dcb92442a43c07be290cf1..280e39f2ae3dacc398453c7aac345acb4312addb 100644 +index b26a5b76cd30c96ce15ced5ac51222a8333bde52..dd42303de58274c24394da26bda52bf0d09df7b2 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java @@ -28,7 +28,7 @@ import net.minecraft.nbt.NbtIo; // Paper import net.minecraft.world.level.ChunkPos; import org.slf4j.Logger; --public class RegionFile implements AutoCloseable { -+public class RegionFile implements org.stupidcraft.linearpaper.region.IRegionFile, AutoCloseable { // LinearPaper +-public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile { // Paper - rewrite chunk system ++public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patches.chunk_system.storage.ChunkSystemRegionFile, org.stupidcraft.linearpaper.region.IRegionFile { // Paper - rewrite chunk system // LinearPaper private static final Logger LOGGER = LogUtils.getLogger(); private static final int SECTOR_BYTES = 4096; -@@ -129,7 +129,7 @@ public class RegionFile implements AutoCloseable { +@@ -129,7 +129,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche } // note: only call for CHUNK regionfiles @@ -158,7 +155,16 @@ index b0ef7d56d736353722dcb92442a43c07be290cf1..280e39f2ae3dacc398453c7aac345acb if (!this.canRecalcHeader) { return false; } -@@ -928,10 +928,10 @@ public class RegionFile implements AutoCloseable { +@@ -810,7 +810,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche + } + } + +- protected synchronized void write(ChunkPos pos, ByteBuffer buf) throws IOException { ++ public synchronized void write(ChunkPos pos, ByteBuffer buf) throws IOException { // LinearPaper - protected -> public + int i = RegionFile.getOffsetIndex(pos); + int j = this.offsets.get(i); + int k = RegionFile.getSectorNumber(j); +@@ -952,10 +952,10 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche private static int getChunkIndex(int x, int z) { return (x & 31) + (z & 31) * 32; } @@ -171,7 +177,7 @@ index b0ef7d56d736353722dcb92442a43c07be290cf1..280e39f2ae3dacc398453c7aac345acb final int offset = getChunkIndex(x, z); boolean previous = this.oversized[offset] == 1; this.oversized[offset] = (byte) (oversized ? 1 : 0); -@@ -970,7 +970,7 @@ public class RegionFile implements AutoCloseable { +@@ -994,7 +994,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche return this.path.getParent().resolve(this.path.getFileName().toString().replaceAll("\\.mca$", "") + "_oversized_" + x + "_" + z + ".nbt"); } @@ -180,11 +186,20 @@ index b0ef7d56d736353722dcb92442a43c07be290cf1..280e39f2ae3dacc398453c7aac345acb Path file = getOversizedFile(x, z); try (DataInputStream out = new DataInputStream(new java.io.BufferedInputStream(new InflaterInputStream(Files.newInputStream(file))))) { return NbtIo.read((java.io.DataInput) out); +@@ -1021,7 +1021,7 @@ public class RegionFile implements AutoCloseable, ca.spottedleaf.moonrise.patche + } + + @Override +- public final void moonrise$write(final RegionFile regionFile) throws IOException { ++ public final void moonrise$write(final org.stupidcraft.linearpaper.region.IRegionFile regionFile) throws IOException { // LinearPaper + regionFile.write(this.pos, ByteBuffer.wrap(this.buf, 0, this.count)); + } + // Paper end - rewrite chunk system diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526413cd534 100644 +index 79aca7e7cd2f860464657e77e935391642981fad..6721adad3d227acba8daba80b0b7e1df3bc0b046 100644 --- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java +++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileStorage.java -@@ -21,7 +21,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -23,7 +23,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public static final String ANVIL_EXTENSION = ".mca"; private static final int MAX_CACHE_SIZE = 256; @@ -193,10 +208,10 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 private final RegionStorageInfo info; private final Path folder; private final boolean sync; -@@ -30,7 +30,11 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -32,7 +32,11 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise private static final int REGION_SHIFT = 5; - private static final int MAX_NON_EXISTING_CACHE = 1024 * 64; - private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet(MAX_NON_EXISTING_CACHE+1); + private static final int MAX_NON_EXISTING_CACHE = 1024 * 4; + private final it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet nonExistingRegionFiles = new it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet(); + // Leaf start - Linear region format private static String getRegionFileName(final int chunkX, final int chunkZ) { + if (org.dreeam.leaf.config.modules.misc.RegionFormatConfig.regionFormatType == org.stupidcraft.linearpaper.region.EnumRegionFileExtension.LINEAR) { @@ -205,7 +220,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 return "r." + (chunkX >> REGION_SHIFT) + "." + (chunkZ >> REGION_SHIFT) + ".mca"; } -@@ -66,15 +70,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -68,15 +72,15 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } @Override @@ -224,7 +239,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 if (ret != null) { return ret; } -@@ -98,7 +102,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -100,7 +104,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise FileUtil.createDirectoriesSafe(this.folder); @@ -233,7 +248,34 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 this.regionCache.putAndMoveToFirst(key, ret); -@@ -115,7 +119,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -119,7 +123,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + } + + final ChunkPos pos = new ChunkPos(chunkX, chunkZ); +- final RegionFile regionFile = this.getRegionFile(pos); ++ final org.stupidcraft.linearpaper.region.IRegionFile regionFile = this.getRegionFile(pos); // LinearPaper + + // note: not required to keep regionfile loaded after this call, as the write param takes a regionfile as input + // (and, the regionfile parameter is unused for writing until the write call) +@@ -153,7 +157,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + ) throws IOException { + final ChunkPos pos = new ChunkPos(chunkX, chunkZ); + if (writeData.result() == ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.WriteData.WriteResult.DELETE) { +- final RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); ++ final org.stupidcraft.linearpaper.region.IRegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // LinearPaper + if (regionFile != null) { + regionFile.clear(pos); + } // else: didn't exist +@@ -168,7 +172,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + public final ca.spottedleaf.moonrise.patches.chunk_system.io.MoonriseRegionFileIO.RegionDataController.ReadData moonrise$readData( + final int chunkX, final int chunkZ + ) throws IOException { +- final RegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); ++ final org.stupidcraft.linearpaper.region.IRegionFile regionFile = this.moonrise$getRegionFileIfExists(chunkX, chunkZ); // LinearPaper + + final DataInputStream input = regionFile == null ? null : regionFile.getChunkDataInputStream(new ChunkPos(chunkX, chunkZ)); + +@@ -221,7 +225,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @Nullable public static ChunkPos getRegionFileCoordinates(Path file) { String fileName = file.getFileName().toString(); @@ -242,16 +284,22 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 return null; } -@@ -143,7 +147,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise - this.isChunkData = isChunkDataFolder(this.folder); // Paper - recalculate region file headers +@@ -250,12 +254,12 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise + } + + // Paper start - rewrite chunk system +- public RegionFile getRegionFile(ChunkPos chunkcoordintpair) throws IOException { ++ public org.stupidcraft.linearpaper.region.IRegionFile getRegionFile(ChunkPos chunkcoordintpair) throws IOException { // LinearPaper + return this.getRegionFile(chunkcoordintpair, false); } + // Paper end - rewrite chunk system - public RegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Paper - public + public org.stupidcraft.linearpaper.region.IRegionFile getRegionFile(ChunkPos chunkcoordintpair, boolean existingOnly) throws IOException { // CraftBukkit // Paper - public // LinearPaper // Paper start - rewrite chunk system if (existingOnly) { return this.moonrise$getRegionFileIfExists(chunkcoordintpair.x, chunkcoordintpair.z); -@@ -151,7 +155,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -263,7 +267,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise synchronized (this) { final long key = ChunkPos.asLong(chunkcoordintpair.x >> REGION_SHIFT, chunkcoordintpair.z >> REGION_SHIFT); @@ -260,7 +308,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 if (ret != null) { return ret; } -@@ -160,13 +164,13 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -272,13 +276,13 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise this.regionCache.removeLast().close(); } @@ -276,7 +324,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 this.regionCache.putAndMoveToFirst(key, ret); -@@ -186,7 +190,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -298,7 +302,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Gale end - branding changes } @@ -285,7 +333,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 synchronized (regionfile) { try (DataInputStream datainputstream = regionfile.getChunkDataInputStream(chunkCoordinate)) { CompoundTag oversizedData = regionfile.getOversizedData(chunkCoordinate.x, chunkCoordinate.z); -@@ -221,7 +225,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -333,7 +337,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise @Nullable public CompoundTag read(ChunkPos pos) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -294,7 +342,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 if (regionfile == null) { return null; } -@@ -285,7 +289,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -397,7 +401,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise public void scanChunk(ChunkPos chunkPos, StreamTagVisitor scanner) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -303,16 +351,16 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 if (regionfile == null) { return; } -@@ -315,7 +319,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -427,7 +431,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise } - public void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { // Paper - public + public void write(ChunkPos pos, @Nullable CompoundTag nbt) throws IOException { // Paper - rewrite chunk system - public - RegionFile regionfile = this.getRegionFile(pos, nbt == null); // CraftBukkit // Paper - rewrite chunk system + org.stupidcraft.linearpaper.region.IRegionFile regionfile = this.getRegionFile(pos, nbt == null); // CraftBukkit // Paper - rewrite chunk system // LinearPaper // Paper start - rewrite chunk system if (regionfile == null) { // if the RegionFile doesn't exist, no point in deleting from it -@@ -374,7 +378,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -471,7 +475,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -321,7 +369,7 @@ index 54f7aa95cfbcf39bb86ad1b4eb0f9ff2f8526030..7c4b81e97562bb158478c70dae082526 try { regionFile.close(); } catch (final IOException ex) { -@@ -391,7 +395,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise +@@ -488,7 +492,7 @@ public class RegionFileStorage implements AutoCloseable, ca.spottedleaf.moonrise // Paper start - rewrite chunk system synchronized (this) { final ExceptionCollector exceptionCollector = new ExceptionCollector<>(); @@ -462,15 +510,16 @@ index 0000000000000000000000000000000000000000..8eba172be9bce7cccd27d27bee2d6c6f +} diff --git a/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java b/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java new file mode 100644 -index 0000000000000000000000000000000000000000..6417f5b6daa35044995dd0aa9cfc24acd8ce4287 +index 0000000000000000000000000000000000000000..77a3629aeae5dfde37b8ea3da97ed008a30e1b94 --- /dev/null +++ b/src/main/java/org/stupidcraft/linearpaper/region/IRegionFile.java -@@ -0,0 +1,26 @@ +@@ -0,0 +1,28 @@ +package org.stupidcraft.linearpaper.region; + +import java.io.DataInputStream; +import java.io.DataOutputStream; +import java.io.IOException; ++import java.nio.ByteBuffer; +import java.nio.file.Path; + +import net.minecraft.nbt.CompoundTag; @@ -482,6 +531,7 @@ index 0000000000000000000000000000000000000000..6417f5b6daa35044995dd0aa9cfc24ac + void clear(ChunkPos pos) throws IOException; + void close() throws IOException; + void setOversized(int x, int z, boolean b) throws IOException; ++ void write(ChunkPos pos, ByteBuffer buffer) throws IOException; + + boolean hasChunk(ChunkPos pos); + boolean doesChunkExist(ChunkPos pos) throws Exception; diff --git a/patches/server/0050-Plazma-Add-some-missing-Pufferfish-configurations.patch b/patches/server/0046-Plazma-Add-some-missing-Pufferfish-configurations.patch similarity index 70% rename from patches/server/0050-Plazma-Add-some-missing-Pufferfish-configurations.patch rename to patches/server/0046-Plazma-Add-some-missing-Pufferfish-configurations.patch index ea5b27b48..8c61e94db 100644 --- a/patches/server/0050-Plazma-Add-some-missing-Pufferfish-configurations.patch +++ b/patches/server/0046-Plazma-Add-some-missing-Pufferfish-configurations.patch @@ -10,64 +10,64 @@ Add Pufferfish DAB support for Camel, Sniffer https://github.com/pufferfish-gg/Pufferfish/issues/83 diff --git a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -index e696d2a0b12c520b3ae82443107af678e9e36c22..253a5a814cdd6e7090ced4f92447dd4c49a66bad 100644 +index 8e8345d9062b1e666cd1b987c44175741b094d07..8046dcd9740c64cc768351f3fd174a836a839e05 100644 --- a/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java +++ b/src/main/java/net/minecraft/world/entity/animal/armadillo/Armadillo.java -@@ -161,8 +161,10 @@ public class Armadillo extends Animal { +@@ -159,8 +159,10 @@ public class Armadillo extends Animal { return ArmadilloAi.makeBrain(this.brainProvider().makeBrain(dynamic)); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel world) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations - ((Brain) this.brain).tick((ServerLevel) this.level(), this); // CraftBukkit - decompile error + ((Brain) this.brain).tick(world, this); // CraftBukkit - decompile error ArmadilloAi.updateActivity(this); if (this.isAlive() && !this.isBaby() && --this.scuteTime <= 0) { diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 5a704a4c815e6670c93c750bc9f0e22100cd6923..608a22551c344d8a9e666386f913fa9ad360a18d 100644 +index 542b972b266eae642b220025c6173c738fcff80f..c0595b595905e4f876e013a16e75204d9ceeead9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -152,10 +152,12 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl +@@ -150,10 +150,12 @@ public class Camel extends AbstractHorse { return pose == Pose.SITTING ? Camel.SITTING_DIMENSIONS.scale(this.getAgeScale()) : super.getDefaultDimensions(pose); } + private int behaviorTick = 0; // Leaf - Plazma - Add missing Pufferfish configurations @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel world) { Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations - behaviorcontroller.tick((ServerLevel) this.level(), this); + behaviorcontroller.tick(world, this); CamelAi.updateActivity(this); - super.customServerAiStep(); + super.customServerAiStep(world); diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index bab2230f1cf8baa122595f4e48f58d405bedd09d..8c2038e154730b1f796ab34f2555dc88fd542173 100644 +index bd752597c925a68f834939d502a7224e022ae79e..dc0f8bf73170f5012a5d4af3a7e823352d684bd9 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -503,8 +503,10 @@ public class Sniffer extends Animal { +@@ -491,8 +491,10 @@ public class Sniffer extends Animal { return Brain.provider(SnifferAi.MEMORY_TYPES, SnifferAi.SENSOR_TYPES); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel world) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations - this.getBrain().tick((ServerLevel) this.level(), this); + this.getBrain().tick(world, this); SnifferAi.updateActivity(this); - super.customServerAiStep(); + super.customServerAiStep(world); diff --git a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -index afe1e0518be486c7e3c3103fc66980b5c234c1ac..3f740d511e2380214dbaf70cd0304db867f51cb1 100644 +index 2e6b6ef451cd3caa1fde466e5c670b7f17814753..b38245294249086a0dfa15147a424d76b17a5af9 100644 --- a/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java +++ b/src/main/java/net/minecraft/world/entity/monster/breeze/Breeze.java -@@ -226,8 +226,10 @@ public class Breeze extends Monster { - return pos.closerThan(vec3, 4.0, 10.0); +@@ -232,8 +232,10 @@ public class Breeze extends Monster { + return pos.closerThan(vec3d1, 4.0D, 10.0D); } + private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel world) { + if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations - this.getBrain().tick((ServerLevel)this.level(), this); + this.getBrain().tick(world, this); BreezeAi.updateActivity(this); - super.customServerAiStep(); + super.customServerAiStep(world); diff --git a/patches/server/0051-Plazma-Add-missing-purpur-configuration-options.patch b/patches/server/0047-Plazma-Add-missing-purpur-configuration-options.patch similarity index 84% rename from patches/server/0051-Plazma-Add-missing-purpur-configuration-options.patch rename to patches/server/0047-Plazma-Add-missing-purpur-configuration-options.patch index d08f1a940..2e809ec23 100644 --- a/patches/server/0051-Plazma-Add-missing-purpur-configuration-options.patch +++ b/patches/server/0047-Plazma-Add-missing-purpur-configuration-options.patch @@ -9,7 +9,7 @@ Original project: https://github.com/PlazmaMC/PlazmaBukkit Add more Purpur configurable options for entities diff --git a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java -index 82a941117edcca155c04afc11a8e018574db9922..ec4b1f58a01677a931cbadd5b5d9cf7779394d60 100644 +index b9f39d873e243da34aafa9f285978d2d9f6b0100..349c444b0c8acc509616de6bc809e2bad9c8e115 100644 --- a/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java +++ b/src/main/java/net/minecraft/world/entity/animal/allay/Allay.java @@ -160,6 +160,18 @@ public class Allay extends PathfinderMob implements InventoryCarrier, VibrationS @@ -32,10 +32,10 @@ index 82a941117edcca155c04afc11a8e018574db9922..ec4b1f58a01677a931cbadd5b5d9cf77 protected Brain.Provider brainProvider() { return Brain.provider(Allay.MEMORY_TYPES, Allay.SENSOR_TYPES); diff --git a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -index 608a22551c344d8a9e666386f913fa9ad360a18d..267aaf54ead1a0743206f414bd29564a0ff5d334 100644 +index c0595b595905e4f876e013a16e75204d9ceeead9..4b54783c004bbf2e6fab3fa65eb64444d009c5bc 100644 --- a/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java +++ b/src/main/java/net/minecraft/world/entity/animal/camel/Camel.java -@@ -98,6 +98,18 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl +@@ -96,6 +96,18 @@ public class Camel extends AbstractHorse { } // Purpur end @@ -54,20 +54,20 @@ index 608a22551c344d8a9e666386f913fa9ad360a18d..267aaf54ead1a0743206f414bd29564a @Override public void addAdditionalSaveData(CompoundTag nbt) { super.addAdditionalSaveData(nbt); -@@ -157,7 +169,7 @@ public class Camel extends AbstractHorse implements PlayerRideableJumping, Saddl - protected void customServerAiStep() { +@@ -155,7 +167,7 @@ public class Camel extends AbstractHorse { + protected void customServerAiStep(ServerLevel world) { Brain behaviorcontroller = (Brain) this.getBrain(); // CraftBukkit - decompile error - if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations // Leaf - Plazma - Add missing purpur configurations - behaviorcontroller.tick((ServerLevel) this.level(), this); + behaviorcontroller.tick(world, this); CamelAi.updateActivity(this); - super.customServerAiStep(); + super.customServerAiStep(world); diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -index da026533b15a1981000e73bba6c5209c13de28dc..96d2077abd0112f2b2b8c4678447afbf899cd290 100644 +index d8fe42996c8ba3d44e31197b24294b86b845e2a8..6575e5f5e574db5bb4243a9bed426f3316e3e2ec 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Frog.java -@@ -162,6 +162,23 @@ public class Frog extends Animal implements VariantHolder> { +@@ -163,6 +163,23 @@ public class Frog extends Animal implements VariantHolder> { } // Purpur end @@ -92,10 +92,10 @@ index da026533b15a1981000e73bba6c5209c13de28dc..96d2077abd0112f2b2b8c4678447afbf return this.level().purpurConfig.frogBreedingTicks; } diff --git a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -index 5addd3243dd63041442f2a6bcf92a2128e4242c1..2ebce53c728a67a619255a7e8796dcb1a6f82045 100644 +index 72a858ac4ebcfa7520a74bd52501521af64ffcab..d20d7eb89ead872ab90a5b43d6298d45b657c902 100644 --- a/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java +++ b/src/main/java/net/minecraft/world/entity/animal/frog/Tadpole.java -@@ -95,6 +95,23 @@ public class Tadpole extends AbstractFish { +@@ -93,6 +93,23 @@ public class Tadpole extends AbstractFish { } // Purpur end @@ -120,10 +120,10 @@ index 5addd3243dd63041442f2a6bcf92a2128e4242c1..2ebce53c728a67a619255a7e8796dcb1 protected PathNavigation createNavigation(Level world) { return new WaterBoundPathNavigation(this, world); diff --git a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -index 8c2038e154730b1f796ab34f2555dc88fd542173..f5a7d8b161a896876eccbd4d7e3025f325337042 100644 +index dc0f8bf73170f5012a5d4af3a7e823352d684bd9..47bbb60edcca9840f1bc70b90bd8f2a4dee45a21 100644 --- a/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java +++ b/src/main/java/net/minecraft/world/entity/animal/sniffer/Sniffer.java -@@ -122,6 +122,18 @@ public class Sniffer extends Animal { +@@ -116,6 +116,18 @@ public class Sniffer extends Animal { } // Purpur end @@ -142,20 +142,20 @@ index 8c2038e154730b1f796ab34f2555dc88fd542173..f5a7d8b161a896876eccbd4d7e3025f3 @Override protected void defineSynchedData(SynchedEntityData.Builder builder) { super.defineSynchedData(builder); -@@ -506,7 +518,7 @@ public class Sniffer extends Animal { +@@ -494,7 +506,7 @@ public class Sniffer extends Animal { private int behaviorTick; // Leaf - Plazma - Add missing Pufferfish configurations @Override - protected void customServerAiStep() { + protected void customServerAiStep(ServerLevel world) { - if (this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Leaf - Plazma - Add missing Pufferfish configurations // Leaf - Plazma - Add missing purpur configurations - this.getBrain().tick((ServerLevel) this.level(), this); + this.getBrain().tick(world, this); SnifferAi.updateActivity(this); - super.customServerAiStep(); + super.customServerAiStep(world); diff --git a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -index 1e31f20da2450e92228d511f060ff9f5a3207005..de11e6b0d997b3bb2403441ab430a894ae8c6e7d 100644 +index a429de1fdb4823b1f1df42dfe213853cc06ef1c2..ef1bbd47d22a808b3f5bfc715eda3f4d13bd80aa 100644 --- a/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java +++ b/src/main/java/net/minecraft/world/entity/monster/warden/Warden.java -@@ -150,6 +150,23 @@ public class Warden extends Monster implements VibrationSystem { +@@ -151,6 +151,23 @@ public class Warden extends Monster implements VibrationSystem { } // Purpur end @@ -179,29 +179,29 @@ index 1e31f20da2450e92228d511f060ff9f5a3207005..de11e6b0d997b3bb2403441ab430a894 @Override public Packet getAddEntityPacket(ServerEntity entityTrackerEntry) { return new ClientboundAddEntityPacket(this, entityTrackerEntry, this.hasPose(Pose.EMERGING) ? 1 : 0); -@@ -301,7 +318,7 @@ public class Warden extends Monster implements VibrationSystem { - protected void customServerAiStep() { - ServerLevel worldserver = (ServerLevel) this.level(); - +@@ -300,7 +317,7 @@ public class Warden extends Monster implements VibrationSystem { + private int behaviorTick = 0; // Pufferfish + @Override + protected void customServerAiStep(ServerLevel world) { - if (this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish + if ((getRider() == null || !this.isControllable()) && this.behaviorTick++ % this.activatedPriority == 0) // Pufferfish // Leaf - Plazma - Add missing purpur configurations - this.getBrain().tick(worldserver, this); - super.customServerAiStep(); + this.getBrain().tick(world, this); + super.customServerAiStep(world); if ((this.tickCount + this.getId()) % 120 == 0) { -diff --git a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -index c14019a131c90c699b8a76bada82592b66f0fa89..bc0f0fd4b356a2f5b212c7d4a2007e12733439d6 100644 ---- a/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -+++ b/src/main/java/net/minecraft/world/entity/vehicle/ChestBoat.java -@@ -45,7 +45,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java +index 1f4cc08e84a23213bb9786ea09ad77caeec2d336..06d45906924d6470d75445dea23c9b90dac6545f 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractChestBoat.java +@@ -46,7 +46,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto - public ChestBoat(EntityType type, Level world) { - super(type, world); + public AbstractChestBoat(EntityType type, Level world, Supplier itemSupplier) { + super(type, world, itemSupplier); - this.itemStacks = NonNullList.withSize(27, ItemStack.EMPTY); + this.itemStacks = NonNullList.withSize(org.purpurmc.purpur.PurpurConfig.chestBoatRows * 9, ItemStack.EMPTY); // Leaf - Plazma } - public ChestBoat(Level world, double d0, double d1, double d2) { -@@ -177,7 +177,7 @@ public class ChestBoat extends Boat implements HasCustomInventoryScreen, Contain + @Override +@@ -142,7 +142,7 @@ public abstract class AbstractChestBoat extends AbstractBoat implements HasCusto @Override public int getContainerSize() { @@ -211,10 +211,10 @@ index c14019a131c90c699b8a76bada82592b66f0fa89..bc0f0fd4b356a2f5b212c7d4a2007e12 @Override diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 3700904b82d3116c1336b86907ce1c2c4644b0ab..654e838d9a77e0dd8fe9fb1d4804785ad0f463c8 100644 +index 4401cd919951e92f613e0899f243b0105dd852b7..05d77ccd9bf8ce0534fbac7d4354536e3187229f 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -@@ -320,6 +320,7 @@ public class PurpurConfig { +@@ -321,6 +321,7 @@ public class PurpurConfig { } public static int barrelRows = 3; @@ -222,7 +222,7 @@ index 3700904b82d3116c1336b86907ce1c2c4644b0ab..654e838d9a77e0dd8fe9fb1d4804785a public static boolean enderChestSixRows = false; public static boolean enderChestPermissionRows = false; public static boolean cryingObsidianValidForPortalFrame = false; -@@ -362,6 +363,7 @@ public class PurpurConfig { +@@ -363,6 +364,7 @@ public class PurpurConfig { case 1 -> 9; default -> 27; }); @@ -231,7 +231,7 @@ index 3700904b82d3116c1336b86907ce1c2c4644b0ab..654e838d9a77e0dd8fe9fb1d4804785a org.bukkit.event.inventory.InventoryType.ENDER_CHEST.setDefaultSize(enderChestSixRows ? 54 : 27); enderChestPermissionRows = getBoolean("settings.blocks.ender_chest.use-permissions-for-rows", enderChestPermissionRows); diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java -index 58ec0b2158052f81c00a78d3bd29244478037909..c3612a5d62bdd6f84319b58f99cdb82d24c9132a 100644 +index 8c9a6084f09f644bf22ac98edac797eea753277f..0ff935f36f65d2274156e134684696ebcc404614 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java @@ -1128,12 +1128,20 @@ public class PurpurWorldConfig { @@ -277,7 +277,7 @@ index 58ec0b2158052f81c00a78d3bd29244478037909..c3612a5d62bdd6f84319b58f99cdb82d } public boolean catRidable = false; -@@ -1739,12 +1755,22 @@ public class PurpurWorldConfig { +@@ -1750,12 +1766,22 @@ public class PurpurWorldConfig { public boolean frogControllable = true; public float frogRidableJumpHeight = 0.65F; public int frogBreedingTicks = 6000; @@ -300,7 +300,7 @@ index 58ec0b2158052f81c00a78d3bd29244478037909..c3612a5d62bdd6f84319b58f99cdb82d } public boolean ghastRidable = false; -@@ -2753,6 +2779,10 @@ public class PurpurWorldConfig { +@@ -2764,6 +2790,10 @@ public class PurpurWorldConfig { public double snifferMaxHealth = 14.0D; public double snifferScale = 1.0D; public int snifferBreedingTicks = 6000; @@ -311,7 +311,7 @@ index 58ec0b2158052f81c00a78d3bd29244478037909..c3612a5d62bdd6f84319b58f99cdb82d private void snifferSettings() { snifferRidable = getBoolean("mobs.sniffer.ridable", snifferRidable); snifferRidableInWater = getBoolean("mobs.sniffer.ridable-in-water", snifferRidableInWater); -@@ -2760,6 +2790,10 @@ public class PurpurWorldConfig { +@@ -2771,6 +2801,10 @@ public class PurpurWorldConfig { snifferMaxHealth = getDouble("mobs.sniffer.attributes.max_health", snifferMaxHealth); snifferScale = Mth.clamp(getDouble("mobs.sniffer.attributes.scale", snifferScale), 0.0625D, 16.0D); snifferBreedingTicks = getInt("mobs.sniffer.breeding-delay-ticks", snifferBreedingTicks); @@ -322,7 +322,7 @@ index 58ec0b2158052f81c00a78d3bd29244478037909..c3612a5d62bdd6f84319b58f99cdb82d } public boolean squidRidable = false; -@@ -2861,10 +2895,20 @@ public class PurpurWorldConfig { +@@ -2872,10 +2906,20 @@ public class PurpurWorldConfig { public boolean tadpoleRidable = false; public boolean tadpoleRidableInWater = true; public boolean tadpoleControllable = true; @@ -343,7 +343,7 @@ index 58ec0b2158052f81c00a78d3bd29244478037909..c3612a5d62bdd6f84319b58f99cdb82d } public boolean traderLlamaRidable = false; -@@ -3089,10 +3133,20 @@ public class PurpurWorldConfig { +@@ -3104,10 +3148,20 @@ public class PurpurWorldConfig { public boolean wardenRidable = false; public boolean wardenRidableInWater = true; public boolean wardenControllable = true; diff --git a/patches/server/0052-Skip-event-if-no-listeners.patch b/patches/server/0048-Skip-event-if-no-listeners.patch similarity index 100% rename from patches/server/0052-Skip-event-if-no-listeners.patch rename to patches/server/0048-Skip-event-if-no-listeners.patch diff --git a/patches/server/0053-PaperPR-Rewrite-framed-map-tracker-ticking.patch b/patches/server/0049-PaperPR-Rewrite-framed-map-tracker-ticking.patch similarity index 86% rename from patches/server/0053-PaperPR-Rewrite-framed-map-tracker-ticking.patch rename to patches/server/0049-PaperPR-Rewrite-framed-map-tracker-ticking.patch index a63d429d2..0552b0075 100644 --- a/patches/server/0053-PaperPR-Rewrite-framed-map-tracker-ticking.patch +++ b/patches/server/0049-PaperPR-Rewrite-framed-map-tracker-ticking.patch @@ -16,10 +16,10 @@ now is just updating dirty map/decoration data. When no bukkit renderers are added to the map, we also re-use the same packet for all players who are tracking it which avoids a lot of work. diff --git a/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 97e793c971614299504605aeb4f99cadbcc2abf0..8721a93e184354727b439c794ce0aea5321b6675 100644 +index 796322fc35da0b47654e60388ec93cae7b999766..84d95b8e718609d06f5a259f22599494ced9cd90 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -124,27 +124,40 @@ public class ServerEntity { +@@ -128,27 +128,40 @@ public class ServerEntity { Entity entity = this.entity; @@ -65,7 +65,7 @@ index 97e793c971614299504605aeb4f99cadbcc2abf0..8721a93e184354727b439c794ce0aea5 } } -@@ -385,6 +398,19 @@ public class ServerEntity { +@@ -423,6 +436,19 @@ public class ServerEntity { } } @@ -86,31 +86,31 @@ index 97e793c971614299504605aeb4f99cadbcc2abf0..8721a93e184354727b439c794ce0aea5 public Vec3 getPositionBase() { diff --git a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -index cf78531b193ba56991ccb0c4f62844208e4a5706..d6cecc788be59676f0d011323bb5bdab9e5ab417 100644 +index bd5e034ce58ebe53d2121209d76ae60134ce72fe..739e178b4544964d24e242b088393093348cc15f 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java +++ b/src/main/java/net/minecraft/world/entity/decoration/ItemFrame.java -@@ -425,6 +425,16 @@ public class ItemFrame extends HangingEntity { - } - this.setItem(ItemStack.fromBukkitCopy(event.getItemStack())); - // Paper end - Add PlayerItemFrameChangeEvent -+ // Paper start - add decoration and mark everything dirty for other players who are already tracking this frame -+ final ItemStack item = this.getItem(); -+ if (item.is(Items.FILLED_MAP)) { -+ final MapItemSavedData data = MapItem.getSavedData(item, this.level()); -+ if (data != null) { -+ data.addFrameDecoration(this); -+ data.markAllDirty(); +@@ -434,6 +434,16 @@ public class ItemFrame extends HangingEntity { + } + this.setItem(ItemStack.fromBukkitCopy(event.getItemStack())); + // Paper end - Add PlayerItemFrameChangeEvent ++ // Paper start - add decoration and mark everything dirty for other players who are already tracking this frame ++ final ItemStack item = this.getItem(); ++ if (item.is(Items.FILLED_MAP)) { ++ final MapItemSavedData data = MapItem.getSavedData(item, this.level()); ++ if (data != null) { ++ data.addFrameDecoration(this); ++ data.markAllDirty(); ++ } + } -+ } -+ // Paper end - this.gameEvent(GameEvent.BLOCK_CHANGE, player); - itemstack.consume(1, player); - } ++ // Paper end + this.gameEvent(GameEvent.BLOCK_CHANGE, player); + itemstack.consume(1, player); + return InteractionResult.SUCCESS; diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -index b794c097039f6a3f812dd76df407587594d3ac49..dacfac988b94a86f214dd530e08064cd6685afc8 100644 +index aabc0b5a3e50aad8c4f902fa41e6bed319599ff3..18ba99619fa5acc5b7148c2e8a4e9b086c6a072c 100644 --- a/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java +++ b/src/main/java/net/minecraft/world/level/saveddata/maps/MapItemSavedData.java -@@ -80,6 +80,16 @@ public class MapItemSavedData extends SavedData { +@@ -81,6 +81,16 @@ public class MapItemSavedData extends SavedData { private final Map frameMarkers = Maps.newHashMap(); private int trackedDecorationCount; private org.bukkit.craftbukkit.map.RenderData vanillaRender = new org.bukkit.craftbukkit.map.RenderData(); // Paper @@ -127,7 +127,7 @@ index b794c097039f6a3f812dd76df407587594d3ac49..dacfac988b94a86f214dd530e08064cd public boolean isExplorerMap; // Purpur // CraftBukkit start -@@ -352,7 +362,7 @@ public class MapItemSavedData extends SavedData { +@@ -371,7 +381,7 @@ public class MapItemSavedData extends SavedData { --this.trackedDecorationCount; } @@ -136,15 +136,15 @@ index b794c097039f6a3f812dd76df407587594d3ac49..dacfac988b94a86f214dd530e08064cd } public static void addTargetDecoration(ItemStack stack, BlockPos pos, String id, Holder decorationType) { -@@ -434,6 +444,7 @@ public class MapItemSavedData extends SavedData { +@@ -408,6 +418,7 @@ public class MapItemSavedData extends SavedData { + } + + this.setDecorationsDirty(); ++ if (type.value().showOnItemFrame() || (mapicon1 != null && mapicon.type().value().showOnItemFrame())) this.dirtyFrameDecorations = true; // Paper } - this.setDecorationsDirty(); -+ if (type.value().showOnItemFrame() || (mapicon1 != null && mapicon.type().value().showOnItemFrame())) this.dirtyFrameDecorations = true; // Paper } - - } -@@ -447,6 +458,20 @@ public class MapItemSavedData extends SavedData { +@@ -479,6 +490,20 @@ public class MapItemSavedData extends SavedData { public void setColorsDirty(int x, int z) { this.setDirty(); @@ -165,15 +165,19 @@ index b794c097039f6a3f812dd76df407587594d3ac49..dacfac988b94a86f214dd530e08064cd Iterator iterator = this.carriedBy.iterator(); while (iterator.hasNext()) { -@@ -529,6 +554,7 @@ public class MapItemSavedData extends SavedData { +@@ -561,7 +586,11 @@ public class MapItemSavedData extends SavedData { public void removedFromFrame(BlockPos pos, int id) { this.removeDecoration(MapItemSavedData.getFrameKey(id)); this.frameMarkers.remove(MapFrame.frameId(pos)); ++<<<<<<< HEAD + this.setDirty(); ++======= + this.dirtyFrameDecorations = true; // Paper ++>>>>>>> PaperPR: Rewrite framed map tracker ticking } public boolean updateColor(int x, int z, byte color) { -@@ -590,6 +616,93 @@ public class MapItemSavedData extends SavedData { +@@ -623,6 +652,93 @@ public class MapItemSavedData extends SavedData { return "frame-" + id; } diff --git a/patches/server/0054-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch b/patches/server/0050-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch similarity index 59% rename from patches/server/0054-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch rename to patches/server/0050-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch index 0c3684553..e7c1fe3ab 100644 --- a/patches/server/0054-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch +++ b/patches/server/0050-SparklyPaper-Skip-distanceToSqr-call-in-ServerEntity.patch @@ -11,22 +11,22 @@ 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/src/main/java/net/minecraft/server/level/ServerEntity.java b/src/main/java/net/minecraft/server/level/ServerEntity.java -index 8721a93e184354727b439c794ce0aea5321b6675..573c380e123473e35c0b72c44b32c8d6ba8e61c6 100644 +index 84d95b8e718609d06f5a259f22599494ced9cd90..a7a44fa556a41512d6a76626618afceccd139c64 100644 --- a/src/main/java/net/minecraft/server/level/ServerEntity.java +++ b/src/main/java/net/minecraft/server/level/ServerEntity.java -@@ -231,6 +231,7 @@ public class ServerEntity { +@@ -245,6 +245,7 @@ public class ServerEntity { - if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) { - Vec3 vec3d1 = this.entity.getDeltaMovement(); + if ((this.trackDelta || this.entity.hasImpulse || this.entity instanceof LivingEntity && ((LivingEntity) this.entity).isFallFlying()) && this.tickCount > 0) { + Vec3 vec3d1 = this.entity.getDeltaMovement(); + if (vec3d1 != this.lastSentMovement) { // SparklyPaper start - skip distanceToSqr call in ServerEntity#sendChanges if the delta movement hasn't changed - double d0 = vec3d1.distanceToSqr(this.lastSentMovement); + double d0 = vec3d1.distanceToSqr(this.lastSentMovement); - if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) { -@@ -245,6 +246,7 @@ public class ServerEntity { - this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); + if (d0 > 1.0E-7D || d0 > 0.0D && vec3d1.lengthSqr() == 0.0D) { +@@ -259,6 +260,7 @@ public class ServerEntity { + this.broadcast.accept(new ClientboundSetEntityMotionPacket(this.entity.getId(), this.lastSentMovement)); + } } - } + } // SparklyPaper end - } + } - if (packet1 != null) { + if (packet1 != null) { diff --git a/patches/server/0055-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch b/patches/server/0051-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch similarity index 94% rename from patches/server/0055-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch rename to patches/server/0051-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch index 333884c07..604952891 100644 --- a/patches/server/0055-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch +++ b/patches/server/0051-SparklyPaper-Skip-MapItem-update-if-the-map-does-not.patch @@ -11,10 +11,10 @@ Optimizes "image in map" maps, without requiring the map to be locked, which som This has the disadvantage that the vanilla map data will never be updated while the CraftMapRenderer is not present, but that's not a huuuge problem for u diff --git a/src/main/java/net/minecraft/world/item/MapItem.java b/src/main/java/net/minecraft/world/item/MapItem.java -index 608390ed36710a419de1542b80340dd3fcc7299c..98449cfbad78833808a6ad069baaa723e701231f 100644 +index c2f3c8b3d8eeb609b6d6067c4fb404aefbf94ec5..dfec0daeefc040cdae578f44073824773db095f9 100644 --- a/src/main/java/net/minecraft/world/item/MapItem.java +++ b/src/main/java/net/minecraft/world/item/MapItem.java -@@ -277,7 +277,7 @@ public class MapItem extends ComplexItem { +@@ -276,7 +276,7 @@ public class MapItem extends Item { mapItemSavedData.tickCarriedBy(player, stack); } diff --git a/patches/server/0056-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch b/patches/server/0052-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch similarity index 91% rename from patches/server/0056-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch rename to patches/server/0052-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch index faf9c3e98..3ef80c07d 100644 --- a/patches/server/0056-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch +++ b/patches/server/0052-SparklyPaper-Skip-EntityScheduler-s-executeTick-chec.patch @@ -75,19 +75,19 @@ index c03608fec96b51e1867f43d8f42e5aefb1520e46..15b21fa3907db1b77ed5b5d1050a37f4 throw new IllegalStateException("Ticking retired scheduler"); } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a226a8f066754fe609583071004395abef9d4709..a6d6e3ad434420223178f813953d9c53db26034a 100644 +index 87e52d6dcd855c80b3e6b4f4010b596bf8649c80..ff0e1117cbdfd40aec9d7e54492c107165614d20 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -310,6 +310,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop pluginsBlockingSleep = new java.util.HashSet<>(); // Paper - API to allow/disallow tick sleeping public gg.pufferfish.pufferfish.util.AsyncExecutor mobSpawnExecutor = new gg.pufferfish.pufferfish.util.AsyncExecutor("Leaf Async Mob Spawn Thread"); // Pufferfish - optimize mob spawning // Leaf - Unify thread name + public final Set entitiesWithScheduledTasks = java.util.concurrent.ConcurrentHashMap.newKeySet(); // SparklyPaper - skip EntityScheduler's executeTick checks if there isn't any tasks to be run (concurrent because plugins may schedule tasks async) public static S spin(Function serverFactory) { AtomicReference atomicreference = new AtomicReference(); -@@ -1738,6 +1739,18 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { - for (final Entity entity : level.moonrise$getEntityLookup().getAllCopy()) { // Paper - rewrite chunk system + for (final Entity entity : level.getEntities().getAll()) { if (entity.isRemoved()) { -@@ -1749,6 +1762,8 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop channels = new HashSet(); @@ -41,7 +41,7 @@ index 0021f9bf8d6870bd9275ef59567c51ffce7615d0..a2f329e958fe72d262da9a4cee050efb private final Set unlistedEntities = new HashSet<>(); // Paper - Add Listing API for Player private static final WeakHashMap> pluginWeakReferences = new WeakHashMap<>(); private int hash = 0; -@@ -2279,9 +2279,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -2290,9 +2290,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @Override public boolean canSee(org.bukkit.entity.Entity entity) { diff --git a/patches/server/0058-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch b/patches/server/0054-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch similarity index 96% rename from patches/server/0058-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch rename to patches/server/0054-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch index 267962b7b..7db2f0052 100644 --- a/patches/server/0058-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch +++ b/patches/server/0054-SparklyPaper-Allow-throttling-hopper-checks-if-the-t.patch @@ -7,7 +7,7 @@ Subject: [PATCH] SparklyPaper: Allow throttling hopper checks if the target Original project: https://github.com/SparklyPower/SparklyPaper diff --git a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java -index 67425f4270c0745fc962c6ffb90e98bb4362d261..989e0f049805a734d6aa18434dd2a3b2d6c2ace1 100644 +index aa55698303f7ffc6542f34311234be6c6b400a9d..e2fad47c7d6ff1a547404abf6abea84ff8fa867c 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/HopperBlockEntity.java @@ -441,6 +441,11 @@ public class HopperBlockEntity extends RandomizableContainerBlockEntity implemen diff --git a/patches/server/0059-Polpot-Make-egg-and-snowball-can-knockback-player.patch b/patches/server/0055-Polpot-Make-egg-and-snowball-can-knockback-player.patch similarity index 94% rename from patches/server/0059-Polpot-Make-egg-and-snowball-can-knockback-player.patch rename to patches/server/0055-Polpot-Make-egg-and-snowball-can-knockback-player.patch index 11a50226b..726638751 100644 --- a/patches/server/0059-Polpot-Make-egg-and-snowball-can-knockback-player.patch +++ b/patches/server/0055-Polpot-Make-egg-and-snowball-can-knockback-player.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Polpot: Make egg and snowball can knockback player Original project: https://github.com/HaHaWTH/Polpot diff --git a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java -index 1b9d0e28e518c501b4b93ae385ddd64aeade97d5..650e0e88e2a608fe6326806a830e437cf75a9e4f 100644 +index 0db58e7d63a5c1b43a2224c247979f23a1d3f899..c2ffa86e0492ed1aa6a1850e8da49fdca2c2e2c7 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/Snowball.java +++ b/src/main/java/net/minecraft/world/entity/projectile/Snowball.java @@ -61,6 +61,12 @@ public class Snowball extends ThrowableItemProjectile { @@ -23,10 +23,10 @@ index 1b9d0e28e518c501b4b93ae385ddd64aeade97d5..650e0e88e2a608fe6326806a830e437c // Purpur start - borrowed and modified code from ThrownPotion#onHitBlock and ThrownPotion#dowseFire diff --git a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -index dbd60cc8c39f5d2d4c77e2de4f2567e7fa456cd2..94baa609e49db229b03592c3fddb388b7499d75b 100644 +index 155c2bbd35adacb7c3668fbe81a7c454e5102c8b..15de9bf1c39c9cc44debd196725e1f7ebf247e60 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java +++ b/src/main/java/net/minecraft/world/entity/projectile/ThrownEgg.java -@@ -49,7 +49,14 @@ public class ThrownEgg extends ThrowableItemProjectile { +@@ -51,7 +51,14 @@ public class ThrownEgg extends ThrowableItemProjectile { @Override protected void onHitEntity(EntityHitResult entityHitResult) { super.onHitEntity(entityHitResult); diff --git a/patches/server/0071-Redirect-vanilla-getProfiler-in-PathNavigationRegion.patch b/patches/server/0056-Redirect-vanilla-getProfiler-in-PathNavigationRegion.patch similarity index 88% rename from patches/server/0071-Redirect-vanilla-getProfiler-in-PathNavigationRegion.patch rename to patches/server/0056-Redirect-vanilla-getProfiler-in-PathNavigationRegion.patch index 98b96257a..8902372df 100644 --- a/patches/server/0071-Redirect-vanilla-getProfiler-in-PathNavigationRegion.patch +++ b/patches/server/0056-Redirect-vanilla-getProfiler-in-PathNavigationRegion.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Redirect vanilla getProfiler in PathNavigationRegion diff --git a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -index a1a4b99167919bedb8a45c3b81889f58f2abfbcc..30d19ae31fe29436482b3fbe146dc6238b1fd04b 100644 +index 5375ea8dee8f74c843964824ad1a374e15711b60..82c304cf560e4dfd21e1cf9ba038f9029754d8b3 100644 --- a/src/main/java/net/minecraft/world/level/PathNavigationRegion.java +++ b/src/main/java/net/minecraft/world/level/PathNavigationRegion.java -@@ -150,4 +150,10 @@ public class PathNavigationRegion implements BlockGetter, CollisionGetter { +@@ -150,4 +150,10 @@ public class PathNavigationRegion implements CollisionGetter { public int getHeight() { return this.level.getHeight(); } diff --git a/patches/server/0072-Including-5s-in-getTPS.patch b/patches/server/0057-Including-5s-in-getTPS.patch similarity index 91% rename from patches/server/0072-Including-5s-in-getTPS.patch rename to patches/server/0057-Including-5s-in-getTPS.patch index ed65d7829..26c05ae00 100644 --- a/patches/server/0072-Including-5s-in-getTPS.patch +++ b/patches/server/0057-Including-5s-in-getTPS.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Including 5s in getTPS() diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 31d0618a9e6495be579ef039288d9accdce05299..c566f8f47918ea841659060661794315c690cf4c 100644 +index b8a288da456c9cac7fd038f50c68548a0bb7b222..d288be14c647cbcfc45c2b5763762ce3570ed683 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -3111,6 +3111,8 @@ public final class CraftServer implements Server { +@@ -3156,6 +3156,8 @@ public final class CraftServer implements Server { @Override public double[] getTPS() { diff --git a/patches/server/0073-Remove-useless-creating-stats-json-bases-on-player-n.patch b/patches/server/0058-Remove-useless-creating-stats-json-bases-on-player-n.patch similarity index 86% rename from patches/server/0073-Remove-useless-creating-stats-json-bases-on-player-n.patch rename to patches/server/0058-Remove-useless-creating-stats-json-bases-on-player-n.patch index 0d8030141..48862113a 100644 --- a/patches/server/0073-Remove-useless-creating-stats-json-bases-on-player-n.patch +++ b/patches/server/0058-Remove-useless-creating-stats-json-bases-on-player-n.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove useless creating stats json bases on player name logic diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0d41cd4fe9b423a8644475494bcfb73f98e8b70b..8d8f552acd4d2e846e1fd0bc19574d93c372fc2b 100644 +index a4e8aaf7f35cb1277fc24c4cd240f224e4eedea3..348c3c6a5d99fece14a9eb987a06934c8e8bac59 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1687,6 +1687,8 @@ public abstract class PlayerList { +@@ -1654,6 +1654,8 @@ public abstract class PlayerList { File file = this.server.getWorldPath(LevelResource.PLAYER_STATS_DIR).toFile(); File file1 = new File(file, String.valueOf(uuid) + ".json"); @@ -17,7 +17,7 @@ index 0d41cd4fe9b423a8644475494bcfb73f98e8b70b..8d8f552acd4d2e846e1fd0bc19574d93 if (!file1.exists()) { File file2 = new File(file, displayName + ".json"); // CraftBukkit Path path = file2.toPath(); -@@ -1695,6 +1697,8 @@ public abstract class PlayerList { +@@ -1662,6 +1664,8 @@ public abstract class PlayerList { file2.renameTo(file1); } } diff --git a/patches/server/0074-Don-t-throw-exception-on-missing-ResourceKey-value.patch b/patches/server/0059-Don-t-throw-exception-on-missing-ResourceKey-value.patch similarity index 76% rename from patches/server/0074-Don-t-throw-exception-on-missing-ResourceKey-value.patch rename to patches/server/0059-Don-t-throw-exception-on-missing-ResourceKey-value.patch index 1eb548cfd..1fd435467 100644 --- a/patches/server/0074-Don-t-throw-exception-on-missing-ResourceKey-value.patch +++ b/patches/server/0059-Don-t-throw-exception-on-missing-ResourceKey-value.patch @@ -5,16 +5,12 @@ Subject: [PATCH] Don't throw exception on missing ResourceKey value diff --git a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java -index 718377ce91a010a48b2b4a5e59e02ee8a42107a7..2d085f819902d09d26c98e8606ca7ba69ffdcf3c 100644 +index 6831b7b72c5e1f79eff36019ca2ff56531c26df8..a1b9949c9e36770724292ea2f71f21456ae7889f 100644 --- a/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java +++ b/src/main/java/io/papermc/paper/configuration/serializer/registry/RegistryValueSerializer.java -@@ -20,10 +20,14 @@ public final class RegistryValueSerializer extends RegistryEntrySerializer key) throws SerializationException { -+ protected T convertFromResourceKey(ResourceKey key) { - final T value = this.registry().get(key); +@@ -23,7 +23,11 @@ public final class RegistryValueSerializer extends RegistryEntrySerializer key) throws SerializationException { + final T value = this.registry().getValue(key); if (value == null) { - throw new SerializationException("Missing value in " + this.registry() + " with key " + key.location()); + // Leaf start - Don't throw exception on missing ResourceKey value diff --git a/patches/server/0075-Improve-Purpur-AFK-system.patch b/patches/server/0060-Improve-Purpur-AFK-system.patch similarity index 93% rename from patches/server/0075-Improve-Purpur-AFK-system.patch rename to patches/server/0060-Improve-Purpur-AFK-system.patch index 682c77377..86ae43925 100644 --- a/patches/server/0075-Improve-Purpur-AFK-system.patch +++ b/patches/server/0060-Improve-Purpur-AFK-system.patch @@ -7,10 +7,10 @@ AFK command & command cooldown AFK title message diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 7b27575ee14ea30c104be2a231d378f69f7bd347..91eea05a68d0ace8678fc5071e67cedb18a4386b 100644 +index 6191930c133758936ffd3cc2588c3f8713145508..11f9ac80dd5e53ae9a43ab5f4e9d3c867ab94b15 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -248,6 +248,7 @@ public class Commands { +@@ -252,6 +252,7 @@ public class Commands { StopCommand.register(this.dispatcher); TransferCommand.register(this.dispatcher); WhitelistCommand.register(this.dispatcher); @@ -19,10 +19,10 @@ index 7b27575ee14ea30c104be2a231d378f69f7bd347..91eea05a68d0ace8678fc5071e67cedb org.purpurmc.purpur.command.DemoCommand.register(this.dispatcher); // Purpur org.purpurmc.purpur.command.PingCommand.register(this.dispatcher); // Purpur diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 7c6bda95b8b08cc70182f19cf0b991f78d28c235..79df52237b7a5822e0cbaff015ccd193a8195980 100644 +index df6f21a7cc2be3e006814896c4a80ad53f9b02f5..3eb3cd1089ec46c64f82e99f25d19cee9e0cdfbe 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -2414,6 +2414,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -2680,6 +2680,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple // Purpur Start private boolean isAfk = false; @@ -33,7 +33,7 @@ index 7c6bda95b8b08cc70182f19cf0b991f78d28c235..79df52237b7a5822e0cbaff015ccd193 @Override public void setAfk(boolean afk) { -@@ -2451,6 +2455,22 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple +@@ -2717,6 +2721,22 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player imple String prefix = (split.length > 0 ? split[0] : "").replace(org.purpurmc.purpur.PurpurConfig.afkTabListPrefix, ""); String suffix = (split.length > 1 ? split[1] : "").replace(org.purpurmc.purpur.PurpurConfig.afkTabListSuffix, ""); if (afk) { @@ -57,10 +57,10 @@ index 7c6bda95b8b08cc70182f19cf0b991f78d28c235..79df52237b7a5822e0cbaff015ccd193 } else { getBukkitEntity().setPlayerListName(prefix + scoreboardName + suffix, true); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 39428db6c83527c085f4dcb012b4da297840bca6..81834489ee488be58b70dae0336645e4147d8dae 100644 +index 68cf6f0f0d2d1eb23de070ea8471111a41a9f9bf..615622f3ce63d2150c57cfd9f664bfa8fa5d6124 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2271,6 +2271,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2294,6 +2294,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -69,7 +69,7 @@ index 39428db6c83527c085f4dcb012b4da297840bca6..81834489ee488be58b70dae0336645e4 @Override public void handleChatCommand(ServerboundChatCommandPacket packet) { this.tryHandleChat(packet.command(), () -> { -@@ -2291,6 +2293,32 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2314,6 +2316,32 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl ServerGamePacketListenerImpl.LOGGER.info(this.player.getScoreboardName() + " issued server command: " + command1); } @@ -102,7 +102,7 @@ index 39428db6c83527c085f4dcb012b4da297840bca6..81834489ee488be58b70dae0336645e4 PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command1, new LazyPlayerSet(this.server)); this.cserver.getPluginManager().callEvent(event); -@@ -2328,11 +2356,37 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2351,11 +2379,37 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void performSignedChatCommand(ServerboundChatCommandSignedPacket packet, LastSeenMessages lastSeenMessages) { // CraftBukkit start @@ -142,10 +142,10 @@ index 39428db6c83527c085f4dcb012b4da297840bca6..81834489ee488be58b70dae0336645e4 this.cserver.getPluginManager().callEvent(event); command = event.getMessage().substring(1); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index bc7dd0ceea8bb304fb4370084bf19f29c1df0828..3ac1446ed791e06e2bbf226b925890ac4d1a16de 100644 +index 348c3c6a5d99fece14a9eb987a06934c8e8bac59..8efd2183309c285e0a7760922bf1b4766248d5f0 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -756,6 +756,7 @@ public abstract class PlayerList { +@@ -706,6 +706,7 @@ public abstract class PlayerList { org.leavesmc.leaves.protocol.core.LeavesProtocolManager.handlePlayerLeave(entityplayer); // Leaves - protocol // Paper end - Fix kick event leave message not being sent org.purpurmc.purpur.task.BossBarTask.removeFromAll(entityplayer.getBukkitEntity()); // Purpur @@ -154,10 +154,10 @@ index bc7dd0ceea8bb304fb4370084bf19f29c1df0828..3ac1446ed791e06e2bbf226b925890ac entityplayer.awardStat(Stats.LEAVE_GAME); diff --git a/src/main/java/org/purpurmc/purpur/PurpurConfig.java b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -index 654e838d9a77e0dd8fe9fb1d4804785ad0f463c8..5b9b9830eadf133e5ee822d6d6a0d649e08a53ed 100644 +index 05d77ccd9bf8ce0534fbac7d4354536e3187229f..aa1f5f69346a75af8e9b8dd185f211682a74db2c 100644 --- a/src/main/java/org/purpurmc/purpur/PurpurConfig.java +++ b/src/main/java/org/purpurmc/purpur/PurpurConfig.java -@@ -178,9 +178,14 @@ public class PurpurConfig { +@@ -179,9 +179,14 @@ public class PurpurConfig { public static String cannotRideMob = "You cannot mount that mob"; public static String afkBroadcastAway = "%s is now AFK"; public static String afkBroadcastBack = "%s is no longer AFK"; @@ -172,7 +172,7 @@ index 654e838d9a77e0dd8fe9fb1d4804785ad0f463c8..5b9b9830eadf133e5ee822d6d6a0d649 public static String creditsCommandOutput = "%s has been shown the end credits"; public static String demoCommandOutput = "%s has been shown the demo screen"; public static String pingCommandOutput = "%s's ping is %sms"; -@@ -197,9 +202,14 @@ public class PurpurConfig { +@@ -198,9 +203,14 @@ public class PurpurConfig { cannotRideMob = getString("settings.messages.cannot-ride-mob", cannotRideMob); afkBroadcastAway = getString("settings.messages.afk-broadcast-away", afkBroadcastAway); afkBroadcastBack = getString("settings.messages.afk-broadcast-back", afkBroadcastBack); diff --git a/patches/server/0076-Virtual-Thread-for-async-scheduler.patch b/patches/server/0061-Virtual-Thread-for-async-scheduler.patch similarity index 97% rename from patches/server/0076-Virtual-Thread-for-async-scheduler.patch rename to patches/server/0061-Virtual-Thread-for-async-scheduler.patch index ca6a8211f..fb30f37b1 100644 --- a/patches/server/0076-Virtual-Thread-for-async-scheduler.patch +++ b/patches/server/0061-Virtual-Thread-for-async-scheduler.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Virtual Thread for async scheduler diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java -index 3c1992e212a6d6f1db4d5b807b38d71913619fc0..4975fde71785a86dc812829f640ec2742d7d6fba 100644 +index 0ca279fb71d39c81b1f608e0ee9ba3e498d55fa3..1aaccc688d246201db141a0d5e2c68d0dd4069b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftAsyncScheduler.java @@ -38,17 +38,40 @@ import java.util.concurrent.TimeUnit; diff --git a/patches/server/0077-Virtual-thread-for-chat-executor.patch b/patches/server/0062-Virtual-thread-for-chat-executor.patch similarity index 94% rename from patches/server/0077-Virtual-thread-for-chat-executor.patch rename to patches/server/0062-Virtual-thread-for-chat-executor.patch index d6e61b286..12ba41540 100644 --- a/patches/server/0077-Virtual-thread-for-chat-executor.patch +++ b/patches/server/0062-Virtual-thread-for-chat-executor.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Virtual thread for chat executor diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index a6d6e3ad434420223178f813953d9c53db26034a..2445d549fbf972620f2cc13860f826562ff3f4d0 100644 +index ff0e1117cbdfd40aec9d7e54492c107165614d20..244db7e0ae0eb785deb94558eff74714d979d3de 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2882,7 +2882,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop packet) { @@ -151,10 +151,10 @@ index 8a3736dbf6ee0b2c6fbb514b2841154d2ad9f0f5..22eb98d51e0cbc996195f7f1ba07c0e4 if (packet == null || this.processedDisconnect) { // Spigot return; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index dad180fa1bab9cd9ed08891d42836020f6e709b2..0d791d0e0cbbc77dd1e5b376f82c26e3618c236e 100644 +index 8efd2183309c285e0a7760922bf1b4766248d5f0..4dafba6135115ff6459c36b5792b6954fef0132b 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1641,7 +1641,7 @@ public abstract class PlayerList { +@@ -1608,7 +1608,7 @@ public abstract class PlayerList { // Paper end boolean flag = this.verifyChatTrusted(message); @@ -163,7 +163,7 @@ index dad180fa1bab9cd9ed08891d42836020f6e709b2..0d791d0e0cbbc77dd1e5b376f82c26e3 OutgoingChatMessage outgoingchatmessage = OutgoingChatMessage.create(message); boolean flag1 = false; -@@ -1670,6 +1670,7 @@ public abstract class PlayerList { +@@ -1637,6 +1637,7 @@ public abstract class PlayerList { } public boolean verifyChatTrusted(PlayerChatMessage message) { // Paper - private -> public diff --git a/patches/server/0079-Cache-player-profileResult.patch b/patches/server/0064-Cache-player-profileResult.patch similarity index 92% rename from patches/server/0079-Cache-player-profileResult.patch rename to patches/server/0064-Cache-player-profileResult.patch index 357fee31e..9c1777bd7 100644 --- a/patches/server/0079-Cache-player-profileResult.patch +++ b/patches/server/0064-Cache-player-profileResult.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache player profileResult diff --git a/build.gradle.kts b/build.gradle.kts -index c2f2783fc4cdf5f222498d9bd08db152677bbfdb..e392f3fdc9b87c34f068743fff7ea486b19fa393 100644 +index 1e3dc0cf613a621bbf0873bcffb01c69aa119e92..a42eb55c2f26a0048ea688655c5bb1dfed6d5adf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts -@@ -26,6 +26,10 @@ dependencies { +@@ -38,6 +38,10 @@ dependencies { implementation("org.lz4:lz4-java:1.8.0") // LinearPaper end @@ -17,10 +17,10 @@ index c2f2783fc4cdf5f222498d9bd08db152677bbfdb..e392f3fdc9b87c34f068743fff7ea486 + // Leaf end - Libraries + // Paper start - implementation("org.jline:jline-terminal-jansi:3.27.1") // Leaf - Bump Dependencies - implementation("net.minecrell:terminalconsoleappender:1.3.0") + implementation("org.jline:jline-terminal-ffm:3.27.1") // use ffm on java 22+ + implementation("org.jline:jline-terminal-jni:3.27.1") // fall back to jni on java 21 diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 885c6b8c82d46f8e21eb648441dba10c3f3a99f6..7b494af5736c2036d4810f304eb238b531f3c47f 100644 +index 0afd30a9a4eb7de7e58e1b91342cca51c771f300..d77b778f66684e9f0716807d70a29618d1e7bfa0 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -92,6 +92,11 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/server/0080-Prevent-change-non-editable-sign-warning-spam-in-con.patch b/patches/server/0065-Prevent-change-non-editable-sign-warning-spam-in-con.patch similarity index 95% rename from patches/server/0080-Prevent-change-non-editable-sign-warning-spam-in-con.patch rename to patches/server/0065-Prevent-change-non-editable-sign-warning-spam-in-con.patch index 7c7eac417..d374a70c1 100644 --- a/patches/server/0080-Prevent-change-non-editable-sign-warning-spam-in-con.patch +++ b/patches/server/0065-Prevent-change-non-editable-sign-warning-spam-in-con.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent change non-editable sign warning spam in console diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -index c9a1c071780351b584ad8e071ddc26f9a27e5964..b17defc83411c3528cae1930136e771c5023f399 100644 +index 6da1eec98c08e4909ecbd48fe90b3fd62011e284..347d1a8b302b73cd0a05e8aa04a08fc27f6a5ebc 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java -@@ -189,7 +189,7 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C +@@ -189,7 +189,7 @@ public class SignBlockEntity extends BlockEntity { this.setAllowedPlayerEditor((UUID) null); this.level.sendBlockUpdated(this.getBlockPos(), this.getBlockState(), this.getBlockState(), 3); } else { diff --git a/patches/server/0081-Matter-Secure-Seed.patch b/patches/server/0066-Matter-Secure-Seed.patch similarity index 92% rename from patches/server/0081-Matter-Secure-Seed.patch rename to patches/server/0066-Matter-Secure-Seed.patch index bc5bdb4a5..683433577 100644 --- a/patches/server/0081-Matter-Secure-Seed.patch +++ b/patches/server/0066-Matter-Secure-Seed.patch @@ -14,10 +14,10 @@ Co-authored-by: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Co-authored-by: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index 9ebe1f1797b5be562bc4f6d92b9a4d6022ca2151..dcfcf20ded591cf450b38b9e5ae30ed372afb8db 100644 +index 05e16103af3fd276f0196ddf1a2e5b729b025c34..3ab0687ebe4c8059ed65372b06c4abfb42676b7b 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -@@ -165,7 +165,17 @@ public class DedicatedServerProperties extends Settings { diff --git a/src/main/java/net/minecraft/server/level/ServerChunkCache.java b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -index 0b7ede0671ea4f17606a88b12aee0196896a50b8..ddbdfd2e2bfd90f89a99e545d610e1b1af9f70ce 100644 +index 3639292f038fb872ae99757d1c04331cf2564ec2..09e06dbb8e3f9ce65fb0f9010aeb3066b6c21671 100644 --- a/src/main/java/net/minecraft/server/level/ServerChunkCache.java +++ b/src/main/java/net/minecraft/server/level/ServerChunkCache.java -@@ -610,6 +610,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon +@@ -684,6 +684,7 @@ public class ServerChunkCache extends ChunkSource implements ca.spottedleaf.moon } public ChunkGenerator getGenerator() { @@ -49,10 +49,10 @@ index 0b7ede0671ea4f17606a88b12aee0196896a50b8..ddbdfd2e2bfd90f89a99e545d610e1b1 } diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index ee0403cf2d6c088fa02a68432bb599094bc473f1..0874d1da44c82c87a8061233f1ed089ee0e0179d 100644 +index c8c777bc19e21fbf82b3a7e68d0e9753be7d41d3..9a7a76599a44dfd51d5e9e9a0e892994528c7680 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -559,6 +559,7 @@ public class ServerLevel extends Level implements WorldGenLevel, ca.spottedleaf. +@@ -642,6 +642,7 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe chunkgenerator = new org.bukkit.craftbukkit.generator.CustomChunkGenerator(this, chunkgenerator, gen); } // CraftBukkit end @@ -61,13 +61,13 @@ index ee0403cf2d6c088fa02a68432bb599094bc473f1..0874d1da44c82c87a8061233f1ed089e DataFixer datafixer = minecraftserver.getFixerUpper(); EntityPersistentStorage entitypersistentstorage = new EntityStorage(new SimpleRegionStorage(new RegionStorageInfo(convertable_conversionsession.getLevelId(), resourcekey, "entities"), convertable_conversionsession.getDimensionPath(resourcekey).resolve("entities"), datafixer, flag2, DataFixTypes.ENTITY_CHUNK), this, minecraftserver); diff --git a/src/main/java/net/minecraft/world/entity/monster/Slime.java b/src/main/java/net/minecraft/world/entity/monster/Slime.java -index 40c00f73502be66f2a0f3cdb36b963fb25c60704..76a32897f79852977df85b775c412051eb41adba 100644 +index dad4ef9c672eb4247142de5d045678795951164c..40db1b4ee806d218653d0754e39ac025e78daac2 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Slime.java +++ b/src/main/java/net/minecraft/world/entity/monster/Slime.java -@@ -439,7 +439,12 @@ public class Slime extends Mob implements Enemy { - } +@@ -431,7 +431,12 @@ public class Slime extends Mob implements Enemy { + } - ChunkPos chunkcoordintpair = new ChunkPos(pos); + ChunkPos chunkcoordintpair = new ChunkPos(pos); - boolean flag = world.getMinecraftWorld().paperConfig().entities.spawning.allChunksAreSlimeChunks || WorldgenRandom.seedSlimeChunk(chunkcoordintpair.x, chunkcoordintpair.z, ((WorldGenLevel) world).getSeed(), world.getMinecraftWorld().spigotConfig.slimeSeed).nextInt(10) == 0; // Spigot // Paper + // Leaf start - Matter - Feature Secure Seed + boolean isSlimeChunk = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled @@ -79,10 +79,10 @@ index 40c00f73502be66f2a0f3cdb36b963fb25c60704..76a32897f79852977df85b775c412051 // Paper start - Replace rules for Height in Slime Chunks final double maxHeightSlimeChunk = world.getMinecraftWorld().paperConfig().entities.spawning.slimeSpawnHeight.slimeChunk.maximum; diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -index 75c8125e20b70433fe9d143a3193d821043327c3..5bb8fe022f580a626a99324f53515890a99b798d 100644 +index a402e2f774cfc062afab8d86969f3e6f38874063..afdff26d6a7a0f0e4693da248be04329479bf12e 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkAccess.java -@@ -85,6 +85,11 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -85,6 +85,11 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh protected final LevelHeightAccessor levelHeightAccessor; protected final LevelChunkSection[] sections; @@ -94,7 +94,7 @@ index 75c8125e20b70433fe9d143a3193d821043327c3..5bb8fe022f580a626a99324f53515890 // 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); -@@ -189,6 +194,17 @@ public abstract class ChunkAccess implements BlockGetter, BiomeManager.NoiseBiom +@@ -189,6 +194,17 @@ public abstract class ChunkAccess implements BiomeManager.NoiseBiomeSource, Ligh return GameEventListenerRegistry.NOOP; } @@ -113,7 +113,7 @@ index 75c8125e20b70433fe9d143a3193d821043327c3..5bb8fe022f580a626a99324f53515890 @Nullable public abstract BlockState setBlockState(BlockPos pos, BlockState state, boolean moved); diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 488938c32a48437721a71d294c77468f00c035b9..00ed0d5ad535faa36111ab28bb0cf1317eb067ec 100644 +index b5114f84b2df2f4606702b892d32d484225d9dcf..1582771de72f713c155427587feea73ca7b4b273 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -344,7 +344,11 @@ public abstract class ChunkGenerator { @@ -152,7 +152,7 @@ index 488938c32a48437721a71d294c77468f00c035b9..00ed0d5ad535faa36111ab28bb0cf131 StructureSet.StructureSelectionEntry structureset_a1; diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java -index 713fced29fbd819ee6f151c7f3e462f58a21d5e6..49229294eb3b562fba3b48baf5fca9c18ad2be8f 100644 +index b4d9e43b524b9cc6da4bb50d28ce1e854f5abcce..c497c0a374b8b46b0e8ddbdf492dc9aef8536c68 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGeneratorStructureState.java @@ -224,8 +224,12 @@ public class ChunkGeneratorStructureState { @@ -190,7 +190,7 @@ index 4e56398a6fb8b97199f4c74ebebc1055fb718dcf..505f0ab967b53c100c91971afbf67bdc ProfiledDuration profiledDuration = JvmProfiler.INSTANCE.onChunkGenerate(chunk.getPos(), context.level().dimension(), this.targetStatus.getName()); return this.task.doWork(context, this, staticCache2D, chunk).thenApply(generated -> this.completeChunkGeneration(generated, profiledDuration)); diff --git a/src/main/java/net/minecraft/world/level/levelgen/WorldOptions.java b/src/main/java/net/minecraft/world/level/levelgen/WorldOptions.java -index 5ae04ec610a885e2ed73e942879a27fe8640471c..feedaf9c289d592b4d0f8f6295bc34652765cf88 100644 +index 41c19e4e7bde4632879da564f52f3d373de27ec4..90ea4e4c63b9f7bacaaa2f3a590000daecc6356d 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/WorldOptions.java +++ b/src/main/java/net/minecraft/world/level/levelgen/WorldOptions.java @@ -9,8 +9,20 @@ import net.minecraft.util.RandomSource; @@ -202,20 +202,20 @@ index 5ae04ec610a885e2ed73e942879a27fe8640471c..feedaf9c289d592b4d0f8f6295bc3465 + private static final boolean isSecureSeedEnabled = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled; public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( - instance -> instance.group( -+ instance -> isSecureSeedEnabled -+ ? instance.group( -+ Codec.LONG.fieldOf("seed").stable().forGetter(WorldOptions::seed), -+ Codec.STRING.fieldOf("feature_seed").orElse(gson.toJson(su.plo.matter.Globals.createRandomWorldSeed())).stable().forGetter(WorldOptions::featureSeedSerialize), -+ Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldOptions::generateStructures), -+ Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldOptions::generateBonusChest), -+ Codec.STRING.lenientOptionalFieldOf("legacy_custom_options").stable().forGetter(generatorOptions -> generatorOptions.legacyCustomOptions) -+ ) -+ .apply(instance, instance.stable(WorldOptions::new)) -+ : instance.group( ++ instance -> isSecureSeedEnabled ++ ? instance.group( ++ Codec.LONG.fieldOf("seed").stable().forGetter(WorldOptions::seed), ++ Codec.STRING.fieldOf("feature_seed").orElse(gson.toJson(su.plo.matter.Globals.createRandomWorldSeed())).stable().forGetter(WorldOptions::featureSeedSerialize), ++ Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldOptions::generateStructures), ++ Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldOptions::generateBonusChest), ++ Codec.STRING.lenientOptionalFieldOf("legacy_custom_options").stable().forGetter(generatorOptions -> generatorOptions.legacyCustomOptions) ++ ) ++ .apply(instance, instance.stable(WorldOptions::new)) ++ : instance.group( Codec.LONG.fieldOf("seed").stable().forGetter(WorldOptions::seed), Codec.BOOL.fieldOf("generate_features").orElse(true).stable().forGetter(WorldOptions::generateStructures), Codec.BOOL.fieldOf("bonus_chest").orElse(false).stable().forGetter(WorldOptions::generateBonusChest), -@@ -18,18 +30,35 @@ public class WorldOptions { +@@ -18,8 +30,14 @@ public class WorldOptions { ) .apply(instance, instance.stable(WorldOptions::new)) ); @@ -231,39 +231,44 @@ index 5ae04ec610a885e2ed73e942879a27fe8640471c..feedaf9c289d592b4d0f8f6295bc3465 private final boolean generateStructures; private final boolean generateBonusChest; private final Optional legacyCustomOptions; - -+ // Leaf start - Matter - Feature Secure Seed - public WorldOptions(long seed, boolean generateStructures, boolean bonusChest) { +@@ -28,14 +46,35 @@ public class WorldOptions { this(seed, generateStructures, bonusChest, Optional.empty()); } ++ // Leaf start - Matter - Feature Secure Seed + public WorldOptions(long seed, long[] featureSeed, boolean generateStructures, boolean bonusChest) { + this(seed, featureSeed, generateStructures, bonusChest, Optional.empty()); + } ++ ++ private WorldOptions(long seed, String featureSeedJson, boolean generateStructures, boolean bonusChest, Optional legacyCustomOptions) { ++ this(seed, gson.fromJson(featureSeedJson, long[].class), generateStructures, bonusChest, legacyCustomOptions); ++ } ++ // Leaf end - Matter - Feature Secure Seed + public static WorldOptions defaultWithRandomSeed() { - return new WorldOptions(randomSeed(), true, false); ++ // Leaf start - Matter - Feature Secure Seed + return isSecureSeedEnabled + ? new WorldOptions(randomSeed(), su.plo.matter.Globals.createRandomWorldSeed(), true, false) + : new WorldOptions(randomSeed(), true, false); -+ } -+ -+ private WorldOptions(long seed, String featureSeedJson, boolean generateStructures, boolean bonusChest, Optional legacyCustomOptions) { -+ this(seed, gson.fromJson(featureSeedJson, long[].class), generateStructures, bonusChest, legacyCustomOptions); ++ // Leaf end - Matter - Feature Secure Seed } - private WorldOptions(long seed, boolean generateStructures, boolean bonusChest, Optional legacyCustomOptions) { -@@ -39,10 +68,26 @@ public class WorldOptions { - this.legacyCustomOptions = legacyCustomOptions; + public static WorldOptions testWorldWithRandomSeed() { + return new WorldOptions(randomSeed(), false, false); } ++ // Leaf start - Matter - Feature Secure Seed + private WorldOptions(long seed, long[] featureSeed, boolean generateStructures, boolean bonusChest, Optional legacyCustomOptions) { + this(seed, generateStructures, bonusChest, legacyCustomOptions); + this.featureSeed = featureSeed; -+ // Leaf end - Matter - Feature Secure Seed + } ++ // Leaf end - Matter - Feature Secure Seed + - public long seed() { + private WorldOptions(long seed, boolean generateStructures, boolean bonusChest, Optional legacyCustomOptions) { + this.seed = seed; + this.generateStructures = generateStructures; +@@ -47,6 +86,16 @@ public class WorldOptions { return this.seed; } @@ -280,7 +285,7 @@ index 5ae04ec610a885e2ed73e942879a27fe8640471c..feedaf9c289d592b4d0f8f6295bc3465 public boolean generateStructures() { return this.generateStructures; } -@@ -55,17 +100,25 @@ public class WorldOptions { +@@ -59,17 +108,25 @@ public class WorldOptions { return this.legacyCustomOptions.isPresent(); } @@ -310,10 +315,10 @@ index 5ae04ec610a885e2ed73e942879a27fe8640471c..feedaf9c289d592b4d0f8f6295bc3465 public static OptionalLong parseSeed(String seed) { seed = seed.trim(); diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -index 17d2bb3f7d158ec1230a1ad7c52b9feeda586630..fecbce25736dab20e8459cb3b1c636fa7f7eab6b 100644 +index 270db8b29cdf65e9bb932637425214eefeca86b7..56888e150a48cf338ecec591d47c979b5c24ad4d 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -@@ -42,7 +42,11 @@ public class GeodeFeature extends Feature { +@@ -41,7 +41,11 @@ public class GeodeFeature extends Feature { int j = geodeConfiguration.maxGenOffset; List> list = Lists.newLinkedList(); int k = geodeConfiguration.distributionPoints.sample(randomSource); @@ -327,10 +332,10 @@ index 17d2bb3f7d158ec1230a1ad7c52b9feeda586630..fecbce25736dab20e8459cb3b1c636fa List list2 = Lists.newLinkedList(); double d = (double)k / (double)geodeConfiguration.outerWallDistance.getMaxValue(); diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -index 3fbd6e8d23f2e6020532530ef8ad7e64b8047d4b..10e39fcdce7c205a695b9c1b8c3551b07a64cfa0 100644 +index 3fbd6e8d23f2e6020532530ef8ad7e64b8047d4b..c10efc79d2cab84703fa4ee6267e12b856f8e248 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -@@ -233,6 +233,14 @@ public abstract class Structure { +@@ -233,6 +233,13 @@ public abstract class Structure { } private static WorldgenRandom makeRandom(long seed, ChunkPos chunkPos) { @@ -341,7 +346,6 @@ index 3fbd6e8d23f2e6020532530ef8ad7e64b8047d4b..10e39fcdce7c205a695b9c1b8c3551b0 + ); + } + // Leaf end - Matter - Feature Secure Seed -+ WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); worldgenRandom.setLargeFeatureSeed(seed, chunkPos.x, chunkPos.z); return worldgenRandom; @@ -395,10 +399,10 @@ index cbf13e4f2da6a27619e9bc9a7cd73bb6e69cad2a..d97bb945f59dc7d8da1374fda5beee0d } diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -index 139c6d974e4d68c75406760f7d79034abefd7c28..b9eb60d9b56a1d8e7869fbb5694f7c8a4c1799db 100644 +index a59fdf91cb2f17aa2855af0a63a1396ed6179185..3115707c388b61db108fb8fc1e7aca13f239cee6 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/pools/JigsawPlacement.java -@@ -65,7 +65,11 @@ public class JigsawPlacement { +@@ -64,7 +64,11 @@ public class JigsawPlacement { ChunkGenerator chunkGenerator = context.chunkGenerator(); StructureTemplateManager structureTemplateManager = context.structureTemplateManager(); LevelHeightAccessor levelHeightAccessor = context.heightAccessor(); @@ -408,7 +412,7 @@ index 139c6d974e4d68c75406760f7d79034abefd7c28..b9eb60d9b56a1d8e7869fbb5694f7c8a + ? new su.plo.matter.WorldgenCryptoRandom(context.chunkPos().x, context.chunkPos().z, su.plo.matter.Globals.Salt.JIGSAW_PLACEMENT, 0) + : context.random(); + // Leaf end - Matter - Feature Secure Seed - Registry registry = registryAccess.registryOrThrow(Registries.TEMPLATE_POOL); + Registry registry = registryAccess.lookupOrThrow(Registries.TEMPLATE_POOL); Rotation rotation = Rotation.getRandom(worldgenRandom); StructureTemplatePool structureTemplatePool = structurePool.unwrapKey() diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/structures/EndCityStructure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/structures/EndCityStructure.java @@ -436,7 +440,7 @@ index 7f4c5e9355a6f562f668e9b8134bfe65dde35f90..7a1c21696f6531c7dded774f45073df1 public class MineshaftStructure extends Structure { public static final MapCodec CODEC = RecordCodecBuilder.mapCodec( diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 45e262308aebafa377a2353661acdd122933b99e..96b9e91997bba777ebe868ca5ab5e5e917b58f08 100644 +index 2dd38f40c8c0b48b12ffe557ceeed69213066a6a..13407f2906499b297df2517f0bfb65fbf6e90649 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -205,7 +205,12 @@ public class CraftChunk implements Chunk { @@ -454,10 +458,10 @@ index 45e262308aebafa377a2353661acdd122933b99e..96b9e91997bba777ebe868ca5ab5e5e9 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c566f8f47918ea841659060661794315c690cf4c..9bfa1d398fb52835e738ff48daf006b480ef30b0 100644 +index d288be14c647cbcfc45c2b5763762ce3570ed683..7cf02a451ec2b82dc369333041ac7b93d35a2b44 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -1401,7 +1401,11 @@ public final class CraftServer implements Server { +@@ -1416,7 +1416,11 @@ public final class CraftServer implements Server { iregistrycustom_dimension = leveldataanddimensions.dimensions().dimensionsRegistryAccess(); } else { LevelSettings worldsettings; diff --git a/patches/server/0082-Matter-Seed-Command.patch b/patches/server/0067-Matter-Seed-Command.patch similarity index 100% rename from patches/server/0082-Matter-Seed-Command.patch rename to patches/server/0067-Matter-Seed-Command.patch diff --git a/patches/server/0083-Faster-Random-Generator.patch b/patches/server/0068-Faster-Random-Generator.patch similarity index 95% rename from patches/server/0083-Faster-Random-Generator.patch rename to patches/server/0068-Faster-Random-Generator.patch index df96117e9..4002bb991 100644 --- a/patches/server/0083-Faster-Random-Generator.patch +++ b/patches/server/0068-Faster-Random-Generator.patch @@ -13,19 +13,19 @@ LegacyRandomSource (Vanilla): 200ms XoroshiroRandomSource (Vanilla): 47ms diff --git a/src/main/java/net/minecraft/util/RandomSource.java b/src/main/java/net/minecraft/util/RandomSource.java -index 67d94b649148b3165f09d75d8c9db10db4cc7874..77b91adf528d1bf66a42a4c6791de40e87c5b26a 100644 +index 252aef3ffe0fecd47ebea1ed7df48e14fa873eb9..5b4599927effca11293b367c5bac4541570df06c 100644 --- a/src/main/java/net/minecraft/util/RandomSource.java +++ b/src/main/java/net/minecraft/util/RandomSource.java -@@ -21,18 +21,32 @@ public interface RandomSource { +@@ -15,18 +15,32 @@ public interface RandomSource { + return create(RandomSupport.generateUniqueSeed()); } - // Leaf end - Generate random seed faster + // Leaf start - Faster random generator @Deprecated static RandomSource createThreadSafe() { - return new ThreadSafeLegacyRandomSource(RandomSupport.generateUniqueSeed()); + return org.dreeam.leaf.config.modules.opt.FastRNG.enabled -+ ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateFasterSeed()) ++ ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) + : new ThreadSafeLegacyRandomSource(RandomSupport.generateUniqueSeed()); } @@ -45,7 +45,7 @@ index 67d94b649148b3165f09d75d8c9db10db4cc7874..77b91adf528d1bf66a42a4c6791de40e static RandomSource createNewThreadLocalInstance() { - return new SingleThreadedRandomSource(ThreadLocalRandom.current().nextLong()); + return org.dreeam.leaf.config.modules.opt.FastRNG.enabled -+ ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateFasterSeed()) ++ ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) + : new SingleThreadedRandomSource(ThreadLocalRandom.current().nextLong()); } + // Leaf end - Faster random generator @@ -53,20 +53,20 @@ index 67d94b649148b3165f09d75d8c9db10db4cc7874..77b91adf528d1bf66a42a4c6791de40e RandomSource fork(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 08a3714c530fb375ee729e91965c65efb9e6e3d2..2427e8535d40204a42c214c2a47359d1555da38f 100644 +index 3665fa73fb0bd788335a8bbbdaa8f5aba0b45d8b..e7423f95187098ab99e05e16f6b76549a0b0a1b9 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -177,7 +177,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -184,7 +184,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } // Paper start - Share random for entities to make them more random - public static RandomSource SHARED_RANDOM = new RandomRandomSource(); -+ public static RandomSource SHARED_RANDOM = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? org.dreeam.leaf.util.math.random.FasterRandomSource.SHARED_INSTANCE : new RandomRandomSource(); // Leaf - Faster random generator - private static final class RandomRandomSource extends java.util.Random implements net.minecraft.world.level.levelgen.BitRandomSource { - private boolean locked = false; - ++ public static RandomSource SHARED_RANDOM = org.dreeam.leaf.config.modules.opt.FastRNG.enabled ? org.dreeam.leaf.util.math.random.FasterRandomSource.SHARED_INSTANCE : new RandomRandomSource.RandomRandomSource(); // Leaf - Faster random generator + // Paper start - replace random + private static final class RandomRandomSource extends ca.spottedleaf.moonrise.common.util.ThreadUnsafeRandom { + public RandomRandomSource() { diff --git a/src/main/java/net/minecraft/world/level/biome/Biome.java b/src/main/java/net/minecraft/world/level/biome/Biome.java -index 90c165c890a2d998e3b0af9b4310e3995ede6f64..b4757a0294cb392f59d7e045d3226c90da3f6dbf 100644 +index b725eea9d3ca81d2ef7802f5d0346d924aa1f808..c669c64189b9ae3ddd871290d18e54e3aa7463ea 100644 --- a/src/main/java/net/minecraft/world/level/biome/Biome.java +++ b/src/main/java/net/minecraft/world/level/biome/Biome.java @@ -50,14 +50,14 @@ public final class Biome { @@ -88,7 +88,7 @@ index 90c165c890a2d998e3b0af9b4310e3995ede6f64..b4757a0294cb392f59d7e045d3226c90 public final Biome.ClimateSettings climateSettings; private final BiomeGenerationSettings generationSettings; diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java -index 00ed0d5ad535faa36111ab28bb0cf1317eb067ec..0daad8b06b10bbe9f7f29b7697cb77cd0b40195f 100644 +index 1582771de72f713c155427587feea73ca7b4b273..c731c13f69dcf92de539707ccddc7089192a2f7c 100644 --- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java @@ -494,7 +494,7 @@ public abstract class ChunkGenerator { @@ -123,7 +123,7 @@ index ac8447e20531ad59d5e26c6db541d6e844d56c0f..0dab53e8e99e7de71cbd2d22a283b49b this.islandNoise = new SimplexNoise(randomSource); } diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java -index c991da3d975e07f3e1e59d5b2e91ed629ea608e6..f7d0eb09640b8b8eeec9269eca867f53e05d023b 100644 +index aa63b49738ef42122e7cd0f9dbec0d019c9b97b0..bd0eaa7d5253fd4ea9f9a6f0c7bfcf11fbc675a7 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseBasedChunkGenerator.java @@ -232,7 +232,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { @@ -138,7 +138,7 @@ index c991da3d975e07f3e1e59d5b2e91ed629ea608e6..f7d0eb09640b8b8eeec9269eca867f53 @@ -427,7 +427,7 @@ public final class NoiseBasedChunkGenerator extends ChunkGenerator { if (!((NoiseGeneratorSettings) this.settings.value()).disableMobGeneration()) { ChunkPos chunkcoordintpair = region.getCenter(); - Holder holder = region.getBiome(chunkcoordintpair.getWorldPosition().atY(region.getMaxBuildHeight() - 1)); + Holder holder = region.getBiome(chunkcoordintpair.getWorldPosition().atY(region.getMaxY())); - WorldgenRandom seededrandom = new WorldgenRandom(new LegacyRandomSource(RandomSupport.generateUniqueSeed())); + WorldgenRandom seededrandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(RandomSupport.generateUniqueSeed()) : new LegacyRandomSource(RandomSupport.generateUniqueSeed())); // Leaf - Faster random generator @@ -161,10 +161,10 @@ index c6efe6faf68c7a7b1df344e2e527aa7e44bfacb8..fe89e7b7c4267ee2969d1505f83cba1a public static enum Algorithm { diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -index fecbce25736dab20e8459cb3b1c636fa7f7eab6b..9309bad317acf8919db3b8cc0153efe2a532bd72 100644 +index 56888e150a48cf338ecec591d47c979b5c24ad4d..321eb6b9f6ae244c74b801a7d6556dceb82a19dc 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java +++ b/src/main/java/net/minecraft/world/level/levelgen/feature/GeodeFeature.java -@@ -45,7 +45,7 @@ public class GeodeFeature extends Feature { +@@ -44,7 +44,7 @@ public class GeodeFeature extends Feature { // Leaf start - Matter - Feature Secure Seed WorldgenRandom worldgenRandom = org.dreeam.leaf.config.modules.misc.SecureSeed.enabled ? new su.plo.matter.WorldgenCryptoRandom(0, 0, su.plo.matter.Globals.Salt.GEODE_FEATURE, 0) @@ -200,15 +200,15 @@ index 990457fb23d22c3b8732d70da54ac5aaed8221db..f55475b812fd989d076c7715b8f060ab protected double getNoiseValue(BlockPos pos, double scale) { diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -index 10e39fcdce7c205a695b9c1b8c3551b07a64cfa0..72adc7aa05d568875a7cc98e877e4e41b07b73bd 100644 +index c10efc79d2cab84703fa4ee6267e12b856f8e248..fb44cb370bdda8d161603ab06851dea6cbbc9d08 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java +++ b/src/main/java/net/minecraft/world/level/levelgen/structure/Structure.java -@@ -241,7 +241,7 @@ public abstract class Structure { +@@ -240,7 +240,7 @@ public abstract class Structure { + ); } // Leaf end - Matter - Feature Secure Seed - - WorldgenRandom worldgenRandom = new WorldgenRandom(new LegacyRandomSource(0L)); -+ WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); ++ WorldgenRandom worldgenRandom = new WorldgenRandom(org.dreeam.leaf.config.modules.opt.FastRNG.worldgenEnabled() ? new org.dreeam.leaf.util.math.random.FasterRandomSource(0L) : new LegacyRandomSource(0L)); // Leaf - Faster random generator worldgenRandom.setLargeFeatureSeed(seed, chunkPos.x, chunkPos.z); return worldgenRandom; } @@ -292,10 +292,10 @@ index 64bddc5c2722f7d2a18c31dc654547907b663710..b7302317d47a13c153b7c9fea993635c for (int o = l - 1; o >= 0; o--) { if (o < k && octaves.contains(l - o)) { diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java -index cab7ca4218e5903b6a5e518af55457b9a1b5111c..43d62e756a1ffd8e066a3a781329f9dc33a913cc 100644 +index e34060c21755c61228ba91e468b7c92fc4c4cf0c..b45349c38011aca9b55fa9a82438e67b338cff6f 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java -@@ -96,7 +96,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { +@@ -95,7 +95,7 @@ public class CustomChunkGenerator extends InternalChunkGenerator { } private static WorldgenRandom getSeededRandom() { diff --git a/patches/server/0084-Don-t-save-primed-tnt-entity.patch b/patches/server/0069-Don-t-save-primed-tnt-entity.patch similarity index 93% rename from patches/server/0084-Don-t-save-primed-tnt-entity.patch rename to patches/server/0069-Don-t-save-primed-tnt-entity.patch index 08c670388..9a0587ae3 100644 --- a/patches/server/0084-Don-t-save-primed-tnt-entity.patch +++ b/patches/server/0069-Don-t-save-primed-tnt-entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't save primed tnt entity diff --git a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -index 2a4425d04917b32c7ae5af3e7422c0bafc2aa1c2..2493e94b170dc5c0a3c36dded8e1ac3918fa266a 100644 +index 287ba483614e79e78022e703ef891f59f41ac455..bee0b636685097ee53994ec1a6ffbcf6eed87032 100644 --- a/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java +++ b/src/main/java/net/minecraft/world/entity/item/PrimedTnt.java -@@ -255,4 +255,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { +@@ -276,4 +276,11 @@ public class PrimedTnt extends Entity implements TraceableEntity { return super.interact(player, hand); } // Purpur end - Shears can defuse TNT diff --git a/patches/server/0085-Don-t-save-falling-block-entity.patch b/patches/server/0070-Don-t-save-falling-block-entity.patch similarity index 92% rename from patches/server/0085-Don-t-save-falling-block-entity.patch rename to patches/server/0070-Don-t-save-falling-block-entity.patch index d96efdfe8..5d2449573 100644 --- a/patches/server/0085-Don-t-save-falling-block-entity.patch +++ b/patches/server/0070-Don-t-save-falling-block-entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't save falling block entity diff --git a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -index b83be9bbb9f348da83c0fd1ecc7f65c8a58b45b9..5b3844f92caf2962be58e911f98a26e6992f8184 100644 +index 06d9a519e64d4b8b8764b3ad7691ad93b5cee065..e4ad284f57b532c260b9dd25ea32f670fc4c9283 100644 --- a/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java +++ b/src/main/java/net/minecraft/world/entity/item/FallingBlockEntity.java -@@ -422,4 +422,11 @@ public class FallingBlockEntity extends Entity { +@@ -438,4 +438,11 @@ public class FallingBlockEntity extends Entity { this.forceTickAfterTeleportToDuplicate = entity != null && flag && io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowUnsafeEndPortalTeleportation; // Paper return entity; } diff --git a/patches/server/0086-Configurable-connection-message.patch b/patches/server/0071-Configurable-connection-message.patch similarity index 95% rename from patches/server/0086-Configurable-connection-message.patch rename to patches/server/0071-Configurable-connection-message.patch index b17234048..8174d1af0 100644 --- a/patches/server/0086-Configurable-connection-message.patch +++ b/patches/server/0071-Configurable-connection-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable connection message diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0d791d0e0cbbc77dd1e5b376f82c26e3618c236e..6da4b4d3f00527aabf398ab614140bc6f8c7442c 100644 +index 4dafba6135115ff6459c36b5792b6954fef0132b..bed0b5ff2c84252bddcedcac30fe0a02252d01bf 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -452,7 +452,7 @@ public abstract class PlayerList { +@@ -456,7 +456,7 @@ public abstract class PlayerList { // Ensure that player inventory is populated with its viewer player.containerMenu.transferTo(player.containerMenu, bukkitPlayer); @@ -17,7 +17,7 @@ index 0d791d0e0cbbc77dd1e5b376f82c26e3618c236e..6da4b4d3f00527aabf398ab614140bc6 this.cserver.getPluginManager().callEvent(playerJoinEvent); if (!player.connection.isAcceptingMessages()) { -@@ -465,7 +465,7 @@ public abstract class PlayerList { +@@ -469,7 +469,7 @@ public abstract class PlayerList { final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); @@ -26,7 +26,7 @@ index 0d791d0e0cbbc77dd1e5b376f82c26e3618c236e..6da4b4d3f00527aabf398ab614140bc6 joinMessage = io.papermc.paper.adventure.PaperAdventure.asVanilla(jm); // Paper - Adventure this.server.getPlayerList().broadcastSystemMessage(joinMessage, false); // Paper - Adventure } -@@ -767,7 +767,7 @@ public abstract class PlayerList { +@@ -717,7 +717,7 @@ public abstract class PlayerList { entityplayer.closeContainer(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper - Inventory close reason } @@ -35,7 +35,7 @@ index 0d791d0e0cbbc77dd1e5b376f82c26e3618c236e..6da4b4d3f00527aabf398ab614140bc6 this.cserver.getPluginManager().callEvent(playerQuitEvent); entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); -@@ -1814,4 +1814,29 @@ public abstract class PlayerList { +@@ -1784,4 +1784,29 @@ public abstract class PlayerList { public boolean isAllowCommandsForAllPlayers() { return this.allowCommandsForAllPlayers; } diff --git a/patches/server/0087-Configurable-unknown-command-message.patch b/patches/server/0072-Configurable-unknown-command-message.patch similarity index 98% rename from patches/server/0087-Configurable-unknown-command-message.patch rename to patches/server/0072-Configurable-unknown-command-message.patch index 73fdbb262..0142297da 100644 --- a/patches/server/0087-Configurable-unknown-command-message.patch +++ b/patches/server/0072-Configurable-unknown-command-message.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable unknown command message diff --git a/src/main/java/net/minecraft/commands/Commands.java b/src/main/java/net/minecraft/commands/Commands.java -index 91eea05a68d0ace8678fc5071e67cedb18a4386b..64d22c2be510ad759bcd6fe192d1ea8cf6bc9a6f 100644 +index 11f9ac80dd5e53ae9a43ab5f4e9d3c867ab94b15..2df889e29a915dfc3554385f1de1f14464f4c67f 100644 --- a/src/main/java/net/minecraft/commands/Commands.java +++ b/src/main/java/net/minecraft/commands/Commands.java -@@ -390,33 +390,10 @@ public class Commands { +@@ -394,33 +394,10 @@ public class Commands { // Paper start - Add UnknownCommandEvent final net.kyori.adventure.text.TextComponent.Builder builder = net.kyori.adventure.text.Component.text(); // commandlistenerwrapper.sendFailure(ComponentUtils.fromMessage(commandsyntaxexception.getRawMessage())); @@ -44,7 +44,7 @@ index 91eea05a68d0ace8678fc5071e67cedb18a4386b..64d22c2be510ad759bcd6fe192d1ea8c org.bukkit.Bukkit.getServer().getPluginManager().callEvent(event); if (event.message() != null) { commandlistenerwrapper.sendFailure(io.papermc.paper.adventure.PaperAdventure.asVanilla(event.message()), false); -@@ -691,6 +668,88 @@ public class Commands { +@@ -703,6 +680,88 @@ public class Commands { }; } diff --git a/patches/server/0088-Airplane-Remove-stream-in-PoiCompetitorScan.patch b/patches/server/0073-Airplane-Remove-stream-in-PoiCompetitorScan.patch similarity index 100% rename from patches/server/0088-Airplane-Remove-stream-in-PoiCompetitorScan.patch rename to patches/server/0073-Airplane-Remove-stream-in-PoiCompetitorScan.patch diff --git a/patches/server/0089-Remove-stream-in-BlockBehaviour-cache-blockstate.patch b/patches/server/0074-Remove-stream-in-BlockBehaviour-cache-blockstate.patch similarity index 79% rename from patches/server/0089-Remove-stream-in-BlockBehaviour-cache-blockstate.patch rename to patches/server/0074-Remove-stream-in-BlockBehaviour-cache-blockstate.patch index 613589c00..80b48099b 100644 --- a/patches/server/0089-Remove-stream-in-BlockBehaviour-cache-blockstate.patch +++ b/patches/server/0074-Remove-stream-in-BlockBehaviour-cache-blockstate.patch @@ -5,19 +5,19 @@ Subject: [PATCH] Remove stream in BlockBehaviour cache blockstate diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 40f15a30b1a0dd2040e75045f32f33082e70aaeb..cdaa5a8af0c6a8a78e587141b9ab1c84766589e9 100644 +index dcf2dcece3e995ce4646b931329246be19a4e1c2..9b94d8bf3415734776c81297d5d34eea46ad7e78 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -1385,7 +1385,7 @@ public abstract class BlockBehaviour implements FeatureElement { - @Nullable - final VoxelShape[] occlusionShapes; +@@ -1439,7 +1439,7 @@ public abstract class BlockBehaviour implements FeatureElement { + private static final Direction[] DIRECTIONS = Direction.values(); + private static final int SUPPORT_TYPE_COUNT = SupportType.values().length; protected final VoxelShape collisionShape; - protected final boolean largeCollisionShape; + protected boolean largeCollisionShape; // Leaf - not final private final boolean[] faceSturdy; protected final boolean isCollisionShapeFullBlock; -@@ -1417,9 +1417,14 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1450,9 +1450,14 @@ public abstract class BlockBehaviour implements FeatureElement { if (!this.collisionShape.isEmpty() && state.hasOffsetFunction()) { throw new IllegalStateException(String.format(Locale.ROOT, "%s has a collision shape and an offset type, but is not marked as dynamicShape in its properties.", BuiltInRegistries.BLOCK.getKey(block))); } else { @@ -33,5 +33,5 @@ index 40f15a30b1a0dd2040e75045f32f33082e70aaeb..cdaa5a8af0c6a8a78e587141b9ab1c84 + } + // Leaf end - Remove stream this.faceSturdy = new boolean[BlockBehaviour.BlockStateBase.Cache.DIRECTIONS.length * BlockBehaviour.BlockStateBase.Cache.SUPPORT_TYPE_COUNT]; - Direction[] aenumdirection1 = BlockBehaviour.BlockStateBase.Cache.DIRECTIONS; - int k = aenumdirection1.length; + Direction[] aenumdirection = BlockBehaviour.BlockStateBase.Cache.DIRECTIONS; + int i = aenumdirection.length; diff --git a/patches/server/0091-Remove-stream-in-entity-visible-effects-filter.patch b/patches/server/0075-Remove-stream-in-entity-visible-effects-filter.patch similarity index 89% rename from patches/server/0091-Remove-stream-in-entity-visible-effects-filter.patch rename to patches/server/0075-Remove-stream-in-entity-visible-effects-filter.patch index 5538c3d3a..bdd311d67 100644 --- a/patches/server/0091-Remove-stream-in-entity-visible-effects-filter.patch +++ b/patches/server/0075-Remove-stream-in-entity-visible-effects-filter.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Remove stream in entity visible effects filter diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index d0755333e86009bbb584481f4796cfc60643a53f..92b253e0f96c742e02a8c8316cd669b949cabf42 100644 +index d5395553034c148bdc12b065328f52ef72b9bd86..39c898e0b5ec7203491982ef56cfdcf507d040d7 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -1008,7 +1008,15 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1029,7 +1029,15 @@ public abstract class LivingEntity extends Entity implements Attackable { } private void updateSynchronizedMobEffectParticles() { diff --git a/patches/server/0092-Remove-stream-and-double-iteration-in-enough-deep-sl.patch b/patches/server/0076-Remove-stream-and-double-iteration-in-enough-deep-sl.patch similarity index 100% rename from patches/server/0092-Remove-stream-and-double-iteration-in-enough-deep-sl.patch rename to patches/server/0076-Remove-stream-and-double-iteration-in-enough-deep-sl.patch diff --git a/patches/server/0093-Remove-stream-in-trial-spawner-ticking.patch b/patches/server/0077-Remove-stream-in-trial-spawner-ticking.patch similarity index 97% rename from patches/server/0093-Remove-stream-in-trial-spawner-ticking.patch rename to patches/server/0077-Remove-stream-in-trial-spawner-ticking.patch index 91052e3c5..e27a86145 100644 --- a/patches/server/0093-Remove-stream-in-trial-spawner-ticking.patch +++ b/patches/server/0077-Remove-stream-in-trial-spawner-ticking.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in trial spawner ticking diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java -index 005aea8a747e9cbbc352b8b57c64b84ec71ad321..f687af7374e62ed0d004e12283fbc9008cf15e28 100644 +index 192ee216b617d3533f592e62719b6d75d20b5a96..a979db9095d96698b26a9cb4beb75cf5f73d32e5 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java +++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawnerState.java @@ -173,17 +173,22 @@ public enum TrialSpawnerState implements StringRepresentable { diff --git a/patches/server/0094-Remove-stream-in-Brain.patch b/patches/server/0078-Remove-stream-in-Brain.patch similarity index 100% rename from patches/server/0094-Remove-stream-in-Brain.patch rename to patches/server/0078-Remove-stream-in-Brain.patch diff --git a/patches/server/0095-Remove-stream-in-BehaviorUtils.patch b/patches/server/0079-Remove-stream-in-BehaviorUtils.patch similarity index 100% rename from patches/server/0095-Remove-stream-in-BehaviorUtils.patch rename to patches/server/0079-Remove-stream-in-BehaviorUtils.patch diff --git a/patches/server/0096-Remove-stream-in-YieldJobSite.patch b/patches/server/0080-Remove-stream-in-YieldJobSite.patch similarity index 100% rename from patches/server/0096-Remove-stream-in-YieldJobSite.patch rename to patches/server/0080-Remove-stream-in-YieldJobSite.patch diff --git a/patches/server/0097-Remove-stream-in-PlayerSensor.patch b/patches/server/0081-Remove-stream-in-PlayerSensor.patch similarity index 80% rename from patches/server/0097-Remove-stream-in-PlayerSensor.patch rename to patches/server/0081-Remove-stream-in-PlayerSensor.patch index 122e9dc34..0a3311421 100644 --- a/patches/server/0097-Remove-stream-in-PlayerSensor.patch +++ b/patches/server/0081-Remove-stream-in-PlayerSensor.patch @@ -9,17 +9,17 @@ Before: 164ms After: 18ms diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -index 2e887e426dcd79e2dda401f127d0e01ca537e80e..6ef968a5224830959d6f36193810debe7f14e21e 100644 +index e1ff702e56adef6c8a572b078b49de2143c4ce7e..aa1a59bdaad5ac7b735524c3595a8589a92618cd 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/PlayerSensor.java -@@ -21,17 +21,39 @@ public class PlayerSensor extends Sensor { +@@ -22,17 +22,39 @@ public class PlayerSensor extends Sensor { @Override protected void doTick(ServerLevel world, LivingEntity entity) { - List list = world.players() - .stream() - .filter(EntitySelector.NO_SPECTATORS) -- .filter(player -> entity.closerThan(player, 16.0)) +- .filter(player -> entity.closerThan(player, this.getFollowDistance(entity))) - .sorted(Comparator.comparingDouble(entity::distanceToSqr)) - .collect(Collectors.toList()); + // Leaf start - Remove stream in PlayerSensor @@ -28,7 +28,7 @@ index 2e887e426dcd79e2dda401f127d0e01ca537e80e..6ef968a5224830959d6f36193810debe + if (!EntitySelector.NO_SPECTATORS.test(player)) { + continue; + } -+ if (!entity.closerThan(player, 16.0)) { ++ if (!entity.closerThan(player, this.getFollowDistance(entity))) { + continue; + } + list.add(player); @@ -37,21 +37,21 @@ index 2e887e426dcd79e2dda401f127d0e01ca537e80e..6ef968a5224830959d6f36193810debe + // Leaf end - Remove stream in PlayerSensor Brain brain = entity.getBrain(); brain.setMemory(MemoryModuleType.NEAREST_PLAYERS, list); -- List list2 = list.stream().filter(player -> isEntityTargetable(entity, player)).collect(Collectors.toList()); +- List list2 = list.stream().filter(player -> isEntityTargetable(world, entity, player)).collect(Collectors.toList()); + // Leaf start - Remove stream in PlayerSensor + List list2 = new java.util.ArrayList<>(); + for (Player player : list) { -+ if (isEntityTargetable(entity, player)) { ++ if (isEntityTargetable(world, entity, player)) { + list2.add(player); + } + } + // Leaf end - Remove stream in PlayerSensor brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_PLAYER, list2.isEmpty() ? null : list2.get(0)); -- Optional optional = list2.stream().filter(player -> isEntityAttackable(entity, player)).findFirst(); +- Optional optional = list2.stream().filter(player -> isEntityAttackable(world, entity, player)).findFirst(); + // Leaf start - Remove stream in PlayerSensor + Optional optional = Optional.empty(); + for (Player player : list2) { -+ if (isEntityAttackable(entity, player)) { ++ if (isEntityAttackable(world, entity, player)) { + optional = Optional.of(player); + break; + } @@ -59,4 +59,4 @@ index 2e887e426dcd79e2dda401f127d0e01ca537e80e..6ef968a5224830959d6f36193810debe + // Leaf end - Remove stream in PlayerSensor brain.setMemory(MemoryModuleType.NEAREST_VISIBLE_ATTACKABLE_PLAYER, optional); } - } + diff --git a/patches/server/0098-Remove-stream-in-GolemSensor.patch b/patches/server/0082-Remove-stream-in-GolemSensor.patch similarity index 77% rename from patches/server/0098-Remove-stream-in-GolemSensor.patch rename to patches/server/0082-Remove-stream-in-GolemSensor.patch index e30945b68..b7de89851 100644 --- a/patches/server/0098-Remove-stream-in-GolemSensor.patch +++ b/patches/server/0082-Remove-stream-in-GolemSensor.patch @@ -9,18 +9,18 @@ Before: 192ms After: 17ms diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java b/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java -index 94d730e2d8159184a95da4b23266bf2e330be707..f78a342270104ca1082ea535d1152541d7297d8c 100644 +index 03485bcf2f25942bd2550b4855bf16bea9ef88b6..c7c8a1ae9ab8f406f5a807e5a56c110c9e0e832d 100644 --- a/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java +++ b/src/main/java/net/minecraft/world/entity/ai/sensing/GolemSensor.java @@ -34,7 +34,15 @@ public class GolemSensor extends Sensor { public static void checkForNearbyGolem(LivingEntity entity) { Optional> optional = entity.getBrain().getMemory(MemoryModuleType.NEAREST_LIVING_ENTITIES); if (!optional.isEmpty()) { -- boolean bl = optional.get().stream().anyMatch(livingEntity -> livingEntity.getType().equals(EntityType.IRON_GOLEM)); +- boolean bl = optional.get().stream().anyMatch(seenEntity -> seenEntity.getType().equals(EntityType.IRON_GOLEM)); + // Leaf start - Remove stream in GolemSensor + boolean bl = false; -+ for (LivingEntity livingEntity : optional.get()) { -+ if (livingEntity.getType().equals(EntityType.IRON_GOLEM)) { ++ for (LivingEntity seenEntity : optional.get()) { ++ if (seenEntity.getType().equals(EntityType.IRON_GOLEM)) { + bl = true; + break; + } diff --git a/patches/server/0099-Remove-stream-in-GateBehavior.patch b/patches/server/0083-Remove-stream-in-GateBehavior.patch similarity index 100% rename from patches/server/0099-Remove-stream-in-GateBehavior.patch rename to patches/server/0083-Remove-stream-in-GateBehavior.patch diff --git a/patches/server/0100-Remove-stream-in-updateFluidOnEyes.patch b/patches/server/0084-Remove-stream-in-updateFluidOnEyes.patch similarity index 85% rename from patches/server/0100-Remove-stream-in-updateFluidOnEyes.patch rename to patches/server/0084-Remove-stream-in-updateFluidOnEyes.patch index 6d67e3080..397f79ddd 100644 --- a/patches/server/0100-Remove-stream-in-updateFluidOnEyes.patch +++ b/patches/server/0084-Remove-stream-in-updateFluidOnEyes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in updateFluidOnEyes diff --git a/src/main/java/net/minecraft/core/Holder.java b/src/main/java/net/minecraft/core/Holder.java -index 4d2231868b786da9071c3dff2c073b478a486e8a..3887649c707393a7fb9d510c725bc58befe3090b 100644 +index e91c4e26c25980645941ca8fbdcc3a9d02e31063..006044af19cb70f6bd1dbda31bc13e60cd37a0fb 100644 --- a/src/main/java/net/minecraft/core/Holder.java +++ b/src/main/java/net/minecraft/core/Holder.java @@ -29,6 +29,8 @@ public interface Holder { @@ -31,8 +31,8 @@ index 4d2231868b786da9071c3dff2c073b478a486e8a..3887649c707393a7fb9d510c725bc58b } public static enum Kind { -@@ -229,6 +238,13 @@ public interface Holder { - return this.tags.stream(); +@@ -238,6 +247,13 @@ public interface Holder { + return this.boundTags().stream(); } + // Leaf start - Remove stream in updateFluidOnEyes @@ -46,10 +46,10 @@ index 4d2231868b786da9071c3dff2c073b478a486e8a..3887649c707393a7fb9d510c725bc58b public String toString() { return "Reference{" + this.key + "=" + this.value + "}"; diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 2427e8535d40204a42c214c2a47359d1555da38f..c4965b7582edfdf97cac82c1472f8fcc1a880a6b 100644 +index e7423f95187098ab99e05e16f6b76549a0b0a1b9..48fe472dc60f2133fd5ac838eaa882d2ab8baeb2 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -2174,11 +2174,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -2097,11 +2097,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess double d1 = (double) ((float) blockposition.getY() + fluid.getHeight(this.level(), blockposition)); if (d1 > d0) { @@ -68,10 +68,10 @@ index 2427e8535d40204a42c214c2a47359d1555da38f..c4965b7582edfdf97cac82c1472f8fcc } diff --git a/src/main/java/net/minecraft/world/level/material/FluidState.java b/src/main/java/net/minecraft/world/level/material/FluidState.java -index 49e07b51e7a516d71abc1976069be2d8b523c83c..3bcbc9628d70722f034d3a33bf3868cb96011d2d 100644 +index 2d50d72bf026d0cf9c546a3c6fc1859379bfd805..ae8b7e2b185918e197de211a3f541bc0dd1943c3 100644 --- a/src/main/java/net/minecraft/world/level/material/FluidState.java +++ b/src/main/java/net/minecraft/world/level/material/FluidState.java -@@ -157,4 +157,10 @@ public final class FluidState extends StateHolder implements +@@ -158,4 +158,10 @@ public final class FluidState extends StateHolder implements public Stream> getTags() { return this.owner.builtInRegistryHolder().tags(); } diff --git a/patches/server/0101-Remove-stream-in-matchingSlot.patch b/patches/server/0085-Remove-stream-in-matchingSlot.patch similarity index 92% rename from patches/server/0101-Remove-stream-in-matchingSlot.patch rename to patches/server/0085-Remove-stream-in-matchingSlot.patch index d67c5b8d9..b8d83ad90 100644 --- a/patches/server/0101-Remove-stream-in-matchingSlot.patch +++ b/patches/server/0085-Remove-stream-in-matchingSlot.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Remove stream in matchingSlot diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java -index 161990842f19fc123fd9feca7231afec83802f47..31e8be9a5f7bb94841c609341e4daf81449acc3c 100644 +index e2a928b0271a280debe684f09c6ed8c7655aa4a2..bcec7370b875e403ffd4cec179ba07d80b1bc3a0 100644 --- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java +++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java @@ -126,7 +126,15 @@ public record Enchantment(Component description, Enchantment.EnchantmentDefiniti diff --git a/patches/server/0102-Replace-Entity-active-effects-map-with-optimized-col.patch b/patches/server/0086-Replace-Entity-active-effects-map-with-optimized-col.patch similarity index 88% rename from patches/server/0102-Replace-Entity-active-effects-map-with-optimized-col.patch rename to patches/server/0086-Replace-Entity-active-effects-map-with-optimized-col.patch index 51a2e011b..c90570f50 100644 --- a/patches/server/0102-Replace-Entity-active-effects-map-with-optimized-col.patch +++ b/patches/server/0086-Replace-Entity-active-effects-map-with-optimized-col.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Replace Entity active effects map with optimized collection Dreeam TODO: check this diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 92b253e0f96c742e02a8c8316cd669b949cabf42..21fbf1f88dbf8e767549a8fd0a7e9a8e0e434d54 100644 +index 39c898e0b5ec7203491982ef56cfdcf507d040d7..7aab6970bf73108435e79a6ef39896e9fca8659e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -198,6 +198,10 @@ public abstract class LivingEntity extends Entity implements Attackable { - public static final String ATTRIBUTES_FIELD = "attributes"; +@@ -208,6 +208,10 @@ public abstract class LivingEntity extends Entity implements Attackable { + }; private final AttributeMap attributes; public CombatTracker combatTracker = new CombatTracker(this); + // Need to figure out the difference of mem access pattern between hash map and obj2obj hash map (separate chaining vs open addressing) @@ -20,7 +20,7 @@ index 92b253e0f96c742e02a8c8316cd669b949cabf42..21fbf1f88dbf8e767549a8fd0a7e9a8e public final Map, MobEffectInstance> activeEffects = Maps.newHashMap(); private final NonNullList lastHandItemStacks; private final NonNullList lastArmorItemStacks; -@@ -1010,8 +1014,9 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1031,8 +1035,9 @@ public abstract class LivingEntity extends Entity implements Attackable { private void updateSynchronizedMobEffectParticles() { // Leaf start - Remove stream in entity visible effects filter List list = new ArrayList<>(); @@ -31,7 +31,7 @@ index 92b253e0f96c742e02a8c8316cd669b949cabf42..21fbf1f88dbf8e767549a8fd0a7e9a8e if (effect.isVisible()) { list.add(effect.getParticleOptions()); } -@@ -1019,7 +1024,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -1040,7 +1045,7 @@ public abstract class LivingEntity extends Entity implements Attackable { // Leaf end - Remove stream in entity visible effects filter this.entityData.set(LivingEntity.DATA_EFFECT_PARTICLES, list); diff --git a/patches/server/0103-Replace-criterion-map-with-optimized-collection.patch b/patches/server/0087-Replace-criterion-map-with-optimized-collection.patch similarity index 93% rename from patches/server/0103-Replace-criterion-map-with-optimized-collection.patch rename to patches/server/0087-Replace-criterion-map-with-optimized-collection.patch index 6250ca43c..0cd5fccd9 100644 --- a/patches/server/0103-Replace-criterion-map-with-optimized-collection.patch +++ b/patches/server/0087-Replace-criterion-map-with-optimized-collection.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Replace criterion map with optimized collection diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index 6fd6afe9d6cf9076bf3c3ee224fe805f97f96c2d..5e46c9b294699f56a9f6f9e9cf43f2390760b54d 100644 +index d92fa5893fa030cedf63cab9cc5f2b941af02290..134946144b60a3f400652302c90e3ec0ed035a40 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -63,7 +63,7 @@ public class PlayerAdvancements { diff --git a/patches/server/0104-Replace-world-map-with-optimized-collection.patch b/patches/server/0088-Replace-world-map-with-optimized-collection.patch similarity index 88% rename from patches/server/0104-Replace-world-map-with-optimized-collection.patch rename to patches/server/0088-Replace-world-map-with-optimized-collection.patch index 48d11a098..da4a96e77 100644 --- a/patches/server/0104-Replace-world-map-with-optimized-collection.patch +++ b/patches/server/0088-Replace-world-map-with-optimized-collection.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Replace world map with optimized collection diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9bfa1d398fb52835e738ff48daf006b480ef30b0..5f4e5b386047258948a0c8772d93bfa8be734ffc 100644 +index 7cf02a451ec2b82dc369333041ac7b93d35a2b44..c20ab80b92196c71664a945babaafce561f764ed 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -280,7 +280,7 @@ public final class CraftServer implements Server { +@@ -283,7 +283,7 @@ public final class CraftServer implements Server { private final StructureManager structureManager; protected final DedicatedServer console; protected final DedicatedPlayerList playerList; diff --git a/patches/server/0105-Replace-brain-maps-with-optimized-collection.patch b/patches/server/0089-Replace-brain-maps-with-optimized-collection.patch similarity index 100% rename from patches/server/0105-Replace-brain-maps-with-optimized-collection.patch rename to patches/server/0089-Replace-brain-maps-with-optimized-collection.patch diff --git a/patches/server/0106-Reduce-worldgen-allocations.patch b/patches/server/0090-Reduce-worldgen-allocations.patch similarity index 92% rename from patches/server/0106-Reduce-worldgen-allocations.patch rename to patches/server/0090-Reduce-worldgen-allocations.patch index f61e49b61..6bdf54468 100644 --- a/patches/server/0106-Reduce-worldgen-allocations.patch +++ b/patches/server/0090-Reduce-worldgen-allocations.patch @@ -11,10 +11,10 @@ allocation by directly accessing the rules list, which further contributes to reducing garbage collection pressure during world generation. diff --git a/src/main/java/net/minecraft/world/level/levelgen/NoiseChunk.java b/src/main/java/net/minecraft/world/level/levelgen/NoiseChunk.java -index 5e89428321d91edb893826b0eb0b9050d327d310..3e8882e4779d6037025e7ee26ebbb46a55a7e52d 100644 +index eeb0411b3bd8ffa6e9a1ba303f2251aed4e2c8a2..f870b838f4ee8f325cd68332a4483aaeac3eb2e0 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/NoiseChunk.java +++ b/src/main/java/net/minecraft/world/level/levelgen/NoiseChunk.java -@@ -359,7 +359,14 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct +@@ -370,7 +370,14 @@ public class NoiseChunk implements DensityFunction.ContextProvider, DensityFunct } protected DensityFunction wrap(DensityFunction function) { @@ -31,7 +31,7 @@ index 5e89428321d91edb893826b0eb0b9050d327d310..3e8882e4779d6037025e7ee26ebbb46a private DensityFunction wrapNew(DensityFunction function) { diff --git a/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java b/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java -index 7ba3a3ca57b55f796a90b700b930f365c3508484..2a0cd84c8a530bc34b6bc8034bd7156131837139 100644 +index 38428ba2c522108f4f9f7986bc3535d1232ac1f8..02f143b41350660486de79e240259245175bf7dc 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java +++ b/src/main/java/net/minecraft/world/level/levelgen/SurfaceRules.java @@ -314,8 +314,14 @@ public class SurfaceRules { @@ -51,7 +51,7 @@ index 7ba3a3ca57b55f796a90b700b930f365c3508484..2a0cd84c8a530bc34b6bc8034bd71561 this.blockY = blockY; this.waterHeight = fluidHeight; this.stoneDepthBelow = stoneDepthBelow; -@@ -577,8 +583,12 @@ public class SurfaceRules { +@@ -585,8 +591,12 @@ public class SurfaceRules { @Nullable @Override public BlockState tryApply(int x, int y, int z) { @@ -67,10 +67,10 @@ index 7ba3a3ca57b55f796a90b700b930f365c3508484..2a0cd84c8a530bc34b6bc8034bd71561 return blockState; } diff --git a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java -index afdbc74a3012fa717f59ecef613567338d285b7b..088e02e0941341fea958413176f49ae262e04d2a 100644 +index 0e6dfe2635ea5f5e410049b05f94f5083b2f18a4..e19086b3a65d992cf6687222557a34a896e84385 100644 --- a/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java +++ b/src/main/java/net/minecraft/world/level/levelgen/material/MaterialRuleList.java -@@ -10,13 +10,16 @@ public record MaterialRuleList(List materialRuleLis +@@ -9,13 +9,16 @@ public record MaterialRuleList(NoiseChunk.BlockStateFiller[] materialRuleList) i @Nullable @Override public BlockState calculate(DensityFunction.FunctionContext pos) { diff --git a/patches/server/0107-Use-caffeine-cache-kickPermission-instead-of-using-g.patch b/patches/server/0091-Use-caffeine-cache-kickPermission-instead-of-using-g.patch similarity index 92% rename from patches/server/0107-Use-caffeine-cache-kickPermission-instead-of-using-g.patch rename to patches/server/0091-Use-caffeine-cache-kickPermission-instead-of-using-g.patch index 03606ba01..fe150b13b 100644 --- a/patches/server/0107-Use-caffeine-cache-kickPermission-instead-of-using-g.patch +++ b/patches/server/0091-Use-caffeine-cache-kickPermission-instead-of-using-g.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use caffeine cache kickPermission instead of using diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 81834489ee488be58b70dae0336645e4147d8dae..fd7ad7866d9f16c62850d37c98d1736cd54242e4 100644 +index 615622f3ce63d2150c57cfd9f664bfa8fa5d6124..4ecefd90defffeac792d4cb2375ee2d68513b170 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -334,17 +334,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -344,17 +344,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // CraftBukkit end // Purpur start @@ -31,7 +31,7 @@ index 81834489ee488be58b70dae0336645e4147d8dae..fd7ad7866d9f16c62850d37c98d1736c // Purpur end public final org.leavesmc.leaves.protocol.syncmatica.exchange.ExchangeTarget exchangeTarget; // Leaves - Syncmatica Protocol -@@ -418,7 +413,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -417,7 +412,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (this.player.getLastActionTime() > 0L && this.server.getPlayerIdleTimeout() > 0 && Util.getMillis() - this.player.getLastActionTime() > (long) this.server.getPlayerIdleTimeout() * 1000L * 60L && !this.player.wonGame) { // Paper - Prevent AFK kick while watching end credits // Purpur start this.player.setAfk(true); diff --git a/patches/server/0024-Rail-Optimization-optimized-PoweredRailBlock-logic.patch b/patches/work/server/0024-Rail-Optimization-optimized-PoweredRailBlock-logic.patch similarity index 100% rename from patches/server/0024-Rail-Optimization-optimized-PoweredRailBlock-logic.patch rename to patches/work/server/0024-Rail-Optimization-optimized-PoweredRailBlock-logic.patch diff --git a/patches/server/0042-Optimize-Minecart-collisions.patch b/patches/work/server/0042-Optimize-Minecart-collisions.patch similarity index 100% rename from patches/server/0042-Optimize-Minecart-collisions.patch rename to patches/work/server/0042-Optimize-Minecart-collisions.patch diff --git a/patches/server/0044-Faster-Natural-Spawning.patch b/patches/work/server/0044-Faster-Natural-Spawning.patch similarity index 100% rename from patches/server/0044-Faster-Natural-Spawning.patch rename to patches/work/server/0044-Faster-Natural-Spawning.patch diff --git a/patches/server/0061-Moonrise-Optimize-nearby-players-for-spawning-iterat.patch b/patches/work/server/0061-Moonrise-Optimize-nearby-players-for-spawning-iterat.patch similarity index 100% rename from patches/server/0061-Moonrise-Optimize-nearby-players-for-spawning-iterat.patch rename to patches/work/server/0061-Moonrise-Optimize-nearby-players-for-spawning-iterat.patch diff --git a/patches/server/0066-Moonrise-Optimise-checkInsideBlocks.patch b/patches/work/server/0066-Moonrise-Optimise-checkInsideBlocks.patch similarity index 100% rename from patches/server/0066-Moonrise-Optimise-checkInsideBlocks.patch rename to patches/work/server/0066-Moonrise-Optimise-checkInsideBlocks.patch diff --git a/patches/server/0067-Moonrise-Avoid-streams-for-block-retrieval-in-Entity.patch b/patches/work/server/0067-Moonrise-Avoid-streams-for-block-retrieval-in-Entity.patch similarity index 100% rename from patches/server/0067-Moonrise-Avoid-streams-for-block-retrieval-in-Entity.patch rename to patches/work/server/0067-Moonrise-Avoid-streams-for-block-retrieval-in-Entity.patch