From 09b625eccfc38c4c08b4b4d15d79dfd2bba75e33 Mon Sep 17 00:00:00 2001 From: Bjarne Koll Date: Wed, 23 Oct 2024 16:55:24 +0200 Subject: [PATCH] 400 --- ...older-method-without-block-snapshot.patch} | 0 .../0366-Add-PlayerRecipeBookClickEvent.patch | 65 +++++++++++++++++++ ...-Hide-sync-chunk-writes-behind-flag.patch} | 2 +- ...8-Add-permission-for-command-blocks.patch} | 18 ++--- ...position-and-AABB-are-never-invalid.patch} | 8 +-- ...d-Difficulty-Remembering-Difficulty.patch} | 36 +++++----- .../0371-Paper-dumpitem-command.patch} | 0 ...Legacy-Component-serialization-size.patch} | 2 +- ...Plugin-Tickets-to-API-Chunk-Methods.patch} | 18 ++--- ...-Add-BlockStateMeta-clearBlockState.patch} | 0 ...vert-legacy-attributes-in-Item-Meta.patch} | 4 +- ...-not-accept-invalid-client-settings.patch} | 4 +- ...e-fix-EntityTargetLivingEntityEvent.patch} | 6 +- .../0378-Add-entity-liquid-API.patch} | 4 +- .../0379-Add-PrepareResultEvent.patch} | 42 ++++++------ ...-for-portal-on-world-gen-entity-add.patch} | 4 +- ...x-arrows-never-despawning-MC-125757.patch} | 6 +- ...Vanilla-Command-permission-checking.patch} | 6 +- ...-Bukkit-world-container-is-not-used.patch} | 2 +- ...5885-Unable-to-disable-advancements.patch} | 2 +- ...taPlayer-leak-due-from-quitting-ear.patch} | 2 +- ...e-NetworkManager-Exception-Handling.patch} | 0 ...ix-some-rails-connecting-improperly.patch} | 10 +-- ...stake-in-CB-NBT-int-deserialization.patch} | 0 .../0389-Brand-support.patch} | 16 ++--- ...PickupItemAnimation-to-LivingEntity.patch} | 4 +- .../0391-Don-t-require-FACING-data.patch} | 0 ...eEvent-not-firing-for-all-use-cases.patch} | 8 +-- .../0393-Add-moon-phase-API.patch} | 2 +- ...erver-load-chunks-from-newer-version.patch | 40 ++++++++++++ ...headless-pistons-from-being-created.patch} | 14 ++-- .../0396-Add-BellRingEvent.patch} | 4 +- ...dd-zombie-targets-turtle-egg-config.patch} | 4 +- .../0398-Buffer-joins-to-world.patch} | 0 ...s-not-working-in-some-kick-messages.patch} | 2 +- .../0400-Add-more-Evoker-API.patch} | 0 ...Add-methods-to-get-translation-keys.patch} | 6 +- ...te-HoverEvent-from-ItemStack-Entity.patch} | 4 +- .../0403-Cache-block-data-strings.patch} | 12 ++-- ...rtation-and-cancel-velocity-if-tele.patch} | 37 ++++------- .../0369-Add-PlayerRecipeBookClickEvent.patch | 55 ---------------- ...erver-load-chunks-from-newer-version.patch | 41 ------------ 42 files changed, 245 insertions(+), 245 deletions(-) rename patches/{unapplied/server/0368-Inventory-getHolder-method-without-block-snapshot.patch => server/0365-Inventory-getHolder-method-without-block-snapshot.patch} (100%) create mode 100644 patches/server/0366-Add-PlayerRecipeBookClickEvent.patch rename patches/{unapplied/server/0370-Hide-sync-chunk-writes-behind-flag.patch => server/0367-Hide-sync-chunk-writes-behind-flag.patch} (93%) rename patches/{unapplied/server/0371-Add-permission-for-command-blocks.patch => server/0368-Add-permission-for-command-blocks.patch} (89%) rename patches/{unapplied/server/0372-Ensure-Entity-position-and-AABB-are-never-invalid.patch => server/0369-Ensure-Entity-position-and-AABB-are-never-invalid.patch} (91%) rename patches/{unapplied/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch => server/0370-Fix-Per-World-Difficulty-Remembering-Difficulty.patch} (79%) rename patches/{unapplied/server/0374-Paper-dumpitem-command.patch => server/0371-Paper-dumpitem-command.patch} (100%) rename patches/{unapplied/server/0375-Improve-Legacy-Component-serialization-size.patch => server/0372-Improve-Legacy-Component-serialization-size.patch} (97%) rename patches/{unapplied/server/0376-Add-Plugin-Tickets-to-API-Chunk-Methods.patch => server/0373-Add-Plugin-Tickets-to-API-Chunk-Methods.patch} (89%) rename patches/{unapplied/server/0377-Add-BlockStateMeta-clearBlockState.patch => server/0374-Add-BlockStateMeta-clearBlockState.patch} (100%) rename patches/{unapplied/server/0378-Convert-legacy-attributes-in-Item-Meta.patch => server/0375-Convert-legacy-attributes-in-Item-Meta.patch} (95%) rename patches/{unapplied/server/0379-Do-not-accept-invalid-client-settings.patch => server/0376-Do-not-accept-invalid-client-settings.patch} (90%) rename patches/{unapplied/server/0380-Improve-fix-EntityTargetLivingEntityEvent.patch => server/0377-Improve-fix-EntityTargetLivingEntityEvent.patch} (91%) rename patches/{unapplied/server/0381-Add-entity-liquid-API.patch => server/0378-Add-entity-liquid-API.patch} (90%) rename patches/{unapplied/server/0382-Add-PrepareResultEvent.patch => server/0379-Add-PrepareResultEvent.patch} (83%) rename patches/{unapplied/server/0383-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch => server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch} (85%) rename patches/{unapplied/server/0384-Fix-arrows-never-despawning-MC-125757.patch => server/0381-Fix-arrows-never-despawning-MC-125757.patch} (83%) rename patches/{unapplied/server/0385-Thread-Safe-Vanilla-Command-permission-checking.patch => server/0382-Thread-Safe-Vanilla-Command-permission-checking.patch} (93%) rename patches/{unapplied/server/0386-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch => server/0383-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch} (97%) rename patches/{unapplied/server/0387-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch => server/0384-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch} (89%) rename patches/{unapplied/server/0388-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch => server/0385-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch} (97%) rename patches/{unapplied/server/0389-Optimize-NetworkManager-Exception-Handling.patch => server/0386-Optimize-NetworkManager-Exception-Handling.patch} (100%) rename patches/{unapplied/server/0390-Fix-some-rails-connecting-improperly.patch => server/0387-Fix-some-rails-connecting-improperly.patch} (91%) rename patches/{unapplied/server/0391-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch => server/0388-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch} (100%) rename patches/{unapplied/server/0392-Brand-support.patch => server/0389-Brand-support.patch} (87%) rename patches/{unapplied/server/0393-Add-playPickupItemAnimation-to-LivingEntity.patch => server/0390-Add-playPickupItemAnimation-to-LivingEntity.patch} (81%) rename patches/{unapplied/server/0394-Don-t-require-FACING-data.patch => server/0391-Don-t-require-FACING-data.patch} (100%) rename patches/{unapplied/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch => server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch} (86%) rename patches/{unapplied/server/0396-Add-moon-phase-API.patch => server/0393-Add-moon-phase-API.patch} (90%) create mode 100644 patches/server/0394-Do-not-let-the-server-load-chunks-from-newer-version.patch rename patches/{unapplied/server/0398-Prevent-headless-pistons-from-being-created.patch => server/0395-Prevent-headless-pistons-from-being-created.patch} (65%) rename patches/{unapplied/server/0399-Add-BellRingEvent.patch => server/0396-Add-BellRingEvent.patch} (90%) rename patches/{unapplied/server/0400-Add-zombie-targets-turtle-egg-config.patch => server/0397-Add-zombie-targets-turtle-egg-config.patch} (87%) rename patches/{unapplied/server/0401-Buffer-joins-to-world.patch => server/0398-Buffer-joins-to-world.patch} (100%) rename patches/{unapplied/server/0402-Fix-hex-colors-not-working-in-some-kick-messages.patch => server/0399-Fix-hex-colors-not-working-in-some-kick-messages.patch} (97%) rename patches/{unapplied/server/0403-Add-more-Evoker-API.patch => server/0400-Add-more-Evoker-API.patch} (100%) rename patches/{unapplied/server/0404-Add-methods-to-get-translation-keys.patch => server/0401-Add-methods-to-get-translation-keys.patch} (97%) rename patches/{unapplied/server/0405-Create-HoverEvent-from-ItemStack-Entity.patch => server/0402-Create-HoverEvent-from-ItemStack-Entity.patch} (94%) rename patches/{unapplied/server/0406-Cache-block-data-strings.patch => server/0403-Cache-block-data-strings.patch} (86%) rename patches/{unapplied/server/0407-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch => server/0404-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch} (78%) delete mode 100644 patches/unapplied/server/0369-Add-PlayerRecipeBookClickEvent.patch delete mode 100644 patches/unapplied/server/0397-Do-not-let-the-server-load-chunks-from-newer-version.patch diff --git a/patches/unapplied/server/0368-Inventory-getHolder-method-without-block-snapshot.patch b/patches/server/0365-Inventory-getHolder-method-without-block-snapshot.patch similarity index 100% rename from patches/unapplied/server/0368-Inventory-getHolder-method-without-block-snapshot.patch rename to patches/server/0365-Inventory-getHolder-method-without-block-snapshot.patch diff --git a/patches/server/0366-Add-PlayerRecipeBookClickEvent.patch b/patches/server/0366-Add-PlayerRecipeBookClickEvent.patch new file mode 100644 index 0000000000..e2e9336c48 --- /dev/null +++ b/patches/server/0366-Add-PlayerRecipeBookClickEvent.patch @@ -0,0 +1,65 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: JRoy +Date: Fri, 5 Jun 2020 18:24:06 -0400 +Subject: [PATCH] Add PlayerRecipeBookClickEvent + + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index e329503681961566a76a383245303e88acef37a4..5b1c8fb2765407cab1ca41d8d2fce83df1cc5fe1 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -200,6 +200,7 @@ import net.minecraft.world.phys.Vec3; + import net.minecraft.world.phys.shapes.BooleanOp; + import net.minecraft.world.phys.shapes.Shapes; + import net.minecraft.world.phys.shapes.VoxelShape; ++import org.bukkit.NamespacedKey; + import org.slf4j.Logger; + + // CraftBukkit start +@@ -3086,21 +3087,41 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + ServerGamePacketListenerImpl.LOGGER.debug("Player {} tried to place impossible recipe {}", this.player, recipeholder.id().location()); + return; + } ++ // Paper start - Add PlayerRecipeBookClickEvent ++ NamespacedKey recipeName = org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeholder.id().location()); ++ boolean makeAll = packet.useMaxItems(); ++ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent( ++ this.player.getBukkitEntity(), recipeName, makeAll ++ ); ++ if (!paperEvent.callEvent()) { ++ return; ++ } ++ recipeName = paperEvent.getRecipe(); ++ makeAll = paperEvent.isMakeAll(); ++ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) { ++ // Paper end - Add PlayerRecipeBookClickEvent + + // CraftBukkit start - implement PlayerRecipeBookClickEvent +- org.bukkit.inventory.Recipe recipe = recipeholder.toBukkitRecipe(); ++ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(recipeName); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event + if (recipe == null) { + return; + } +- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.useMaxItems()); ++ // Paper start - Add PlayerRecipeBookClickEvent - forward to legacy event ++ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll); ++ recipeName = ((org.bukkit.Keyed) event.getRecipe()).getKey(); ++ makeAll = event.isShiftClick(); ++ } ++ if (!(this.player.containerMenu instanceof RecipeBookMenu)) { ++ return; ++ } ++ // Paper end - Add PlayerRecipeBookClickEvent - forward to legacy event + + // Cast to keyed should be safe as the recipe will never be a MerchantRecipe. +- recipeholder = this.server.getRecipeManager().byKey(CraftRecipe.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).orElse(null); ++ recipeholder = this.server.getRecipeManager().byKey(net.minecraft.resources.ResourceKey.create(net.minecraft.core.registries.Registries.RECIPE, org.bukkit.craftbukkit.util.CraftNamespacedKey.toMinecraft(recipeName))).orElse(null); // Paper - Add PlayerRecipeBookClickEvent - forward to legacy event + if (recipeholder == null) { + return; + } +- +- RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(event.isShiftClick(), this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory()); ++ RecipeBookMenu.PostPlaceAction containerrecipebook_a = containerrecipebook.handlePlacement(makeAll, this.player.isCreative(), recipeholder, this.player.serverLevel(), this.player.getInventory()); + // CraftBukkit end + + if (containerrecipebook_a == RecipeBookMenu.PostPlaceAction.PLACE_GHOST_RECIPE) { diff --git a/patches/unapplied/server/0370-Hide-sync-chunk-writes-behind-flag.patch b/patches/server/0367-Hide-sync-chunk-writes-behind-flag.patch similarity index 93% rename from patches/unapplied/server/0370-Hide-sync-chunk-writes-behind-flag.patch rename to patches/server/0367-Hide-sync-chunk-writes-behind-flag.patch index e8889b31d8..c0da32d0ed 100644 --- a/patches/unapplied/server/0370-Hide-sync-chunk-writes-behind-flag.patch +++ b/patches/server/0367-Hide-sync-chunk-writes-behind-flag.patch @@ -9,7 +9,7 @@ on harddrives. -DPaper.enable-sync-chunk-writes=true to enable diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java -index eb27ef574445e1311b763d84aa1b37128baa75f7..d6431376184e5650b370cbab204e28bc31f4dac6 100644 +index 47835226b61b726c750fe192fd94d3f8ba47565c..52e61f75f922a075ccc745198f4ba6ad8fa58ea2 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServerProperties.java @@ -146,7 +146,7 @@ public class DedicatedServerProperties extends Settings diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 10015beb7a2de890fe27bffde8f55c1dd78ce344..9d08d0610be1741b4cd18a1454e538f46928fd94 100644 +index 4faba83eb73e0d313e9131794962b727f7628a50..7fdfe1dd09812df1d8d7e5f95bcaf1b48c814e22 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -669,8 +669,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -677,8 +677,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void setPos(double x, double y, double z) { @@ -20,7 +20,7 @@ index 10015beb7a2de890fe27bffde8f55c1dd78ce344..9d08d0610be1741b4cd18a1454e538f4 } protected AABB makeBoundingBox() { -@@ -4223,7 +4223,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4412,7 +4412,29 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess return this.getZ((2.0D * this.random.nextDouble() - 1.0D) * widthScale); } @@ -50,7 +50,7 @@ index 10015beb7a2de890fe27bffde8f55c1dd78ce344..9d08d0610be1741b4cd18a1454e538f4 if (this.position.x != x || this.position.y != y || this.position.z != z) { this.position = new Vec3(x, y, z); int i = Mth.floor(x); -@@ -4241,6 +4263,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -4430,6 +4452,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess this.levelCallback.onMove(); } diff --git a/patches/unapplied/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0370-Fix-Per-World-Difficulty-Remembering-Difficulty.patch similarity index 79% rename from patches/unapplied/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch rename to patches/server/0370-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index 3fec1cd014..d6a667ddb7 100644 --- a/patches/unapplied/server/0373-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0370-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -8,19 +8,19 @@ makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0370d26bd1e1d2fe1d640b052aca8a9c05dcb9dc..dd5f74fe4c8ca81b1d1102805ea8acb9087ba91e 100644 +index b4eff440e3d9489f99e10a73611421ef877aa871..9109628a48026ceca9dd53a3e75f79510e56c95c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -836,7 +836,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop { net.minecraft.server.MinecraftServer.getServer().scheduleOnMain(() -> { net.minecraft.world.level.chunk.LevelChunk chunk = (net.minecraft.world.level.chunk.LevelChunk)c; diff --git a/patches/unapplied/server/0377-Add-BlockStateMeta-clearBlockState.patch b/patches/server/0374-Add-BlockStateMeta-clearBlockState.patch similarity index 100% rename from patches/unapplied/server/0377-Add-BlockStateMeta-clearBlockState.patch rename to patches/server/0374-Add-BlockStateMeta-clearBlockState.patch diff --git a/patches/unapplied/server/0378-Convert-legacy-attributes-in-Item-Meta.patch b/patches/server/0375-Convert-legacy-attributes-in-Item-Meta.patch similarity index 95% rename from patches/unapplied/server/0378-Convert-legacy-attributes-in-Item-Meta.patch rename to patches/server/0375-Convert-legacy-attributes-in-Item-Meta.patch index 76437f1a9b..87efb884b2 100644 --- a/patches/unapplied/server/0378-Convert-legacy-attributes-in-Item-Meta.patch +++ b/patches/server/0375-Convert-legacy-attributes-in-Item-Meta.patch @@ -30,10 +30,10 @@ index de40e522960469b98f987bd688489740446d9f85..5678d2007d5adf45dec0638c5dd848b6 public CraftAttributeMap(AttributeMap handle) { this.handle = handle; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 97c40582bca095532fff9a81515f38ea4ac527e0..5c76ba7f9ceb285d27e18369172612205be96224 100644 +index b2683d6efd53b03d7043098b19a1504885a5b3c7..af78e73755743fb2db7a99b834affc963b44bc10 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -702,7 +702,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -810,7 +810,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); diff --git a/patches/unapplied/server/0379-Do-not-accept-invalid-client-settings.patch b/patches/server/0376-Do-not-accept-invalid-client-settings.patch similarity index 90% rename from patches/unapplied/server/0379-Do-not-accept-invalid-client-settings.patch rename to patches/server/0376-Do-not-accept-invalid-client-settings.patch index e0e0f8912e..65e274aa2b 100644 --- a/patches/unapplied/server/0379-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0376-Do-not-accept-invalid-client-settings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Do not accept invalid client settings diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d2eb8c619905d87a38820a4c1179ad93093c0ac3..90e5f263dcb8033dae3ca32cbf5dbd332a109282 100644 +index 510c97062d77541425aed6ddaaad58be4290967b..09bb38460ab6fa7b6132e245d52b60244bd248eb 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3251,6 +3251,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3296,6 +3296,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/unapplied/server/0380-Improve-fix-EntityTargetLivingEntityEvent.patch b/patches/server/0377-Improve-fix-EntityTargetLivingEntityEvent.patch similarity index 91% rename from patches/unapplied/server/0380-Improve-fix-EntityTargetLivingEntityEvent.patch rename to patches/server/0377-Improve-fix-EntityTargetLivingEntityEvent.patch index 29703174a1..2777b41e11 100644 --- a/patches/unapplied/server/0380-Improve-fix-EntityTargetLivingEntityEvent.patch +++ b/patches/server/0377-Improve-fix-EntityTargetLivingEntityEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Improve/fix EntityTargetLivingEntityEvent diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java -index cc7d161b53a2295fa1745254eafb8a70c7b6c7b2..508d4f391fe563453d7bf6782b3082741c358006 100644 +index 70df68169b17fa5f732e4c73a86376ba6eb9ca13..b31f6ccc95132a7dd022b454d28814b684d99d4c 100644 --- a/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java +++ b/src/main/java/net/minecraft/world/entity/ai/behavior/StopAttackingIfTargetInvalid.java -@@ -47,9 +47,22 @@ public class StopAttackingIfTargetInvalid { - if (entityinsentient.canAttack(entityliving) && (!shouldForgetIfTargetUnreachable || !StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !alternativeCondition.test(entityliving)) { +@@ -46,9 +46,22 @@ public class StopAttackingIfTargetInvalid { + if (entityinsentient.canAttack(entityliving) && (!shouldForgetIfTargetUnreachable || !StopAttackingIfTargetInvalid.isTiredOfTryingToReachTarget(entityinsentient, behaviorbuilder_b.tryGet(memoryaccessor1))) && entityliving.isAlive() && entityliving.level() == entityinsentient.level() && !condition.test(worldserver, entityliving)) { return true; } else { + // Paper start - better track target change reason diff --git a/patches/unapplied/server/0381-Add-entity-liquid-API.patch b/patches/server/0378-Add-entity-liquid-API.patch similarity index 90% rename from patches/unapplied/server/0381-Add-entity-liquid-API.patch rename to patches/server/0378-Add-entity-liquid-API.patch index 51765a7f3a..849eeec01f 100644 --- a/patches/unapplied/server/0381-Add-entity-liquid-API.patch +++ b/patches/server/0378-Add-entity-liquid-API.patch @@ -8,10 +8,10 @@ public net.minecraft.world.entity.Entity isInRain()Z public net.minecraft.world.entity.Entity isInBubbleColumn()Z diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index ce70c8fddbe63d0af2b1f988ce9a2b40c5d48066..34321f095e12ea0cca34ff1ec00819c6350205a8 100644 +index 7fb04535b8c0744d0fa4b0c0a933234134486956..b001284e368f64871824c1f961999bb3f726de57 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1025,4 +1025,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1026,4 +1026,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return getHandle().spawnReason; } // Paper end - entity spawn reason API diff --git a/patches/unapplied/server/0382-Add-PrepareResultEvent.patch b/patches/server/0379-Add-PrepareResultEvent.patch similarity index 83% rename from patches/unapplied/server/0382-Add-PrepareResultEvent.patch rename to patches/server/0379-Add-PrepareResultEvent.patch index 985e40f2ae..9fb630a728 100644 --- a/patches/unapplied/server/0382-Add-PrepareResultEvent.patch +++ b/patches/server/0379-Add-PrepareResultEvent.patch @@ -8,10 +8,10 @@ Adds a new event for all crafting stations that generate a result slot item Anvil, Grindstone and Smithing now extend this event diff --git a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -index ffda2c984c5683edb38a56f04c53b0ea339e08fc..d685511104ac552dfc9ae2111e1bfb60fa812102 100644 +index 126565e673e94b9c66aa4547596bbf198c57c7ad..cc5aae32f34305965847ade8b530272b1126b5c9 100644 --- a/src/main/java/net/minecraft/world/inventory/AnvilMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AnvilMenu.java -@@ -327,6 +327,7 @@ public class AnvilMenu extends ItemCombinerMenu { +@@ -333,6 +333,7 @@ public class AnvilMenu extends ItemCombinerMenu { } this.createResult(); @@ -20,10 +20,10 @@ index ffda2c984c5683edb38a56f04c53b0ea339e08fc..d685511104ac552dfc9ae2111e1bfb60 } else { return false; diff --git a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java -index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48c816aba6 100644 +index 5b31d09b158c694b3e54ab3a228817accaa00a0c..8b72d1fd551dcb113f4137aee441a9531c00288a 100644 --- a/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java +++ b/src/main/java/net/minecraft/world/inventory/CartographyTableMenu.java -@@ -152,6 +152,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { +@@ -140,6 +140,7 @@ public class CartographyTableMenu extends AbstractContainerMenu { this.setupResultSlot(itemstack, itemstack1, itemstack2); } @@ -32,10 +32,10 @@ index 11d7bf4f90083991cfc8c6c5f9a1e8ad6a162843..c52c4c4210bc6ae082443318d9795c48 private void setupResultSlot(ItemStack map, ItemStack item, ItemStack oldResult) { diff --git a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -index 637d77d6b07ff9ee5ac1cb0470cbefcba5c7495e..15ec798e149d80aace186f84b9236ddeaba690c3 100644 +index 13bc52bc856031c930370828b0381e43920aabd2..8e58dbb4b110338dfe8add26697d0b1c9ec5fa9c 100644 --- a/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java +++ b/src/main/java/net/minecraft/world/inventory/GrindstoneMenu.java -@@ -160,6 +160,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { +@@ -148,6 +148,7 @@ public class GrindstoneMenu extends AbstractContainerMenu { super.slotsChanged(inventory); if (inventory == this.repairSlots) { this.createResult(); @@ -44,10 +44,10 @@ index 637d77d6b07ff9ee5ac1cb0470cbefcba5c7495e..15ec798e149d80aace186f84b9236dde } diff --git a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java -index 62432c347b86fc79ab529a7dde66bef32d0424dd..be840717e180b6b5abd14db6cc9263349737f9a3 100644 +index 594a387d7e3a67da02ea54b4f259426df2eb21a2..4734dd90f2a66e1ac7a64b35ecd62a630108cf07 100644 --- a/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/ItemCombinerMenu.java -@@ -110,6 +110,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { +@@ -96,6 +96,7 @@ public abstract class ItemCombinerMenu extends AbstractContainerMenu { super.slotsChanged(inventory); if (inventory == this.inputSlots) { this.createResult(); @@ -56,10 +56,10 @@ index 62432c347b86fc79ab529a7dde66bef32d0424dd..be840717e180b6b5abd14db6cc926334 } diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -index 69ed0753c224cb7746762b4b94c4d79d608951b8..2de558dd205a1078fdcac1bce256d059b9bf5d5f 100644 +index d988747ccb81ca74db8ce14fea49d13c9c1b4476..58470d8e9a4ceb1eca05b342481ed8260588e225 100644 --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -@@ -249,7 +249,8 @@ public class LoomMenu extends AbstractContainerMenu { +@@ -237,7 +237,8 @@ public class LoomMenu extends AbstractContainerMenu { this.resultSlot.set(ItemStack.EMPTY); } @@ -70,11 +70,11 @@ index 69ed0753c224cb7746762b4b94c4d79d608951b8..2de558dd205a1078fdcac1bce256d059 this.resultSlot.set(ItemStack.EMPTY); this.selectablePatterns = List.of(); diff --git a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java -index 0735705def4f9505b7f16df2497cc78bbf5a8373..86e51fcce767d265ee0d3beb611be2119085830b 100644 +index 4b0d07a22cb922aa5ef0c99279663158a5918f1f..89d2f26504bb072c2d75af4ec600ca123e10a600 100644 --- a/src/main/java/net/minecraft/world/inventory/SmithingMenu.java +++ b/src/main/java/net/minecraft/world/inventory/SmithingMenu.java -@@ -121,6 +121,7 @@ public class SmithingMenu extends ItemCombinerMenu { - } +@@ -115,6 +115,7 @@ public class SmithingMenu extends ItemCombinerMenu { + this.hasRecipeError.set(flag ? 1 : 0); } + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent @@ -82,22 +82,22 @@ index 0735705def4f9505b7f16df2497cc78bbf5a8373..86e51fcce767d265ee0d3beb611be211 @Override diff --git a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java -index 30ea1f9e97db86a2ad7baeea4f5a76c821874daa..5b4f03128499b0c1a4b8c5f5ccd17e4bdb391e81 100644 +index 0fb0ee5b22dc96c48d68e4391fd71b03d4e799f0..97837d1baf6b929a50e5562ef466050e70c2c8b1 100644 --- a/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java +++ b/src/main/java/net/minecraft/world/inventory/StonecutterMenu.java -@@ -182,6 +182,7 @@ public class StonecutterMenu extends AbstractContainerMenu { - this.setupRecipeList(inventory, itemstack); +@@ -170,6 +170,7 @@ public class StonecutterMenu extends AbstractContainerMenu { + this.setupRecipeList(itemstack); } + org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareResultEvent(this, RESULT_SLOT); // Paper - Add PrepareResultEvent } - private static SingleRecipeInput createRecipeInput(Container inventory) { + private void setupRecipeList(ItemStack stack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index f3ec3d14e66b9c1dff32088d4aef57e21265048c..f633d08b35bf9018367a449cc000c6c6ca5a44cd 100644 +index b40117e9940ab493ea4a945dbd9754a38b1159b9..62f4fd6553ab0310e2c0dde1d917c63679365798 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1681,6 +1681,12 @@ public class CraftEventFactory { +@@ -1679,6 +1679,12 @@ populateFields(victim, event); // Paper - make cancellable } public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) { @@ -110,7 +110,7 @@ index f3ec3d14e66b9c1dff32088d4aef57e21265048c..f633d08b35bf9018367a449cc000c6c6 PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -1688,6 +1694,12 @@ public class CraftEventFactory { +@@ -1686,6 +1692,12 @@ populateFields(victim, event); // Paper - make cancellable } public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { @@ -123,7 +123,7 @@ index f3ec3d14e66b9c1dff32088d4aef57e21265048c..f633d08b35bf9018367a449cc000c6c6 PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -1695,12 +1707,39 @@ public class CraftEventFactory { +@@ -1693,12 +1705,39 @@ populateFields(victim, event); // Paper - make cancellable } public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { diff --git a/patches/unapplied/server/0383-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/patches/server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch similarity index 85% rename from patches/unapplied/server/0383-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch rename to patches/server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 24d5f2e649..e97a181c53 100644 --- a/patches/unapplied/server/0383-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/patches/server/0380-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't check chunk for portal on world gen entity add diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8920099eb488c37b036b7bd97fbd4f7db505c77c..906e8589483b93bcdb55677f7f942f6c7a89caf8 100644 +index 65909e0a8f8b68f9a4dacefda9069c8263a96ada..91a5166e69a03d846a1b396ba964003c12a0dcdb 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3659,7 +3659,7 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3798,7 +3798,7 @@ public abstract class LivingEntity extends Entity implements Attackable { Entity entity = this.getVehicle(); super.stopRiding(suppressCancellation); // Paper - Force entity dismount during teleportation diff --git a/patches/unapplied/server/0384-Fix-arrows-never-despawning-MC-125757.patch b/patches/server/0381-Fix-arrows-never-despawning-MC-125757.patch similarity index 83% rename from patches/unapplied/server/0384-Fix-arrows-never-despawning-MC-125757.patch rename to patches/server/0381-Fix-arrows-never-despawning-MC-125757.patch index dbcb4ce450..ed2c8a3409 100644 --- a/patches/unapplied/server/0384-Fix-arrows-never-despawning-MC-125757.patch +++ b/patches/server/0381-Fix-arrows-never-despawning-MC-125757.patch @@ -9,12 +9,12 @@ instead of getting stuck in a never despawn state (bubble columns, etc). diff --git a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -index 6c79997ba46e641de5aa12ff8a3d790d04a5a475..746bb8a36bd6c6ef953289576af499caad588d79 100644 +index 78053060dbff7f8a859f9fecb356491f497eed7e..bc167c21f82ad09952f6cdbf1016523062890f8b 100644 --- a/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java +++ b/src/main/java/net/minecraft/world/entity/projectile/AbstractArrow.java -@@ -238,6 +238,7 @@ public abstract class AbstractArrow extends Projectile { +@@ -242,6 +242,7 @@ public abstract class AbstractArrow extends Projectile { + } - ++this.inGroundTime; } else { + if (tickCount > 200) this.tickDespawn(); // Paper - tick despawnCounter regardless after 10 seconds this.inGroundTime = 0; diff --git a/patches/unapplied/server/0385-Thread-Safe-Vanilla-Command-permission-checking.patch b/patches/server/0382-Thread-Safe-Vanilla-Command-permission-checking.patch similarity index 93% rename from patches/unapplied/server/0385-Thread-Safe-Vanilla-Command-permission-checking.patch rename to patches/server/0382-Thread-Safe-Vanilla-Command-permission-checking.patch index a210e43dce..475b277470 100644 --- a/patches/unapplied/server/0385-Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/patches/server/0382-Thread-Safe-Vanilla-Command-permission-checking.patch @@ -26,10 +26,10 @@ index 14ccd0c8f721e9be7dca8a5dcb8ef95b5cd82731..1f4963bf4681a771130abc1da1798196 } // CraftBukkit end diff --git a/src/main/java/net/minecraft/commands/CommandSourceStack.java b/src/main/java/net/minecraft/commands/CommandSourceStack.java -index 2a22827f44dd0d524c22264447959a6979e9f0de..f3c83bb20a73b489f1fb6bacb69388902b1b6fe7 100644 +index 5316f148f3f9128690f019d544e462b042d8d797..f31c5d665678c3163ed4469f8e9d395b890c1bbe 100644 --- a/src/main/java/net/minecraft/commands/CommandSourceStack.java +++ b/src/main/java/net/minecraft/commands/CommandSourceStack.java -@@ -64,7 +64,7 @@ public class CommandSourceStack implements ExecutionCommandSource> list = null; diff --git a/src/main/java/net/minecraft/server/PlayerAdvancements.java b/src/main/java/net/minecraft/server/PlayerAdvancements.java -index 4c85abf29441645039b6a554a50e1d3274229de6..d85fb1e2ea0eaef81e9039b47d18f83507e05a59 100644 +index 0542b61053ed7039e54856eab86ba5842403e4fc..0fe941b0802f2966ad55509baac124f56ecef999 100644 --- a/src/main/java/net/minecraft/server/PlayerAdvancements.java +++ b/src/main/java/net/minecraft/server/PlayerAdvancements.java @@ -63,6 +63,7 @@ public class PlayerAdvancements { diff --git a/patches/unapplied/server/0389-Optimize-NetworkManager-Exception-Handling.patch b/patches/server/0386-Optimize-NetworkManager-Exception-Handling.patch similarity index 100% rename from patches/unapplied/server/0389-Optimize-NetworkManager-Exception-Handling.patch rename to patches/server/0386-Optimize-NetworkManager-Exception-Handling.patch diff --git a/patches/unapplied/server/0390-Fix-some-rails-connecting-improperly.patch b/patches/server/0387-Fix-some-rails-connecting-improperly.patch similarity index 91% rename from patches/unapplied/server/0390-Fix-some-rails-connecting-improperly.patch rename to patches/server/0387-Fix-some-rails-connecting-improperly.patch index 4f5cd86538..c22d4e1fdf 100644 --- a/patches/unapplied/server/0390-Fix-some-rails-connecting-improperly.patch +++ b/patches/server/0387-Fix-some-rails-connecting-improperly.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Fix some rails connecting improperly diff --git a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -index f9b6db516fa0788a6d4d40fa7ea2039cd3282b24..0961f6f5e627debe0bf02670d922e6d3388ba631 100644 +index 4a5badc4bb1e2c29016735e9df93c7ac4d3f363d..f9a55f76fed8609bca167b2ea37464e8079de0c0 100644 --- a/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/BaseRailBlock.java -@@ -68,6 +68,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl +@@ -71,6 +71,7 @@ public abstract class BaseRailBlock extends Block implements SimpleWaterloggedBl state = this.updateDir(world, pos, state, true); if (this.isStraight) { - world.neighborChanged(state, pos, this, pos, notify); + world.neighborChanged(state, pos, this, null, notify); + state = world.getBlockState(pos); // Paper - Fix some rails connecting improperly } return state; diff --git a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java -index e5534fd35a8f9736cc25471e9f0feaa8da88c85d..55a97da8786ec0ae98abe56876c00f4678ba0007 100644 +index 3de30845aae143e5be5db921004142792522607d..1e2f56b5c40c3dc72bc38354160f8e7de1f4f5cf 100644 --- a/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java +++ b/src/main/java/net/minecraft/world/level/block/DetectorRailBlock.java -@@ -77,6 +77,7 @@ public class DetectorRailBlock extends BaseRailBlock { +@@ -78,6 +78,7 @@ public class DetectorRailBlock extends BaseRailBlock { private void checkPressed(Level world, BlockPos pos, BlockState state) { if (this.canSurvive(state, world, pos)) { diff --git a/patches/unapplied/server/0391-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch b/patches/server/0388-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch similarity index 100% rename from patches/unapplied/server/0391-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch rename to patches/server/0388-Fix-regex-mistake-in-CB-NBT-int-deserialization.patch diff --git a/patches/unapplied/server/0392-Brand-support.patch b/patches/server/0389-Brand-support.patch similarity index 87% rename from patches/unapplied/server/0392-Brand-support.patch rename to patches/server/0389-Brand-support.patch index af42b533fd..7404740417 100644 --- a/patches/unapplied/server/0392-Brand-support.patch +++ b/patches/server/0389-Brand-support.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Brand support diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index e6e7dc17d1196a8211a565355f34b5dcfd478852..45181bc9c422507682d479e4d43177ecd3253971 100644 +index 807068fc6065f71961d34cb4f18b6eb39ae49637..c468947990cf05e554006e51d87b72fad7c28e55 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java -@@ -294,6 +294,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { +@@ -322,6 +322,7 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { // CraftBukkit end public boolean isRealPlayer; // Paper public com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper - PlayerNaturallySpawnCreaturesEvent @@ -17,10 +17,10 @@ index e6e7dc17d1196a8211a565355f34b5dcfd478852..45181bc9c422507682d479e4d43177ec public ServerPlayer(MinecraftServer server, ServerLevel world, GameProfile profile, ClientInformation clientOptions) { super(world, world.getSharedSpawnPos(), world.getSharedSpawnAngle(), profile); diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af729e21e83 100644 +index b9fbaddcc8239bf737fdea51790f678306e511eb..9a8b08d4b70b8890961e4af7ce6e870aa1c7c810 100644 --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java -@@ -83,6 +83,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -84,6 +84,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack private volatile boolean suspendFlushingOnServerThread = false; public final java.util.Map packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit @@ -28,7 +28,7 @@ index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af7 public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit this.server = minecraftserver; -@@ -148,6 +149,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -155,6 +156,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @Override public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { @@ -40,7 +40,7 @@ index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af7 if (!(packet.payload() instanceof DiscardedPayload)) { return; } -@@ -179,6 +185,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack +@@ -186,6 +192,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack try { byte[] data = new byte[payload.readableBytes()]; payload.readBytes(data); @@ -57,10 +57,10 @@ index 4f62abfe62c951b7a1df36ece34747100d6a4ff7..48085b2e7197dc44e76b812bdd514af7 } catch (Exception ex) { ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 068ff2c228308ec87fcc6d1352bd63b91bd34a93..854533854dfba24b59a15265ac759331e3ddfc74 100644 +index f836a65db1028b51ebd425251ca37e0c439d4ad6..eb2954c9b51d4fd76cf5aec17899218f4de7076d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -@@ -3139,6 +3139,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { +@@ -3152,6 +3152,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { // Paper end }; diff --git a/patches/unapplied/server/0393-Add-playPickupItemAnimation-to-LivingEntity.patch b/patches/server/0390-Add-playPickupItemAnimation-to-LivingEntity.patch similarity index 81% rename from patches/unapplied/server/0393-Add-playPickupItemAnimation-to-LivingEntity.patch rename to patches/server/0390-Add-playPickupItemAnimation-to-LivingEntity.patch index e66408f814..64c59dce17 100644 --- a/patches/unapplied/server/0393-Add-playPickupItemAnimation-to-LivingEntity.patch +++ b/patches/server/0390-Add-playPickupItemAnimation-to-LivingEntity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add playPickupItemAnimation to LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 733c69a2cfa60fb8c920400e3d9acfc2465090e5..fad7d8130f6db70c7bfca9d02027d8a41f5309c1 100644 +index 35130dc4e20ef644b5764091fcbccda2e4da780b..5beee554567d36f2a3b871cf6ec3ecb3d2353592 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -990,4 +990,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -1009,4 +1009,11 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } } // Paper end - entity jump API diff --git a/patches/unapplied/server/0394-Don-t-require-FACING-data.patch b/patches/server/0391-Don-t-require-FACING-data.patch similarity index 100% rename from patches/unapplied/server/0394-Don-t-require-FACING-data.patch rename to patches/server/0391-Don-t-require-FACING-data.patch diff --git a/patches/unapplied/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/patches/server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch similarity index 86% rename from patches/unapplied/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch rename to patches/server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index b202f0e934..44e149484c 100644 --- a/patches/unapplied/server/0395-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/patches/server/0392-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java -index 5b89d834a7c01530807e61ea25af2b01f004ce86..50d2e628590e8563d2ef5b987f764cf1785e3b50 100644 +index 090d2fde891346ee634a8964b562715f4dd206d0..465b6a1bbdbb193c6ecf5fd1598e1e4a4f8dbbbc 100644 --- a/src/main/java/net/minecraft/server/level/ServerLevel.java +++ b/src/main/java/net/minecraft/server/level/ServerLevel.java -@@ -1668,7 +1668,9 @@ public class ServerLevel extends Level implements WorldGenLevel { +@@ -1730,7 +1730,9 @@ public class ServerLevel extends Level implements ServerEntityGetter, WorldGenLe float f1 = this.levelData.getSpawnAngle(); if (!blockposition1.equals(pos) || f1 != angle) { @@ -19,10 +19,10 @@ index 5b89d834a7c01530807e61ea25af2b01f004ce86..50d2e628590e8563d2ef5b987f764cf1 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c35fd2fcb6ced6a16816637353d03c88f1d49d1b..99fccedaab2600881683140e10ee17377375b911 100644 +index 3ea157df3df6f590195191f2c24faead703a0bf8..04ef1c3433d3ac8a58f0d460877e176668e0fc8f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -246,12 +246,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -250,12 +250,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean setSpawnLocation(int x, int y, int z, float angle) { try { diff --git a/patches/unapplied/server/0396-Add-moon-phase-API.patch b/patches/server/0393-Add-moon-phase-API.patch similarity index 90% rename from patches/unapplied/server/0396-Add-moon-phase-API.patch rename to patches/server/0393-Add-moon-phase-API.patch index 539ccca6de..be42d9302b 100644 --- a/patches/unapplied/server/0396-Add-moon-phase-API.patch +++ b/patches/server/0393-Add-moon-phase-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add moon phase API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java -index 454f3a08c4d319f3d3fe2b1209c4d8b9fa9d4d08..1963e826548c5a8859c50f57654784c3aef50e44 100644 +index 2b5e8d01a31de154faa18c55cdddd3bd7f462891..93dadbf659e41c923268d8ec782fcbdc8aaeff68 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftRegionAccessor.java @@ -509,4 +509,11 @@ public abstract class CraftRegionAccessor implements RegionAccessor { diff --git a/patches/server/0394-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/server/0394-Do-not-let-the-server-load-chunks-from-newer-version.patch new file mode 100644 index 0000000000..3bdfea31f7 --- /dev/null +++ b/patches/server/0394-Do-not-let-the-server-load-chunks-from-newer-version.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Zach Brown +Date: Tue, 23 Jul 2019 20:44:47 -0500 +Subject: [PATCH] Do not let the server load chunks from newer versions + +If the server attempts to load a chunk generated by a newer version of +the game, immediately stop the server to prevent data corruption. + +You can override this functionality at your own peril. + +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +index 92ad7704a77c024afe090488764eaf59a4f7505f..d7a204216332ccbd6bece23bd507be0366ea4d61 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/SerializableChunkData.java +@@ -104,11 +104,25 @@ public record SerializableChunkData(Registry biomeRegistry, ChunkPos chun + } + // Paper end - guard against serializing mismatching coordinates + ++ // Paper start - Do not let the server load chunks from newer versions ++ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion(); ++ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); ++ // Paper end - Do not let the server load chunks from newer versions ++ + @Nullable + public static SerializableChunkData parse(LevelHeightAccessor world, RegistryAccess registryManager, CompoundTag nbt) { + if (!nbt.contains("Status", 8)) { + return null; + } else { ++ // Paper start - Do not let the server load chunks from newer versions ++ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) { ++ final int dataVersion = nbt.getInt("DataVersion"); ++ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { ++ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); ++ System.exit(1); ++ } ++ } ++ // Paper end - Do not let the server load chunks from newer versions + ChunkPos chunkcoordintpair = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate + long i = nbt.getLong("LastUpdate"); + long j = nbt.getLong("InhabitedTime"); diff --git a/patches/unapplied/server/0398-Prevent-headless-pistons-from-being-created.patch b/patches/server/0395-Prevent-headless-pistons-from-being-created.patch similarity index 65% rename from patches/unapplied/server/0398-Prevent-headless-pistons-from-being-created.patch rename to patches/server/0395-Prevent-headless-pistons-from-being-created.patch index 9b5071ea2f..1cbd0b1c6c 100644 --- a/patches/unapplied/server/0398-Prevent-headless-pistons-from-being-created.patch +++ b/patches/server/0395-Prevent-headless-pistons-from-being-created.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent headless pistons from being created Prevent headless pistons from being created by explosions or tree/mushroom growth. -diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index d4fe425954d36f0baddb256e3c83009a84084b72..edcc9d53ad81e2b2444335ac79abde5a4e2d9d47 100644 ---- a/src/main/java/net/minecraft/world/level/Explosion.java -+++ b/src/main/java/net/minecraft/world/level/Explosion.java -@@ -208,6 +208,15 @@ public class Explosion { +diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java +index d3d74a7f306d88b0d5cd83893b3ee5e750fd4caf..86656de31b1e33381eddd3ef210122118b31e620 100644 +--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java ++++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java +@@ -164,6 +164,15 @@ public class ServerExplosion implements Explosion { if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) { set.add(blockposition); @@ -17,8 +17,8 @@ index d4fe425954d36f0baddb256e3c83009a84084b72..edcc9d53ad81e2b2444335ac79abde5a + if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) { + net.minecraft.world.level.block.entity.BlockEntity extension = this.level.getBlockEntity(blockposition); + if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) { -+ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING); -+ set.add(blockposition.relative(direction.getOpposite())); ++ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING); ++ set.add(blockposition.relative(direction.getOpposite())); + } + } + // Paper end - prevent headless pistons from forming diff --git a/patches/unapplied/server/0399-Add-BellRingEvent.patch b/patches/server/0396-Add-BellRingEvent.patch similarity index 90% rename from patches/unapplied/server/0399-Add-BellRingEvent.patch rename to patches/server/0396-Add-BellRingEvent.patch index 6a7c834c6a..9c5162d578 100644 --- a/patches/unapplied/server/0399-Add-BellRingEvent.patch +++ b/patches/server/0396-Add-BellRingEvent.patch @@ -7,10 +7,10 @@ Add a new event, BellRingEvent, to trigger whenever a player rings a village bell. Passes along the bell block and the player who rang it. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index f633d08b35bf9018367a449cc000c6c6ca5a44cd..dbe7931dd7eb43f9381463d3a57ba1eb53820985 100644 +index 62f4fd6553ab0310e2c0dde1d917c63679365798..c7d78f54694b464696c0f1edd0b135d1d5bcde3e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -378,10 +378,11 @@ public class CraftEventFactory { +@@ -377,10 +377,11 @@ public class CraftEventFactory { return tradeSelectEvent; } diff --git a/patches/unapplied/server/0400-Add-zombie-targets-turtle-egg-config.patch b/patches/server/0397-Add-zombie-targets-turtle-egg-config.patch similarity index 87% rename from patches/unapplied/server/0400-Add-zombie-targets-turtle-egg-config.patch rename to patches/server/0397-Add-zombie-targets-turtle-egg-config.patch index 56529e1fd4..2fb3a9a22c 100644 --- a/patches/unapplied/server/0400-Add-zombie-targets-turtle-egg-config.patch +++ b/patches/server/0397-Add-zombie-targets-turtle-egg-config.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add zombie targets turtle egg config 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 e2a3978899497b6622829d6577cfaa723092da9d..78254df3e5fbcb0a90c2f9eb9c9343792238f685 100644 +index 2ed71c9a091bedea276f9043fb0c082dd250cdae..9adcaa646dff7f5415a467a2bfe5b817e17f5640 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Zombie.java +++ b/src/main/java/net/minecraft/world/entity/monster/Zombie.java -@@ -110,7 +110,7 @@ public class Zombie extends Monster { +@@ -112,7 +112,7 @@ public class Zombie extends Monster { @Override protected void registerGoals() { diff --git a/patches/unapplied/server/0401-Buffer-joins-to-world.patch b/patches/server/0398-Buffer-joins-to-world.patch similarity index 100% rename from patches/unapplied/server/0401-Buffer-joins-to-world.patch rename to patches/server/0398-Buffer-joins-to-world.patch diff --git a/patches/unapplied/server/0402-Fix-hex-colors-not-working-in-some-kick-messages.patch b/patches/server/0399-Fix-hex-colors-not-working-in-some-kick-messages.patch similarity index 97% rename from patches/unapplied/server/0402-Fix-hex-colors-not-working-in-some-kick-messages.patch rename to patches/server/0399-Fix-hex-colors-not-working-in-some-kick-messages.patch index 6124f32529..1cafcc355b 100644 --- a/patches/unapplied/server/0402-Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/patches/server/0399-Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -29,7 +29,7 @@ index 946b423d2184f903dc29c923d7dbe05aaa469c09..0c1bdf2329936ce479a2cc53e8a46bd2 this.connection.disconnect((Component) ichatmutablecomponent); } else { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index de25b9ea8aa4b7d6fd3fed12cdd16be9ddfcbfff..d2d153e587e624025ef01fbe3dcfa4bf06f1a06b 100644 +index fd9e6781a18d41ca3982788711749d11575566d0..9d5723cdfdbf6257a71e57842aea9ba317fc049a 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -133,7 +133,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener, diff --git a/patches/unapplied/server/0403-Add-more-Evoker-API.patch b/patches/server/0400-Add-more-Evoker-API.patch similarity index 100% rename from patches/unapplied/server/0403-Add-more-Evoker-API.patch rename to patches/server/0400-Add-more-Evoker-API.patch diff --git a/patches/unapplied/server/0404-Add-methods-to-get-translation-keys.patch b/patches/server/0401-Add-methods-to-get-translation-keys.patch similarity index 97% rename from patches/unapplied/server/0404-Add-methods-to-get-translation-keys.patch rename to patches/server/0401-Add-methods-to-get-translation-keys.patch index 00eaa98c22..bc50b97d02 100644 --- a/patches/unapplied/server/0404-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0401-Add-methods-to-get-translation-keys.patch @@ -11,7 +11,7 @@ public org.bukkit.craftbukkit.inventory.CraftMetaFirework getNBT(Lorg/bukkit/Fir Co-authored-by: MeFisto94 diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index f041b5d80bff9c022b007e04ef1558e9116acc6b..a586442422a2b2c06b785af0d261d3e19eb1d59b 100644 +index aae00320ab8003420bae5de7df47f553b62c5aab..3fa3de9a89550ec2fcb8ca663742826c0c3136b6 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -669,5 +669,10 @@ public class CraftBlock implements Block { @@ -64,10 +64,10 @@ index f73017bff613bd62b86c974b29576e241c24c927..59c9c970b83f62245d860994c4ac0c21 public String getTranslationKey() { return Util.makeDescriptionId("enchantment", this.handle.unwrapKey().get().location()); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java -index d20fdd4f06faa09c7d9f9e04f379cf0fa68db9bb..66d773cadb74f9176e6cf68a565568034f52ec63 100644 +index 0e9d3d823608a694ef1de5c4fec593951d678c1a..68756419ac6ee292db9569eab380a5c14d748002 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemType.java -@@ -240,4 +240,11 @@ public class CraftItemType implements ItemType.Typed, Han +@@ -237,4 +237,11 @@ public class CraftItemType implements ItemType.Typed, Han public Material asMaterial() { return Registry.MATERIAL.get(this.key); } diff --git a/patches/unapplied/server/0405-Create-HoverEvent-from-ItemStack-Entity.patch b/patches/server/0402-Create-HoverEvent-from-ItemStack-Entity.patch similarity index 94% rename from patches/unapplied/server/0405-Create-HoverEvent-from-ItemStack-Entity.patch rename to patches/server/0402-Create-HoverEvent-from-ItemStack-Entity.patch index 081d6c07e5..ff6ef6b1cc 100644 --- a/patches/unapplied/server/0405-Create-HoverEvent-from-ItemStack-Entity.patch +++ b/patches/server/0402-Create-HoverEvent-from-ItemStack-Entity.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index fd0df053cd5e8802991e665185e7f90f8001d80c..eabb8b42b890224dd19b879ff276e9908674310d 100644 +index 685aa3c35dc593b1d923a31967649b468df8a238..19c1faecb398f5b91dd04827b66038c352e5b4e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -@@ -246,4 +246,44 @@ public final class CraftItemFactory implements ItemFactory { +@@ -249,4 +249,44 @@ public final class CraftItemFactory implements ItemFactory { return nms != null ? net.minecraft.locale.Language.getInstance().getOrDefault(nms.getItem().getDescriptionId(nms)) : null; } // Paper end - add getI18NDisplayName diff --git a/patches/unapplied/server/0406-Cache-block-data-strings.patch b/patches/server/0403-Cache-block-data-strings.patch similarity index 86% rename from patches/unapplied/server/0406-Cache-block-data-strings.patch rename to patches/server/0403-Cache-block-data-strings.patch index d9ac173303..c1650c08a1 100644 --- a/patches/unapplied/server/0406-Cache-block-data-strings.patch +++ b/patches/server/0403-Cache-block-data-strings.patch @@ -5,22 +5,22 @@ Subject: [PATCH] Cache block data strings diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index dd5f74fe4c8ca81b1d1102805ea8acb9087ba91e..d2866b9f7e6c8f0ca30d451c93c56caefb2c1b5c 100644 +index 9109628a48026ceca9dd53a3e75f79510e56c95c..b1447fb684f5cbdc9106363870f5551ee9e1342c 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2145,6 +2145,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop%s", nms, bukkit); } diff --git a/patches/unapplied/server/0407-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch b/patches/server/0404-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch similarity index 78% rename from patches/unapplied/server/0407-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch rename to patches/server/0404-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch index a480b44af1..254c21a45f 100644 --- a/patches/unapplied/server/0407-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch +++ b/patches/server/0404-Fix-Entity-Teleportation-and-cancel-velocity-if-tele.patch @@ -9,10 +9,10 @@ as this is how Vanilla teleports entities. Cancel any pending motion when teleported. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 90e5f263dcb8033dae3ca32cbf5dbd332a109282..82f49aad1d0ce2d62bf61aa634ebef3711d4d930 100644 +index 09bb38460ab6fa7b6132e245d52b60244bd248eb..319717d5b67b9bc2a261bc69679c2e6634d7696c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -679,7 +679,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -678,7 +678,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } @@ -21,20 +21,11 @@ index 90e5f263dcb8033dae3ca32cbf5dbd332a109282..82f49aad1d0ce2d62bf61aa634ebef37 this.lastGoodX = this.awaitingPositionFromClient.x; this.lastGoodY = this.awaitingPositionFromClient.y; this.lastGoodZ = this.awaitingPositionFromClient.z; -@@ -1594,7 +1594,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - // CraftBukkit end - - this.awaitingTeleportTime = this.tickCount; -- this.player.absMoveTo(d0, d1, d2, f, f1); -+ this.player.moveTo(d0, d1, d2, f, f1); // Paper - Fix Entity Teleportation and cancel velocity if teleported - this.player.connection.send(new ClientboundPlayerPositionPacket(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.awaitingTeleport)); - } - diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 9d08d0610be1741b4cd18a1454e538f46928fd94..f1383906dbd16e088f57c9c77c051c8501b155cc 100644 +index 7fdfe1dd09812df1d8d7e5f95bcaf1b48c814e22..f8fd729d53248c7598a118d89fedf340f82cdd61 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java -@@ -171,6 +171,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -179,6 +179,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess // CraftBukkit start private static final int CURRENT_LEVEL = 2; @@ -42,7 +33,7 @@ index 9d08d0610be1741b4cd18a1454e538f46928fd94..f1383906dbd16e088f57c9c77c051c85 static boolean isLevelAtLeast(CompoundTag tag, int level) { return tag.contains("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } -@@ -1873,6 +1874,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -1943,6 +1944,13 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess } public void moveTo(double x, double y, double z, float yaw, float pitch) { @@ -57,19 +48,19 @@ index 9d08d0610be1741b4cd18a1454e538f46928fd94..f1383906dbd16e088f57c9c77c051c85 this.setYRot(yaw); this.setXRot(pitch); diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java -index a28e6b6a50cfd9191732ad2e4aca5f639a1fae75..244e328c6f67cfa543ee283715bb3b89dbaa0f0c 100644 +index 2db75673e525708d04bda9f6c9af80e7f8d361e6..be2b5f56f6f29c82c4fa9df33287d0ddb589f383 100644 --- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java +++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonStrafePlayerPhase.java -@@ -78,6 +78,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { +@@ -79,6 +79,7 @@ public class DragonStrafePlayerPhase extends AbstractDragonPhaseInstance { } - DragonFireball dragonFireball = new DragonFireball(this.dragon.level(), this.dragon, vec34.normalize()); + DragonFireball dragonFireball = new DragonFireball(world, this.dragon, vec34.normalize()); + dragonFireball.preserveMotion = true; // Paper - Fix Entity Teleportation and cancel velocity if teleported dragonFireball.moveTo(o, p, q, 0.0F, 0.0F); if (new com.destroystokyo.paper.event.entity.EnderDragonShootFireballEvent((org.bukkit.entity.EnderDragon) dragon.getBukkitEntity(), (org.bukkit.entity.DragonFireball) dragonFireball.getBukkitEntity()).callEvent()) // Paper - EnderDragon Events - this.dragon.level().addFreshEntity(dragonFireball); + world.addFreshEntity(dragonFireball); diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java -index b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78..8efc06d29c62fa2be8515ed3359d52a6d4b807d2 100644 +index 56dbe701a93eb9f1309bec92e5d3b310860a4dc5..1b6ec72f59504d2f420d6d5dcbed4d3b9115e3d8 100644 --- a/src/main/java/net/minecraft/world/level/BaseSpawner.java +++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java @@ -164,6 +164,7 @@ public abstract class BaseSpawner { @@ -81,10 +72,10 @@ index b90127f9f805fdb5bb43a4b8ad2b10499b0b6b78..8efc06d29c62fa2be8515ed3359d52a6 if (entity instanceof Mob) { Mob entityinsentient = (Mob) entity; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 34321f095e12ea0cca34ff1ec00819c6350205a8..5f5788a502642463091fb76e98703aaec7a86836 100644 +index b001284e368f64871824c1f961999bb3f726de57..abecb0235eee3e62a84f15f2ef100efcf3fcbf2a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -240,7 +240,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -241,7 +241,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } // entity.setLocation() throws no event, and so cannot be cancelled @@ -94,10 +85,10 @@ index 34321f095e12ea0cca34ff1ec00819c6350205a8..5f5788a502642463091fb76e98703aae this.entity.setYHeadRot(location.getYaw()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index fad7d8130f6db70c7bfca9d02027d8a41f5309c1..8a8189e8f2f201880748eb79805bb0b33688e814 100644 +index 5beee554567d36f2a3b871cf6ec3ecb3d2353592..db15382f35464de43a2fe0a41aca070a8c834777 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -@@ -596,6 +596,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { +@@ -603,6 +603,7 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { } ((AbstractHurtingProjectile) launch).projectileSource = this; diff --git a/patches/unapplied/server/0369-Add-PlayerRecipeBookClickEvent.patch b/patches/unapplied/server/0369-Add-PlayerRecipeBookClickEvent.patch deleted file mode 100644 index add0eaf3d4..0000000000 --- a/patches/unapplied/server/0369-Add-PlayerRecipeBookClickEvent.patch +++ /dev/null @@ -1,55 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: JRoy -Date: Fri, 5 Jun 2020 18:24:06 -0400 -Subject: [PATCH] Add PlayerRecipeBookClickEvent - - -diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3455781a47fbececab33406e829ceb392c72a113..b4af560246c1fe102bae9ec9383cbef385bb1887 100644 ---- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3056,16 +3056,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl - if (!this.player.containerMenu.stillValid(this.player)) { - ServerGamePacketListenerImpl.LOGGER.debug("Player {} interacted with invalid menu {}", this.player, this.player.containerMenu); - } else { -+ // Paper start - Add PlayerRecipeBookClickEvent -+ ResourceLocation recipeName = packet.getRecipe(); -+ boolean makeAll = packet.isShiftDown(); -+ com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent paperEvent = new com.destroystokyo.paper.event.player.PlayerRecipeBookClickEvent( -+ this.player.getBukkitEntity(), org.bukkit.craftbukkit.util.CraftNamespacedKey.fromMinecraft(recipeName), makeAll -+ ); -+ if (!paperEvent.callEvent()) { -+ return; -+ } -+ recipeName = CraftNamespacedKey.toMinecraft(paperEvent.getRecipe()); -+ makeAll = paperEvent.isMakeAll(); -+ if (org.bukkit.event.player.PlayerRecipeBookClickEvent.getHandlerList().getRegisteredListeners().length > 0) { -+ // Paper end - Add PlayerRecipeBookClickEvent - // CraftBukkit start - implement PlayerRecipeBookClickEvent -- org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(packet.getRecipe())); -+ org.bukkit.inventory.Recipe recipe = this.cserver.getRecipe(CraftNamespacedKey.fromMinecraft(recipeName)); // Paper - if (recipe == null) { - return; - } -- org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, packet.isShiftDown()); -+ // Paper start - Add PlayerRecipeBookClickEvent -+ org.bukkit.event.player.PlayerRecipeBookClickEvent event = CraftEventFactory.callRecipeBookClickEvent(this.player, recipe, makeAll); -+ recipeName = CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey()); -+ makeAll = event.isShiftClick(); -+ } -+ if (!(this.player.containerMenu instanceof RecipeBookMenu recipeBookMenu)) { -+ return; -+ } -+ // Paper end - Add PlayerRecipeBookClickEvent - - // Cast to keyed should be safe as the recipe will never be a MerchantRecipe. -- this.server.getRecipeManager().byKey(CraftNamespacedKey.toMinecraft(((org.bukkit.Keyed) event.getRecipe()).getKey())).ifPresent((recipeholder) -> { -- ((RecipeBookMenu) this.player.containerMenu).handlePlacement(event.isShiftClick(), recipeholder, this.player); -+ // Paper start - Add PlayerRecipeBookClickEvent -+ final boolean finalMakeAll = makeAll; -+ this.server.getRecipeManager().byKey(recipeName).ifPresent((recipeholder) -> { -+ recipeBookMenu.handlePlacement(finalMakeAll, recipeholder, this.player); -+ // Paper end - Add PlayerRecipeBookClickEvent - }); - // CraftBukkit end - } diff --git a/patches/unapplied/server/0397-Do-not-let-the-server-load-chunks-from-newer-version.patch b/patches/unapplied/server/0397-Do-not-let-the-server-load-chunks-from-newer-version.patch deleted file mode 100644 index 9ada63fcdf..0000000000 --- a/patches/unapplied/server/0397-Do-not-let-the-server-load-chunks-from-newer-version.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 -From: Zach Brown -Date: Tue, 23 Jul 2019 20:44:47 -0500 -Subject: [PATCH] Do not let the server load chunks from newer versions - -If the server attempts to load a chunk generated by a newer version of -the game, immediately stop the server to prevent data corruption. - -You can override this functionality at your own peril. - -diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -index 0dd6f1bce4913cb84ba21a20df5573bab3a64645..5e1a68e3a920aab10a459b9b54f6abd59e7855e0 100644 ---- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkSerializer.java -@@ -86,6 +86,10 @@ public class ChunkSerializer { - public static final String BLOCK_LIGHT_TAG = "BlockLight"; - public static final String SKY_LIGHT_TAG = "SkyLight"; - -+ // Paper start - Do not let the server load chunks from newer versions -+ private static final int CURRENT_DATA_VERSION = net.minecraft.SharedConstants.getCurrentVersion().getDataVersion().getVersion(); -+ private static final boolean JUST_CORRUPT_IT = Boolean.getBoolean("Paper.ignoreWorldDataVersion"); -+ // Paper end - Do not let the server load chunks from newer versions - public ChunkSerializer() {} - - // Paper start - guard against serializing mismatching coordinates -@@ -102,6 +106,15 @@ public class ChunkSerializer { - // Paper end - guard against serializing mismatching coordinates - - public static ProtoChunk read(ServerLevel world, PoiManager poiStorage, RegionStorageInfo key, ChunkPos chunkPos, CompoundTag nbt) { -+ // Paper start - Do not let the server load chunks from newer versions -+ if (nbt.contains("DataVersion", net.minecraft.nbt.Tag.TAG_ANY_NUMERIC)) { -+ final int dataVersion = nbt.getInt("DataVersion"); -+ if (!JUST_CORRUPT_IT && dataVersion > CURRENT_DATA_VERSION) { -+ new RuntimeException("Server attempted to load chunk saved with newer version of minecraft! " + dataVersion + " > " + CURRENT_DATA_VERSION).printStackTrace(); -+ System.exit(1); -+ } -+ } -+ // Paper end - Do not let the server load chunks from newer versions - ChunkPos chunkcoordintpair1 = new ChunkPos(nbt.getInt("xPos"), nbt.getInt("zPos")); // Paper - guard against serializing mismatching coordinates; diff on change, see ChunkSerializer#getChunkCoordinate - - if (!Objects.equals(chunkPos, chunkcoordintpair1)) {