diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 18dacf9208..fe998c4ea5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -56,7 +56,6 @@ split into different directories which target certain parts of the code. These directories are: - `Paper-API` - Modifications to `Spigot-API`/`Bukkit`; -- `Paper-MojangAPI` - An API for [Mojang's Brigadier](https://github.com/Mojang/brigadier); - `Paper-Server` - Modifications to `Spigot`/`CraftBukkit`. Because the entire structure is based on patches and git, a basic understanding @@ -97,7 +96,9 @@ Your commit will be converted into a patch that you can then PR into Paper. ## Modifying Patches -Modifying previous patches is a bit more complex: +Modifying previous patches is a bit more complex. +Similar to adding patches, the methods to modify a patch are applied inside +the `Paper-Server` and/or `Paper-API` folders. ### Method 1 diff --git a/LICENSE.md b/LICENSE.md index 4cb1460c2e..704c1863a1 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -64,4 +64,5 @@ Oliwier Miodun aerulion Lukas Planz granny +mja00 ``` diff --git a/patches/api/0053-Fix-upstream-javadocs.patch b/patches/api/0053-Fix-upstream-javadocs.patch index 7d51adc5a1..67aa32c200 100644 --- a/patches/api/0053-Fix-upstream-javadocs.patch +++ b/patches/api/0053-Fix-upstream-javadocs.patch @@ -74,6 +74,20 @@ index 0cf808356a1a5c6fc4bcf97a694ed9beb80a776a..dc765dea47a9a1c1520fb16ddb24f814 * @param z Z-coordinate (0-15) * @return temperature at given coordinate */ +diff --git a/src/main/java/org/bukkit/HeightMap.java b/src/main/java/org/bukkit/HeightMap.java +index db6fcd635e295e561642d49941fd8e611247d38e..344b2b5d9207d2645bc5417d1ec00dd0a0b95604 100644 +--- a/src/main/java/org/bukkit/HeightMap.java ++++ b/src/main/java/org/bukkit/HeightMap.java +@@ -12,8 +12,7 @@ public enum HeightMap { + */ + MOTION_BLOCKING, + /** +- * The highest block that blocks motion or contains a fluid or is in the +- * {@link Tag#LEAVES}. ++ * The highest block that blocks motion or contains a fluid, excluding leaves. + */ + MOTION_BLOCKING_NO_LEAVES, + /** diff --git a/src/main/java/org/bukkit/Particle.java b/src/main/java/org/bukkit/Particle.java index 62a8bb18855be13ed1c466b4be7afcd3c91dc7aa..de9fd0fadd6d16ffe883a618bf499214878f443d 100644 --- a/src/main/java/org/bukkit/Particle.java @@ -444,6 +458,19 @@ index b688b3856cb3068a539fcecfbfa113f8ab4160a9..c275b881cbd11307a6dcc7190d7a7d40 * * @return whether the item frame is visible or not */ +diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java +index 32e89741ffd895e31af0104a0126c2f72742a1bb..bc17c86da49faf4b6e07d4fb4c53649da0384d69 100644 +--- a/src/main/java/org/bukkit/entity/LivingEntity.java ++++ b/src/main/java/org/bukkit/entity/LivingEntity.java +@@ -502,7 +502,7 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource + /** + * Sets the leash on this entity to be held by the supplied entity. + *

+- * This method has no effect on EnderDragons, Withers, Players, or Bats. ++ * This method has no effect on players. + * Non-living entities excluding leashes will not persist as leash + * holders. + * diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java index f3f62e13cc1b6172808c52f2d5f520f1f584e6db..ad5dbf310fe7b34c997bb339f09697222f862005 100644 --- a/src/main/java/org/bukkit/entity/Mob.java @@ -1548,21 +1575,6 @@ index 35c6594fd1040a1af1029e7260e5e3a9307b107d..d58719ee75bef8bc265bfc81bc5d88a4 */ void addChargedProjectile(@NotNull ItemStack item); } -diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java -index cdbcc8dbab2456cc2bc1f3084cbb1ced1698b7f5..d528b066c2aaa3fb097931914ff2181f8f64e520 100644 ---- a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java -+++ b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java -@@ -86,8 +86,8 @@ public interface FireworkMeta extends ItemMeta { - * Sets the approximate power of the firework. Each level of power is half - * a second of flight time. - * -- * @param power the power of the firework, from 0-127 -- * @throws IllegalArgumentException if {@literal height<0 or height>127} -+ * @param power the power of the firework, from 0-255 -+ * @throws IllegalArgumentException if {@literal power < 0 or power > 255} - */ - void setPower(int power) throws IllegalArgumentException; - diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java index 014c1a0379e532a5c924694a8e0715eb0ba50ec2..10ca843e57c74dfa32d539acd174c8867dfd56ec 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java diff --git a/patches/api/0073-AsyncTabCompleteEvent.patch b/patches/api/0073-AsyncTabCompleteEvent.patch index 3908b1a718..e29d336e1d 100644 --- a/patches/api/0073-AsyncTabCompleteEvent.patch +++ b/patches/api/0073-AsyncTabCompleteEvent.patch @@ -11,6 +11,8 @@ and avoid going to main for tab completions. Especially useful if you need to query a database in order to obtain the results for tab completion, such as offline players. +Also Enforces mutability of the existing TabCompleteEvent. + Co-authored-by: Aikar diff --git a/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java b/src/main/java/com/destroystokyo/paper/event/server/AsyncTabCompleteEvent.java @@ -534,10 +536,10 @@ index 0000000000000000000000000000000000000000..6f560a51277ccbd46a9142cfa057d276 + } +} diff --git a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java -index 270e6d8ad4358baa256cee5f16cff281f063ce3b..b43c3cb5c88eada186d6f81712c244aaa18fb53e 100644 +index 270e6d8ad4358baa256cee5f16cff281f063ce3b..6465e290c090d82986352d5ab7ba5dc65bd3dc17 100644 --- a/src/main/java/org/bukkit/event/server/TabCompleteEvent.java +++ b/src/main/java/org/bukkit/event/server/TabCompleteEvent.java -@@ -29,6 +29,13 @@ public class TabCompleteEvent extends Event implements Cancellable { +@@ -29,13 +29,20 @@ public class TabCompleteEvent extends Event implements Cancellable { private boolean cancelled; public TabCompleteEvent(@NotNull CommandSender sender, @NotNull String buffer, @NotNull List completions) { @@ -551,6 +553,14 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..b43c3cb5c88eada186d6f81712c244aa Preconditions.checkArgument(sender != null, "sender"); Preconditions.checkArgument(buffer != null, "buffer"); Preconditions.checkArgument(completions != null, "completions"); + + this.sender = sender; + this.buffer = buffer; +- this.completions = completions; ++ this.completions = new java.util.ArrayList<>(completions); // Paper - Completions must be mutable + } + + /** @@ -69,14 +76,35 @@ public class TabCompleteEvent extends Event implements Cancellable { return completions; } @@ -584,7 +594,7 @@ index 270e6d8ad4358baa256cee5f16cff281f063ce3b..b43c3cb5c88eada186d6f81712c244aa public void setCompletions(@NotNull List completions) { Preconditions.checkArgument(completions != null); - this.completions = completions; -+ this.completions = new java.util.ArrayList<>(completions); // Paper ++ this.completions = new java.util.ArrayList<>(completions); // Paper - completions must be mutable } @Override diff --git a/patches/api/0166-Fix-Spigot-annotation-mistakes.patch b/patches/api/0166-Fix-Spigot-annotation-mistakes.patch index e7952ac8d4..a66f2b4a3b 100644 --- a/patches/api/0166-Fix-Spigot-annotation-mistakes.patch +++ b/patches/api/0166-Fix-Spigot-annotation-mistakes.patch @@ -890,7 +890,7 @@ index bafef53c1d449135f1300c8c8fbb06f482ba67e1..f50aaddf8582be55fd4860ad374d8f22 +@Deprecated(forRemoval = true) // Paper public interface LingeringPotion extends ThrownPotion { } diff --git a/src/main/java/org/bukkit/entity/LivingEntity.java b/src/main/java/org/bukkit/entity/LivingEntity.java -index b5ea7b60b47f056553a1cec766c57e0f75735633..ec35111df4b38fd55cc34f4baedebcf39c7fc92b 100644 +index 3f1b74af137868e502792c65ccd7ca74f3c3cb8c..c89ffb0f98dccd015e80e299142252fed3ece4a8 100644 --- a/src/main/java/org/bukkit/entity/LivingEntity.java +++ b/src/main/java/org/bukkit/entity/LivingEntity.java @@ -716,7 +716,9 @@ public interface LivingEntity extends Attributable, Damageable, ProjectileSource @@ -1509,7 +1509,7 @@ index f1a48eab1a357ae64545e1f1dc941c383cff8707..466d1bd7089b76f48f953e1a51c611ec /** * Checks if the inventory contains any ItemStacks with the given diff --git a/src/main/java/org/bukkit/inventory/InventoryView.java b/src/main/java/org/bukkit/inventory/InventoryView.java -index ebc14022c9ef9b0b3331ee53e96a32667e4762e0..2b2c5faabce1628bd2e82a840dc97fe79bb57856 100644 +index ebc14022c9ef9b0b3331ee53e96a32667e4762e0..5c258b6077277575daa5d96349837bdf06f42500 100644 --- a/src/main/java/org/bukkit/inventory/InventoryView.java +++ b/src/main/java/org/bukkit/inventory/InventoryView.java @@ -123,9 +123,9 @@ public interface InventoryView { @@ -1538,6 +1538,27 @@ index ebc14022c9ef9b0b3331ee53e96a32667e4762e0..2b2c5faabce1628bd2e82a840dc97fe7 public ItemStack getCursor(); /** +@@ -296,8 +296,10 @@ public interface InventoryView { + * made using {@link #setTitle(String)}. + * + * @return the original title ++ * @deprecated changing the title is not supported + */ + @NotNull ++ @Deprecated(since = "1.21.1") // Paper + public String getOriginalTitle(); + + /** +@@ -309,6 +311,9 @@ public interface InventoryView { + * exception. + * + * @param title The new title. ++ * @deprecated changing the title is not supported. This method has ++ * poorly defined and broken behaviors. It should not be used. + */ ++ @Deprecated(since = "1.21.1") // Paper + public void setTitle(@NotNull String title); + } diff --git a/src/main/java/org/bukkit/inventory/ItemFactory.java b/src/main/java/org/bukkit/inventory/ItemFactory.java index 3d08beee52f2247db6f6e679206ed6a965fbf9a8..1b4f9b93860e58762ac28715adad5a67298b06d7 100644 --- a/src/main/java/org/bukkit/inventory/ItemFactory.java diff --git a/patches/api/0253-Expand-world-key-API.patch b/patches/api/0253-Expand-world-key-API.patch index 038c40f924..2436c924af 100644 --- a/patches/api/0253-Expand-world-key-API.patch +++ b/patches/api/0253-Expand-world-key-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expand world key API diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index fbe14c327ee9c1ac07893853ca7c699e81225281..a2ced20efd2c6be2fe63d80f444c8cb608c37eef 100644 +index fbe14c327ee9c1ac07893853ca7c699e81225281..b558fa73dbcf3747690933e6aadf7061a0de2630 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -865,6 +865,18 @@ public final class Bukkit { +@@ -865,6 +865,29 @@ public final class Bukkit { public static World getWorld(@NotNull UUID uid) { return server.getWorld(uid); } @@ -23,6 +23,17 @@ index fbe14c327ee9c1ac07893853ca7c699e81225281..a2ced20efd2c6be2fe63d80f444c8cb6 + public static World getWorld(@NotNull NamespacedKey worldKey) { + return server.getWorld(worldKey); + } ++ ++ /** ++ * Gets the world from the given Key ++ * ++ * @param worldKey the Key of the world to retrieve ++ * @return a world with the given Key, or null if none exists ++ */ ++ @Nullable ++ public static World getWorld(@NotNull net.kyori.adventure.key.Key worldKey) { ++ return server.getWorld(worldKey); ++ } + // Paper end /** @@ -56,10 +67,10 @@ index 27eff0826d5b5b48697fefd9571886e7bbce74b1..d8b1fa79dc24138dc71e32c14bda71c1 // Paper end } diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..8b52e9a41ea9ba38117d42224811ff28663ef980 100644 +index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..42930006b6425b5d82233e4ffe7025ce5397b277 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -726,6 +726,17 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -726,6 +726,28 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @Nullable public World getWorld(@NotNull UUID uid); @@ -71,7 +82,18 @@ index 943f8881ea23481ea5d5125b6ec7c9c6f763f0b0..8b52e9a41ea9ba38117d42224811ff28 + * @return a world with the given NamespacedKey, or null if none exists + */ + @Nullable -+ public World getWorld(@NotNull NamespacedKey worldKey); ++ default World getWorld(@NotNull NamespacedKey worldKey) { ++ return getWorld((net.kyori.adventure.key.Key) worldKey); ++ } ++ ++ /** ++ * Gets the world from the given Key ++ * ++ * @param worldKey the Key of the world to retrieve ++ * @return a world with the given Key, or null if none exists ++ */ ++ @Nullable ++ World getWorld(@NotNull net.kyori.adventure.key.Key worldKey); + // Paper end + /** diff --git a/patches/api/0270-Add-basic-Datapack-API.patch b/patches/api/0270-Add-basic-Datapack-API.patch index cc389bcd57..2250ed92f6 100644 --- a/patches/api/0270-Add-basic-Datapack-API.patch +++ b/patches/api/0270-Add-basic-Datapack-API.patch @@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7 + +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index a2ced20efd2c6be2fe63d80f444c8cb608c37eef..a6e87d06e439bfa85512891da300e2de60b0af95 100644 +index b558fa73dbcf3747690933e6aadf7061a0de2630..8a22c242a93b0e16e0bca583d0918bab695248b1 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -328,9 +328,11 @@ public final class Bukkit { @@ -85,7 +85,7 @@ index a2ced20efd2c6be2fe63d80f444c8cb608c37eef..a6e87d06e439bfa85512891da300e2de public static DataPackManager getDataPackManager() { return server.getDataPackManager(); } -@@ -2606,6 +2608,14 @@ public final class Bukkit { +@@ -2617,6 +2619,14 @@ public final class Bukkit { public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { return server.getMobGoals(); } @@ -101,7 +101,7 @@ index a2ced20efd2c6be2fe63d80f444c8cb608c37eef..a6e87d06e439bfa85512891da300e2de @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 8b52e9a41ea9ba38117d42224811ff28663ef980..c3f32db8ccd31e3ee8a544dc165540c0fa8bcc35 100644 +index 42930006b6425b5d82233e4ffe7025ce5397b277..67b5cb7635c4251c259b1fb1ef50f99a0b2647e5 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java @@ -267,9 +267,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -116,7 +116,7 @@ index 8b52e9a41ea9ba38117d42224811ff28663ef980..c3f32db8ccd31e3ee8a544dc165540c0 public DataPackManager getDataPackManager(); /** -@@ -2273,5 +2275,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2284,5 +2286,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); diff --git a/patches/api/0273-More-Enchantment-API.patch b/patches/api/0273-More-Enchantment-API.patch index 14f5473ccb..1119346aaa 100644 --- a/patches/api/0273-More-Enchantment-API.patch +++ b/patches/api/0273-More-Enchantment-API.patch @@ -41,7 +41,7 @@ index 0000000000000000000000000000000000000000..aec3b41d7c3388e26fa203e3c062f1e6 + } +} diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java -index daae9bb234d2e10530b2bed35fada98652514e0e..fc30fbffd83285d4ec102a18454ed95289329667 100644 +index daae9bb234d2e10530b2bed35fada98652514e0e..53dbb852d6a34f0814b81852c7f10f55c38299e7 100644 --- a/src/main/java/org/bukkit/enchantments/Enchantment.java +++ b/src/main/java/org/bukkit/enchantments/Enchantment.java @@ -290,11 +290,7 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve @@ -56,11 +56,11 @@ index daae9bb234d2e10530b2bed35fada98652514e0e..fc30fbffd83285d4ec102a18454ed952 public abstract boolean isCursed(); /** -@@ -328,6 +324,116 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve - * @return the name of the enchantment with {@code level} applied - */ +@@ -330,6 +326,118 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve public abstract net.kyori.adventure.text.@NotNull Component displayName(int level); -+ + // Paper end + ++ // Paper start - more Enchantment API + /** + * Checks if this enchantment can be found in villager trades. + * @@ -129,7 +129,7 @@ index daae9bb234d2e10530b2bed35fada98652514e0e..fc30fbffd83285d4ec102a18454ed952 + * @return the damage increase + * @deprecated Enchantments now have a complex effect systems that cannot be reduced to a simple damage increase. + */ -+ @Contract("-> fail") ++ @Contract("_, _ -> fail") + @Deprecated(forRemoval = true, since = "1.20.5") + public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityCategory entityCategory); + @@ -141,7 +141,7 @@ index daae9bb234d2e10530b2bed35fada98652514e0e..fc30fbffd83285d4ec102a18454ed952 + * @return the damage increase + * @deprecated Enchantments now have a complex effect systems that cannot be reduced to a simple damage increase. + */ -+ @Contract("-> fail") ++ @Contract("_, _ -> fail") + @Deprecated(forRemoval = true, since = "1.21") + public abstract float getDamageIncrease(int level, @NotNull org.bukkit.entity.EntityType entityType); + @@ -170,9 +170,11 @@ index daae9bb234d2e10530b2bed35fada98652514e0e..fc30fbffd83285d4ec102a18454ed952 + */ + @NotNull + public abstract java.util.Set getActiveSlotGroups(); - // Paper end - ++ // Paper end - more Enchantment API ++ // Paper start - mark translation key as deprecated + /** + * @deprecated this method assumes that the enchantments description diff --git a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java b/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java index ac0371285370594d4de1554871b19bbcd2311730..da5d153a3e55a38b767359564001ad8663f9730b 100644 --- a/src/main/java/org/bukkit/enchantments/EnchantmentWrapper.java diff --git a/patches/api/0330-API-for-creating-command-sender-which-forwards-feedb.patch b/patches/api/0330-API-for-creating-command-sender-which-forwards-feedb.patch index d350bacfde..38c276ea9d 100644 --- a/patches/api/0330-API-for-creating-command-sender-which-forwards-feedb.patch +++ b/patches/api/0330-API-for-creating-command-sender-which-forwards-feedb.patch @@ -5,10 +5,10 @@ Subject: [PATCH] API for creating command sender which forwards feedback diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index a6e87d06e439bfa85512891da300e2de60b0af95..65e02f66fd275045bd1889b460cc6c0613e19755 100644 +index 8a22c242a93b0e16e0bca583d0918bab695248b1..aa1795b9640a5e39cc5063dd3c389f6d5815ed36 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1584,6 +1584,20 @@ public final class Bukkit { +@@ -1595,6 +1595,20 @@ public final class Bukkit { return server.getConsoleSender(); } @@ -30,10 +30,10 @@ index a6e87d06e439bfa85512891da300e2de60b0af95..65e02f66fd275045bd1889b460cc6c06 * Gets the folder that contains all of the various {@link World}s. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index c3f32db8ccd31e3ee8a544dc165540c0fa8bcc35..04b7225486ee61ee66bc8423e46e620c6da9e41d 100644 +index 67b5cb7635c4251c259b1fb1ef50f99a0b2647e5..65060c06c1e5521656bd88547b8d0df5975c1d29 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1338,6 +1338,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1349,6 +1349,18 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @NotNull public ConsoleCommandSender getConsoleSender(); diff --git a/patches/api/0336-Custom-Potion-Mixes.patch b/patches/api/0336-Custom-Potion-Mixes.patch index bafd89bf1f..ae965ae441 100644 --- a/patches/api/0336-Custom-Potion-Mixes.patch +++ b/patches/api/0336-Custom-Potion-Mixes.patch @@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..3ede1e8f7bf0436fdc5bf395c0f9eaf1 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 65e02f66fd275045bd1889b460cc6c0613e19755..702e622a2ef2c3dcb0e582e38b3b10f9c939ed97 100644 +index aa1795b9640a5e39cc5063dd3c389f6d5815ed36..30cb0f2c4d53a7ad473812810c4f50173b7d7391 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2630,6 +2630,15 @@ public final class Bukkit { +@@ -2641,6 +2641,15 @@ public final class Bukkit { public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { return server.getDatapackManager(); } @@ -175,10 +175,10 @@ index 65e02f66fd275045bd1889b460cc6c0613e19755..702e622a2ef2c3dcb0e582e38b3b10f9 @NotNull diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 04b7225486ee61ee66bc8423e46e620c6da9e41d..28e883ffb5c4db22613035899be4a627c230fbf4 100644 +index 65060c06c1e5521656bd88547b8d0df5975c1d29..7c33c9489e0f3c4429e9bc30d87a3f4c29ca010f 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2293,5 +2293,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2304,5 +2304,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull io.papermc.paper.datapack.DatapackManager getDatapackManager(); diff --git a/patches/api/0382-Add-BlockLockCheckEvent.patch b/patches/api/0382-Add-BlockLockCheckEvent.patch index c5d560192c..5ba41f5acf 100644 --- a/patches/api/0382-Add-BlockLockCheckEvent.patch +++ b/patches/api/0382-Add-BlockLockCheckEvent.patch @@ -23,10 +23,10 @@ index 0000000000000000000000000000000000000000..f309961e0e96b6baacc4fe6d80dabd6c +} diff --git a/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java new file mode 100644 -index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0974c0572 +index 0000000000000000000000000000000000000000..5e2c8ad26dea2c8a84ae10f7da8cb836e78d7b68 --- /dev/null +++ b/src/main/java/io/papermc/paper/event/block/BlockLockCheckEvent.java -@@ -0,0 +1,186 @@ +@@ -0,0 +1,187 @@ +package io.papermc.paper.event.block; + +import com.google.common.base.Preconditions; @@ -34,6 +34,7 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0 +import net.kyori.adventure.sound.Sound; +import net.kyori.adventure.text.Component; +import org.bukkit.block.Block; ++import org.bukkit.block.BlockState; +import org.bukkit.entity.Player; +import org.bukkit.event.HandlerList; +import org.bukkit.event.block.BlockEvent; @@ -53,7 +54,6 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0 + + private static final HandlerList HANDLER_LIST = new HandlerList(); + -+ private final LockableTileState state; + private final Player player; + private Component lockedMessage; + private Sound lockedSound; @@ -61,9 +61,8 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0 + private Result result = Result.DEFAULT; + + @ApiStatus.Internal -+ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull LockableTileState state, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) { ++ public BlockLockCheckEvent(final @NotNull Block block, final @NotNull Player player, final @NotNull Component lockedMessage, final @NotNull Sound lockedSound) { + super(block); -+ this.state = state; + this.player = player; + this.lockedMessage = lockedMessage; + this.lockedSound = lockedSound; @@ -76,7 +75,9 @@ index 0000000000000000000000000000000000000000..4c335212f6a5ad4a304c3c0f66ffd7e0 + * @return the snapshot block state. + */ + public @NotNull LockableTileState getBlockState() { -+ return this.state; ++ final BlockState blockState = this.getBlock().getState(); ++ Preconditions.checkState(blockState instanceof LockableTileState, "Block state of lock-checked block is no longer a lockable tile state!"); ++ return (LockableTileState) blockState; + } + + /** diff --git a/patches/api/0397-Folia-scheduler-and-owned-region-API.patch b/patches/api/0397-Folia-scheduler-and-owned-region-API.patch index 926b2aaea7..a9911d3665 100644 --- a/patches/api/0397-Folia-scheduler-and-owned-region-API.patch +++ b/patches/api/0397-Folia-scheduler-and-owned-region-API.patch @@ -499,10 +499,10 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045 + } +} diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 3a8be5316229f372b471549a00eae958543ac91d..51eaeb14c87e317c37fb6d4082d82542b4b925ee 100644 +index 556e8c6cf90af9c90ded18be013167fa440d6505..9265ee60edfb3df797e425e854c7d3c9c034a85c 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -2661,6 +2661,141 @@ public final class Bukkit { +@@ -2672,6 +2672,141 @@ public final class Bukkit { } // Paper end @@ -645,10 +645,10 @@ index 3a8be5316229f372b471549a00eae958543ac91d..51eaeb14c87e317c37fb6d4082d82542 public static Server.Spigot spigot() { return server.spigot(); diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 547ba309beb6a4d1fdfadb234d671c1475abaae5..9354a0bb002ddfaf8df90a963ae5be577efb8aee 100644 +index a859d7bc870e5ef16793c2da453c84685b78ee47..968a5e18a023c92158a753f6d8fce4b2d0f0de48 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -2322,4 +2322,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -2333,4 +2333,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); // Paper end diff --git a/patches/api/0399-Add-Sign-getInteractableSideFor.patch b/patches/api/0399-More-Sign-Block-API.patch similarity index 50% rename from patches/api/0399-Add-Sign-getInteractableSideFor.patch rename to patches/api/0399-More-Sign-Block-API.patch index 1e085323ca..57b372521c 100644 --- a/patches/api/0399-Add-Sign-getInteractableSideFor.patch +++ b/patches/api/0399-More-Sign-Block-API.patch @@ -1,18 +1,43 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 23 Jun 2023 12:16:35 -0700 -Subject: [PATCH] Add Sign#getInteractableSideFor +Subject: [PATCH] More Sign Block API +Co-authored-by: SoSeDiK diff --git a/src/main/java/org/bukkit/block/Sign.java b/src/main/java/org/bukkit/block/Sign.java -index 1fdb1144949adc3a2b5cbc3aca94d2f8e0c6d9ee..7983ccb54f5f358dea1ffb530b9cc5bd716fb9b1 100644 +index 1fdb1144949adc3a2b5cbc3aca94d2f8e0c6d9ee..340e3adcc57227f2e570826681ea81b9159805de 100644 --- a/src/main/java/org/bukkit/block/Sign.java +++ b/src/main/java/org/bukkit/block/Sign.java -@@ -187,4 +187,34 @@ public interface Sign extends TileState, Colorable { +@@ -182,9 +182,58 @@ public interface Sign extends TileState, Colorable { + /** + * Gets the player that is currently allowed to edit this sign.
+ * Edits from other players will be rejected if this value is not null. ++ *

You should prefer {@link #getAllowedEditorUniqueId()} if you don't ++ * need the player instance as this method will fetch the player from UUID. + * + * @return the player allowed to edit this sign, or null */ @Nullable public Player getAllowedEditor(); -+ // Paper start - get side for player ++ // Paper start - More Sign Block API ++ /** ++ * Gets the allowed editor's UUID. ++ *
Edits from other players will be rejected if this value is not null. ++ * ++ * @return the allowed editor's UUID, or null ++ */ ++ @Nullable java.util.UUID getAllowedEditorUniqueId(); ++ ++ /** ++ * Sets the allowed editor's UUID. ++ *

Note: the server sets the UUID back to null if the player can't ++ * interact with the sign (is either offline or outside the allowed interaction range). ++ * ++ * @param uuid the allowed editor's UUID ++ */ ++ void setAllowedEditorUniqueId(@Nullable java.util.UUID uuid); ++ + /** + * Compute the side facing the specified entity. + * @@ -41,5 +66,5 @@ index 1fdb1144949adc3a2b5cbc3aca94d2f8e0c6d9ee..7983ccb54f5f358dea1ffb530b9cc5bd + * @return the side the coordinates are facing + */ + @NotNull Side getInteractableSideFor(double x, double z); -+ // Paper end ++ // Paper end - More Sign Block API } diff --git a/patches/api/0402-API-for-updating-recipes-on-clients.patch b/patches/api/0402-API-for-updating-recipes-on-clients.patch index f9ef1b00a0..11b14673fa 100644 --- a/patches/api/0402-API-for-updating-recipes-on-clients.patch +++ b/patches/api/0402-API-for-updating-recipes-on-clients.patch @@ -5,10 +5,10 @@ Subject: [PATCH] API for updating recipes on clients diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988ccca25fb4d 100644 +index 9265ee60edfb3df797e425e854c7d3c9c034a85c..f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -993,6 +993,26 @@ public final class Bukkit { +@@ -1004,6 +1004,26 @@ public final class Bukkit { server.reloadData(); } @@ -35,7 +35,7 @@ index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988cc /** * Returns the primary logger associated with this server instance. * -@@ -1053,6 +1073,20 @@ public final class Bukkit { +@@ -1064,6 +1084,20 @@ public final class Bukkit { return server.addRecipe(recipe); } @@ -56,7 +56,7 @@ index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988cc /** * Get a list of all recipes for a given item. The stack size is ignored * in comparisons. If the durability is -1, it will match any data value. -@@ -1244,6 +1278,24 @@ public final class Bukkit { +@@ -1255,6 +1289,24 @@ public final class Bukkit { return server.removeRecipe(key); } @@ -82,10 +82,10 @@ index 51eaeb14c87e317c37fb6d4082d82542b4b925ee..c9046e30ae9ffe90a1835316e87988cc * Gets a list of command aliases defined in the server properties. * diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 9354a0bb002ddfaf8df90a963ae5be577efb8aee..e07fa603227dd936146d1bb810559df527aee0c1 100644 +index 968a5e18a023c92158a753f6d8fce4b2d0f0de48..b93359e86db14e3a680bcdd8d935e2692c8b64e0 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -842,6 +842,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -853,6 +853,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ public void reloadData(); @@ -108,7 +108,7 @@ index 9354a0bb002ddfaf8df90a963ae5be577efb8aee..e07fa603227dd936146d1bb810559df5 /** * Returns the primary logger associated with this server instance. * -@@ -883,15 +899,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -894,15 +910,34 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi public boolean dispatchCommand(@NotNull CommandSender sender, @NotNull String commandLine) throws CommandException; /** @@ -144,7 +144,7 @@ index 9354a0bb002ddfaf8df90a963ae5be577efb8aee..e07fa603227dd936146d1bb810559df5 /** * Get a list of all recipes for a given item. The stack size is ignored * in comparisons. If the durability is -1, it will match any data value. -@@ -1060,6 +1095,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1071,6 +1106,22 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ public boolean removeRecipe(@NotNull NamespacedKey key); diff --git a/patches/api/0407-Deprecate-and-replace-methods-with-old-StructureType.patch b/patches/api/0407-Deprecate-and-replace-methods-with-old-StructureType.patch index a46b2f6103..72be0347a9 100644 --- a/patches/api/0407-Deprecate-and-replace-methods-with-old-StructureType.patch +++ b/patches/api/0407-Deprecate-and-replace-methods-with-old-StructureType.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate and replace methods with old StructureType diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b6eb3fc2d 100644 +index f2753ef7d53ff3ff3531eaea89e816d7d8ce8b15..7e70b9b34b170b1c00dd920fabc0e14ed4a14955 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -938,9 +938,6 @@ public final class Bukkit { +@@ -949,9 +949,6 @@ public final class Bukkit { /** * Create a new explorer map targeting the closest nearby structure of a * given {@link StructureType}. @@ -18,7 +18,7 @@ index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b * * @param world the world the map will belong to * @param location the origin location to find the nearest structure -@@ -949,7 +946,9 @@ public final class Bukkit { +@@ -960,7 +957,9 @@ public final class Bukkit { * * @see World#locateNearestStructure(org.bukkit.Location, * org.bukkit.StructureType, int, boolean) @@ -28,7 +28,7 @@ index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b @NotNull public static ItemStack createExplorerMap(@NotNull World world, @NotNull Location location, @NotNull StructureType structureType) { return server.createExplorerMap(world, location, structureType); -@@ -972,11 +971,54 @@ public final class Bukkit { +@@ -983,11 +982,54 @@ public final class Bukkit { * * @see World#locateNearestStructure(org.bukkit.Location, * org.bukkit.StructureType, int, boolean) @@ -84,10 +84,10 @@ index c9046e30ae9ffe90a1835316e87988ccca25fb4d..fffd4b72672d2e3f82c6a018dfc7e95b /** * Reloads the server, refreshing settings and plugin information. diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index e07fa603227dd936146d1bb810559df527aee0c1..6d36734580eb411b00757a1cf63a4e05acbae6b2 100644 +index b93359e86db14e3a680bcdd8d935e2692c8b64e0..f2be9647e015761ef7f56331be932a39cb6a5e8b 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -806,16 +806,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -817,16 +817,15 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * * @see World#locateNearestStructure(org.bukkit.Location, * org.bukkit.StructureType, int, boolean) @@ -106,7 +106,7 @@ index e07fa603227dd936146d1bb810559df527aee0c1..6d36734580eb411b00757a1cf63a4e05 * * @param world the world the map will belong to * @param location the origin location to find the nearest structure -@@ -827,9 +826,50 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -838,9 +837,50 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * * @see World#locateNearestStructure(org.bukkit.Location, * org.bukkit.StructureType, int, boolean) diff --git a/patches/api/0432-Improve-Registry.patch b/patches/api/0432-Improve-Registry.patch index 5e72c2ab2a..1ae2f1b345 100644 --- a/patches/api/0432-Improve-Registry.patch +++ b/patches/api/0432-Improve-Registry.patch @@ -9,8 +9,26 @@ items need to exist without having a key and so getKey() methods on Keyed objects that have a registry are marked as Deprecated or Obsolete. +diff --git a/src/main/java/org/bukkit/Art.java b/src/main/java/org/bukkit/Art.java +index 042d1d932a33022e4fc873652f70dc6ed342d46a..dbbd997d4693f1d9f551bae2ed1d7906c9f39c12 100644 +--- a/src/main/java/org/bukkit/Art.java ++++ b/src/main/java/org/bukkit/Art.java +@@ -103,6 +103,13 @@ public enum Art implements Keyed { + return id; + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#ART}. Painting variants ++ * can exist without a key. ++ */ ++ @Deprecated(since = "1.21") ++ // Paper end - deprecate getKey + @NotNull + @Override + public NamespacedKey getKey() { diff --git a/src/main/java/org/bukkit/MusicInstrument.java b/src/main/java/org/bukkit/MusicInstrument.java -index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf305960e1 100644 +index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..98fdfc8978fea1937e31a7427433a1927d42ec7d 100644 --- a/src/main/java/org/bukkit/MusicInstrument.java +++ b/src/main/java/org/bukkit/MusicInstrument.java @@ -53,6 +53,16 @@ public abstract class MusicInstrument implements Keyed, net.kyori.adventure.tran @@ -22,7 +40,7 @@ index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf + * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#INSTRUMENT}. MusicInstruments + * can exist without a key. + */ -+ @Deprecated ++ @Deprecated(forRemoval = true, since = "1.20.5") + @Override + public abstract @NotNull NamespacedKey getKey(); + // Paper end - deprecate getKey @@ -31,7 +49,7 @@ index 62d2b3f950860dee0898d77b0a29635c3f9a7e23..704dba92f9246ef398ed8d162ebee3cf @Override public @NotNull String translationKey() { diff --git a/src/main/java/org/bukkit/Registry.java b/src/main/java/org/bukkit/Registry.java -index 0ee9a8728035217bb95c7fba917b45a5ef2ea533..cd1e38debbec745dd13cd895327f544dcf42594d 100644 +index 1df2b8fcf90333d5981f16d9dddddd48289f94e4..5d21459e9128c515508a2b4b2265d9824e10d9d5 100644 --- a/src/main/java/org/bukkit/Registry.java +++ b/src/main/java/org/bukkit/Registry.java @@ -359,6 +359,79 @@ public interface Registry extends Iterable { @@ -127,8 +145,26 @@ index 0ee9a8728035217bb95c7fba917b45a5ef2ea533..cd1e38debbec745dd13cd895327f544d + // Paper end - improve Registry } } +diff --git a/src/main/java/org/bukkit/Sound.java b/src/main/java/org/bukkit/Sound.java +index 8c7b50906fc5b84c5570408f357410810bbfbded..7a35120c82b88774de777d3c3176ef553a8e9244 100644 +--- a/src/main/java/org/bukkit/Sound.java ++++ b/src/main/java/org/bukkit/Sound.java +@@ -1636,6 +1636,13 @@ public enum Sound implements Keyed, net.kyori.adventure.sound.Sound.Type { // Pa + this.key = NamespacedKey.minecraft(key); + } + ++ // Paper start - deprecate getKey ++ /** ++ * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#SOUNDS}. Sounds ++ * can exist without a key. ++ */ ++ @Deprecated(since = "1.20.5") ++ // Paper end - deprecate getKey + @NotNull + @Override + public NamespacedKey getKey() { diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java -index 9e90572745909538e942b7fbe788b5286c6cc9a3..100f93358e0a1fa8507775a2afd29314ff353a87 100644 +index 9e90572745909538e942b7fbe788b5286c6cc9a3..e2afb2582a27b94a922754115dbb6b4ca35e0154 100644 --- a/src/main/java/org/bukkit/block/banner/PatternType.java +++ b/src/main/java/org/bukkit/block/banner/PatternType.java @@ -56,6 +56,13 @@ public interface PatternType extends OldEnum, Keyed { @@ -140,7 +176,7 @@ index 9e90572745909538e942b7fbe788b5286c6cc9a3..100f93358e0a1fa8507775a2afd29314 + * @deprecated use {@link Registry#getKey(Keyed)} and {@link Registry#BANNER_PATTERN}. PatternTypes + * can exist without a key. + */ -+ @Deprecated ++ @Deprecated(since = "1.20.5") + // Paper end - deprecate getKey @Override @NotNull diff --git a/patches/api/0448-improve-BanList-types.patch b/patches/api/0448-improve-BanList-types.patch index 0884753c86..56f652975a 100644 --- a/patches/api/0448-improve-BanList-types.patch +++ b/patches/api/0448-improve-BanList-types.patch @@ -68,10 +68,10 @@ index a77c0411a68a9bad33ddfb335b7a996a843e478c..739d9d3ec789e58c10c8d818a9ca59ce /** * Banned player names diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java -index fffd4b72672d2e3f82c6a018dfc7e95b6eb3fc2d..4705c1d91e39fcc3c608b1f1a38a30d063ccf06e 100644 +index 7e70b9b34b170b1c00dd920fabc0e14ed4a14955..419c056faf0d49d9b0435feb01252e87e227b9a9 100644 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java -@@ -1652,11 +1652,27 @@ public final class Bukkit { +@@ -1663,11 +1663,27 @@ public final class Bukkit { * @param The ban target * * @return a ban list of the specified type @@ -100,10 +100,10 @@ index fffd4b72672d2e3f82c6a018dfc7e95b6eb3fc2d..4705c1d91e39fcc3c608b1f1a38a30d0 /** * Gets a set containing all player operators. diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java -index 6d36734580eb411b00757a1cf63a4e05acbae6b2..c043d239c449bf4bb13a24467f2f6c67b4d28d2d 100644 +index f2be9647e015761ef7f56331be932a39cb6a5e8b..5aa64ea39ebd92e5067c53cea49a8685c0b9eee4 100644 --- a/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java -@@ -1414,10 +1414,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi +@@ -1425,10 +1425,25 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi * @param The ban target * * @return a ban list of the specified type diff --git a/patches/api/0469-Fix-issues-with-recipe-API.patch b/patches/api/0469-Fix-issues-with-recipe-API.patch index 00a981bf9c..e20b55ebab 100644 --- a/patches/api/0469-Fix-issues-with-recipe-API.patch +++ b/patches/api/0469-Fix-issues-with-recipe-API.patch @@ -13,6 +13,9 @@ recipes and ingredient slots. Also fixes some issues regarding mutability of both ItemStack and implementations of RecipeChoice. +Also adds some validation regarding Materials passed to RecipeChoice +being items. + diff --git a/src/main/java/org/bukkit/inventory/CookingRecipe.java b/src/main/java/org/bukkit/inventory/CookingRecipe.java index f7fa79393aef40027446b78bac8e9490cfafd8bc..07906ca1a9b39fcc6774870daa498402f7f37917 100644 --- a/src/main/java/org/bukkit/inventory/CookingRecipe.java @@ -126,7 +129,7 @@ index 39f9766a03d420340d79841197f75c8b1dd49f4a..4e59f5176fd6cf92457ad750081c253a } } diff --git a/src/main/java/org/bukkit/inventory/RecipeChoice.java b/src/main/java/org/bukkit/inventory/RecipeChoice.java -index 91bfeffcdbe47208c7d0ddbe013cd0f11fddfa32..e7796054f3f65f5bea7f93c75320195f6c2f0561 100644 +index 91bfeffcdbe47208c7d0ddbe013cd0f11fddfa32..f1aa67997f904953742e8895e49341c2f73d44a2 100644 --- a/src/main/java/org/bukkit/inventory/RecipeChoice.java +++ b/src/main/java/org/bukkit/inventory/RecipeChoice.java @@ -22,6 +22,19 @@ import org.jetbrains.annotations.NotNull; @@ -163,6 +166,24 @@ index 91bfeffcdbe47208c7d0ddbe013cd0f11fddfa32..e7796054f3f65f5bea7f93c75320195f /** * Represents a choice of multiple matching Materials. */ +@@ -60,8 +80,7 @@ public interface RecipeChoice extends Predicate, Cloneable { + * @param choices the tag + */ + public MaterialChoice(@NotNull Tag choices) { +- Preconditions.checkArgument(choices != null, "choices"); +- this.choices = new ArrayList<>(choices.getValues()); ++ this(new ArrayList<>(java.util.Objects.requireNonNull(choices, "Cannot create a material choice with null tag").getValues())); // Paper - delegate to list ctor to make sure all checks are called + } + + public MaterialChoice(@NotNull List choices) { +@@ -78,6 +97,7 @@ public interface RecipeChoice extends Predicate, Cloneable { + } + + Preconditions.checkArgument(!choice.isAir(), "Cannot have empty/air choice"); ++ Preconditions.checkArgument(choice.isItem(), "Cannot have non-item choice %s", choice); // Paper - validate material choice input to items + this.choices.add(choice); + } + } @@ -152,6 +172,16 @@ public interface RecipeChoice extends Predicate, Cloneable { public String toString() { return "MaterialChoice{" + "choices=" + choices + '}'; diff --git a/patches/api/0472-General-ItemMeta-fixes.patch b/patches/api/0472-General-ItemMeta-fixes.patch index 3e2a3cfb11..34bd355a54 100644 --- a/patches/api/0472-General-ItemMeta-fixes.patch +++ b/patches/api/0472-General-ItemMeta-fixes.patch @@ -40,6 +40,46 @@ index a6d1dde422de98f178c0c9add99e01203a35e5cb..01ec84248a681180088fb1d7d22b80f8 ItemType.Typed TOTEM_OF_UNDYING = getItemType("totem_of_undying"); ItemType.Typed SHULKER_SHELL = getItemType("shulker_shell"); ItemType.Typed IRON_NUGGET = getItemType("iron_nugget"); +diff --git a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java b/src/main/java/org/bukkit/inventory/meta/CompassMeta.java +index 5040ab6190b41442986d2a734a8e782df0eab2f6..48bac38469ce3c5b2e59ad115375e7e5a2417da7 100644 +--- a/src/main/java/org/bukkit/inventory/meta/CompassMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/CompassMeta.java +@@ -28,7 +28,8 @@ public interface CompassMeta extends ItemMeta { + /** + * Sets the location this lodestone compass will point to. + * +- * @param lodestone new location or null to clear ++ * @param lodestone new location or null to clear the targeted location ++ * @see #clearLodestone() to reset the compass to a normal compass + */ + void setLodestone(@Nullable Location lodestone); + +@@ -49,9 +50,25 @@ public interface CompassMeta extends ItemMeta { + * location. + * + * @param tracked new tracked status ++ * @see #clearLodestone() to reset the compass to a normal compass + */ + void setLodestoneTracked(boolean tracked); + ++ // Paper start - Add more lodestone compass methods ++ /** ++ * Checks if this compass is considered a lodestone compass. ++ * @see #hasLodestone() to check if a position is being tracked ++ * @see #isLodestoneTracked() to check if it verifies the position is a lodestone ++ */ ++ boolean isLodestoneCompass(); ++ ++ /** ++ * Reset this compass to a normal compass, removing any tracked ++ * location. ++ */ ++ void clearLodestone(); ++ // Paper end - Add more lodestone compass methods ++ + @Override + CompassMeta clone(); + } diff --git a/src/main/java/org/bukkit/inventory/meta/Damageable.java b/src/main/java/org/bukkit/inventory/meta/Damageable.java index ff6818b6d9e0207eafdd749928f33aeac3f27191..992f39da07bafe9769effaa7dc6adc018c89329d 100644 --- a/src/main/java/org/bukkit/inventory/meta/Damageable.java @@ -92,6 +132,31 @@ index ff6818b6d9e0207eafdd749928f33aeac3f27191..992f39da07bafe9769effaa7dc6adc01 /** * Checks to see if this item has a maximum amount of damage. * +diff --git a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java +index 9bd15803cd3526da951ed197305a1b9385305927..5833c4c16b08a0f338a5cd7c0011e82eeda222c2 100644 +--- a/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java ++++ b/src/main/java/org/bukkit/inventory/meta/FireworkMeta.java +@@ -75,10 +75,20 @@ public interface FireworkMeta extends ItemMeta { + */ + boolean hasEffects(); + ++ // Paper start - add hasPower ++ /** ++ * Checks if power is defined on this meta. ++ * ++ * @return true if there is a power specified ++ */ ++ boolean hasPower(); ++ // Paper end - add hasPower ++ + /** + * Gets the approximate height the firework will fly. + * + * @return approximate flight height of the firework. ++ * @see #hasPower() + */ + int getPower(); + diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java index 1a4260b00b193b94ce4b1b2954644f4e41baff4c..5d5fcb2720b62e47d47f441032c4de02574b051a 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java diff --git a/patches/api/0484-Add-even-more-Enchantment-API.patch b/patches/api/0484-Add-even-more-Enchantment-API.patch new file mode 100644 index 0000000000..c9813d353e --- /dev/null +++ b/patches/api/0484-Add-even-more-Enchantment-API.patch @@ -0,0 +1,69 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 19 Jul 2024 08:43:01 -0700 +Subject: [PATCH] Add even more Enchantment API + +In a separate patch because it uses RegistryKeySet which +is after the previous "more enchant api" patch. + +diff --git a/src/main/java/org/bukkit/enchantments/Enchantment.java b/src/main/java/org/bukkit/enchantments/Enchantment.java +index 53dbb852d6a34f0814b81852c7f10f55c38299e7..f38321c437b19125d57d25419e3cb564e3928d89 100644 +--- a/src/main/java/org/bukkit/enchantments/Enchantment.java ++++ b/src/main/java/org/bukkit/enchantments/Enchantment.java +@@ -438,6 +438,56 @@ public abstract class Enchantment implements Keyed, Translatable, net.kyori.adve + public abstract java.util.Set getActiveSlotGroups(); + // Paper end - more Enchantment API + ++ // Paper start - even more Enchantment API ++ /** ++ * Provides the description of this enchantment entry as displayed to the client, e.g. "Sharpness" for the sharpness ++ * enchantment. ++ * ++ * @return the description component. ++ */ ++ public abstract net.kyori.adventure.text.@NotNull Component description(); ++ ++ /** ++ * Provides the registry key set referencing the items this enchantment is supported on. ++ * ++ * @return the registry key set. ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public abstract io.papermc.paper.registry.set.@NotNull RegistryKeySet getSupportedItems(); ++ ++ /** ++ * Provides the registry key set referencing the item types this enchantment can be applied to when ++ * enchanting in an enchantment table. ++ *

++ * If this value is {@code null}, {@link #getSupportedItems()} will be sourced instead in the context of an enchantment table. ++ * Additionally, the tag {@link io.papermc.paper.registry.keys.tags.EnchantmentTagKeys#IN_ENCHANTING_TABLE} defines ++ * which enchantments can even show up in an enchantment table. ++ * ++ * @return the registry key set. ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public abstract io.papermc.paper.registry.set.@Nullable RegistryKeySet getPrimaryItems(); ++ ++ /** ++ * Provides the weight of this enchantment used by the weighted random when selecting enchantments. ++ * ++ * @return the weight value. ++ * @see https://minecraft.wiki/w/Enchanting for examplary weights. ++ */ ++ public abstract int getWeight(); ++ ++ /** ++ * Provides the registry key set of enchantments that this enchantment is exclusive with. ++ *

++ * Exclusive enchantments prohibit the application of this enchantment to an item if they are already present on ++ * said item. ++ * ++ * @return a registry set of enchantments exclusive to this one. ++ */ ++ @org.jetbrains.annotations.ApiStatus.Experimental ++ public abstract io.papermc.paper.registry.set.@NotNull RegistryKeySet getExclusiveWith(); ++ // Paper end - even more Enchantment API ++ + // Paper start - mark translation key as deprecated + /** + * @deprecated this method assumes that the enchantments description diff --git a/patches/api/0485-Leashable-API.patch b/patches/api/0485-Leashable-API.patch new file mode 100644 index 0000000000..e5b1a4857d --- /dev/null +++ b/patches/api/0485-Leashable-API.patch @@ -0,0 +1,74 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Sat, 22 Jun 2024 21:11:58 +0200 +Subject: [PATCH] Leashable API + + +diff --git a/src/main/java/io/papermc/paper/entity/Leashable.java b/src/main/java/io/papermc/paper/entity/Leashable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..7402bab20db0ebcac5b2d492ad002ecf9669caad +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/Leashable.java +@@ -0,0 +1,36 @@ ++package io.papermc.paper.entity; ++ ++import org.bukkit.entity.Entity; ++import org.checkerframework.checker.nullness.qual.NonNull; ++import org.checkerframework.checker.nullness.qual.Nullable; ++ ++/** ++ * Represents an entity that can be leashed. ++ */ ++public interface Leashable extends Entity { ++ ++ /** ++ * Returns whether the entity is currently leashed. ++ * ++ * @return whether the entity is leashed ++ */ ++ boolean isLeashed(); ++ ++ /** ++ * Gets the entity that is currently leading this entity. ++ * ++ * @return the entity holding the leash ++ * @throws IllegalStateException if not currently leashed ++ */ ++ @NonNull Entity getLeashHolder() throws IllegalStateException; ++ ++ /** ++ * Sets the leash on this entity to be held by the supplied entity. ++ *

++ * This method has no effect on players. ++ * ++ * @param holder the entity to leash this entity to, or {@code null} to unleash ++ * @return whether the operation was successful ++ */ ++ boolean setLeashHolder(@Nullable Entity holder); ++} +diff --git a/src/main/java/org/bukkit/entity/Boat.java b/src/main/java/org/bukkit/entity/Boat.java +index 2ac685fb1817f3ce06ebe6391cc863712d68367c..d80524fe32672a8b8940d1028abf22026dace8d2 100644 +--- a/src/main/java/org/bukkit/entity/Boat.java ++++ b/src/main/java/org/bukkit/entity/Boat.java +@@ -7,7 +7,7 @@ import org.jetbrains.annotations.NotNull; + /** + * Represents a boat entity. + */ +-public interface Boat extends Vehicle { ++public interface Boat extends Vehicle, io.papermc.paper.entity.Leashable { // Paper - Leashable API + + /** + * Gets the wood type of the boat. +diff --git a/src/main/java/org/bukkit/entity/Mob.java b/src/main/java/org/bukkit/entity/Mob.java +index 256e5645bcfa76e7ede58ae365e69b4a4bed6204..9a10262a952e330f42187d6e4edab5a225bfba62 100644 +--- a/src/main/java/org/bukkit/entity/Mob.java ++++ b/src/main/java/org/bukkit/entity/Mob.java +@@ -8,7 +8,7 @@ import org.jetbrains.annotations.Nullable; + /** + * Represents a Mob. Mobs are living entities with simple AI. + */ +-public interface Mob extends LivingEntity, Lootable { ++public interface Mob extends LivingEntity, Lootable, io.papermc.paper.entity.Leashable { // Paper - Leashable API + + // Paper start + @Override diff --git a/patches/api/0486-Add-enchantment-seed-update-API.patch b/patches/api/0486-Add-enchantment-seed-update-API.patch new file mode 100644 index 0000000000..64bb3259ac --- /dev/null +++ b/patches/api/0486-Add-enchantment-seed-update-API.patch @@ -0,0 +1,26 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: okx-code +Date: Sat, 17 Aug 2024 13:02:56 +0100 +Subject: [PATCH] Add enchantment seed update API + + +diff --git a/src/main/java/org/bukkit/inventory/view/EnchantmentView.java b/src/main/java/org/bukkit/inventory/view/EnchantmentView.java +index e3471d50673f55e0012f73695f845a71cf188d65..3812a540941337c56f3d4e89bb6a4eb8c914b903 100644 +--- a/src/main/java/org/bukkit/inventory/view/EnchantmentView.java ++++ b/src/main/java/org/bukkit/inventory/view/EnchantmentView.java +@@ -17,6 +17,15 @@ public interface EnchantmentView extends InventoryView { + */ + int getEnchantmentSeed(); + ++ // Paper start - add enchantment seed update API ++ /** ++ * Sets the random enchantment seed used in this view. Loses its effect once the view is closed. ++ * ++ * @param seed the random seed to use ++ */ ++ void setEnchantmentSeed(int seed); ++ // Paper end - add enchantment seed update API ++ + /** + * Gets the offers of this EnchantmentView + * diff --git a/patches/server/0005-Paper-config-files.patch b/patches/server/0005-Paper-config-files.patch index 199fcccc04..58b32ceedc 100644 --- a/patches/server/0005-Paper-config-files.patch +++ b/patches/server/0005-Paper-config-files.patch @@ -487,10 +487,10 @@ index 0000000000000000000000000000000000000000..d9502ba028a96f9cc846f9ed428bd806 +} diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..e727414d784debd276dcc42aabf588d6fcbccc91 +index 0000000000000000000000000000000000000000..45ab7ff5497ceccb85944d2e8d354d9c860abf3b --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -0,0 +1,323 @@ +@@ -0,0 +1,324 @@ +package io.papermc.paper.configuration; + +import co.aikar.timings.MinecraftTimings; @@ -513,6 +513,7 @@ index 0000000000000000000000000000000000000000..e727414d784debd276dcc42aabf588d6 +import java.util.List; +import java.util.Map; +import java.util.Objects; ++import java.util.OptionalInt; + +@SuppressWarnings({"CanBeFinal", "FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) +public class GlobalConfiguration extends ConfigurationPart { @@ -723,7 +724,7 @@ index 0000000000000000000000000000000000000000..e727414d784debd276dcc42aabf588d6 + public BookSize bookSize; + + public class BookSize extends ConfigurationPart { -+ public int pageMax = 2560; // TODO this appears to be a duplicate setting with one above ++ public IntOr.Disabled pageMax = new IntOr.Disabled(OptionalInt.of(2560)); // TODO this appears to be a duplicate setting with one above + public double totalMultiplier = 0.98D; // TODO this should probably be merged into the above inner class + } + public boolean resolveSelectorsInBooks = false; @@ -854,10 +855,10 @@ index 0000000000000000000000000000000000000000..69add4a7f1147015806bc9b63a8340d1 +} diff --git a/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java new file mode 100644 -index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe341868f34 +index 0000000000000000000000000000000000000000..1029b6de6f36b08bf634b4056ef5701383f6f258 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/PaperConfigurations.java -@@ -0,0 +1,466 @@ +@@ -0,0 +1,467 @@ +package io.papermc.paper.configuration; + +import com.google.common.base.Suppliers; @@ -885,6 +886,7 @@ index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe3 +import io.papermc.paper.configuration.transformation.world.versioned.V30_RenameFilterNbtFromSpawnEgg; +import io.papermc.paper.configuration.transformation.world.versioned.V31_SpawnLoadedRangeToGameRule; +import io.papermc.paper.configuration.type.BooleanOrDefault; ++import io.papermc.paper.configuration.type.DespawnRange; +import io.papermc.paper.configuration.type.Duration; +import io.papermc.paper.configuration.type.DurationOrDisabled; +import io.papermc.paper.configuration.type.EngineMode; @@ -1029,6 +1031,14 @@ index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe3 + .register(MapSerializer.TYPE, new MapSerializer(false)) + .register(new EnumValueSerializer()) + .register(new ComponentSerializer()) ++ .register(IntOr.Default.SERIALIZER) ++ .register(IntOr.Disabled.SERIALIZER) ++ .register(DoubleOr.Default.SERIALIZER) ++ .register(DoubleOr.Disabled.SERIALIZER) ++ .register(BooleanOrDefault.SERIALIZER) ++ .register(Duration.SERIALIZER) ++ .register(DurationOrDisabled.SERIALIZER) ++ .register(NbtPathSerializer.SERIALIZER) + ); + } + @@ -1052,8 +1062,6 @@ index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe3 + .header(GLOBAL_HEADER) + .serializers(builder -> builder + .register(new PacketClassSerializer()) -+ .register(IntOr.Default.SERIALIZER) -+ .register(DoubleOr.Default.SERIALIZER) + ); + } + @@ -1095,15 +1103,9 @@ index 0000000000000000000000000000000000000000..783eac6e458c6f1a0584301fb84a2fe3 + .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2IntOpenHashMap::new, Integer.TYPE)) + .register(new TypeToken>() {}, new FastutilMapSerializer.SomethingToPrimitive>(Reference2LongOpenHashMap::new, Long.TYPE)) + .register(new TypeToken>() {}, new TableSerializer()) ++ .register(DespawnRange.class, DespawnRange.SERIALIZER) + .register(StringRepresentableSerializer::isValidFor, new StringRepresentableSerializer()) -+ .register(IntOr.Default.SERIALIZER) -+ .register(IntOr.Disabled.SERIALIZER) -+ .register(DoubleOr.Default.SERIALIZER) -+ .register(BooleanOrDefault.SERIALIZER) -+ .register(Duration.SERIALIZER) -+ .register(DurationOrDisabled.SERIALIZER) + .register(EngineMode.SERIALIZER) -+ .register(NbtPathSerializer.SERIALIZER) + .register(FallbackValueSerializer.create(contextMap.require(SPIGOT_WORLD_CONFIG_CONTEXT_KEY).get(), MinecraftServer::getServer)) + .register(new RegistryValueSerializer<>(new TypeToken>() {}, access, Registries.ENTITY_TYPE, true)) + .register(new RegistryValueSerializer<>(Item.class, access, Registries.ITEM, true)) @@ -1414,10 +1416,10 @@ index 0000000000000000000000000000000000000000..990d1bb46e0f9719f4e9af928d80ac6f +} diff --git a/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java new file mode 100644 -index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27a10cb316 +index 0000000000000000000000000000000000000000..aa3624fb8aaaf2720aaef7800f537dd4b906797f --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/WorldConfiguration.java -@@ -0,0 +1,554 @@ +@@ -0,0 +1,573 @@ +package io.papermc.paper.configuration; + +import com.google.common.collect.HashBasedTable; @@ -1429,6 +1431,7 @@ index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27 +import io.papermc.paper.configuration.serializer.NbtPathSerializer; +import io.papermc.paper.configuration.transformation.world.FeatureSeedsGeneration; +import io.papermc.paper.configuration.type.BooleanOrDefault; ++import io.papermc.paper.configuration.type.DespawnRange; +import io.papermc.paper.configuration.type.Duration; +import io.papermc.paper.configuration.type.DurationOrDisabled; +import io.papermc.paper.configuration.type.EngineMode; @@ -1478,6 +1481,7 @@ index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27 +import org.spongepowered.configurate.objectmapping.meta.PostProcess; +import org.spongepowered.configurate.objectmapping.meta.Required; +import org.spongepowered.configurate.objectmapping.meta.Setting; ++import org.spongepowered.configurate.serialize.SerializationException; + +@SuppressWarnings({"FieldCanBeLocal", "FieldMayBeFinal", "NotNullFieldNotInitialized", "InnerClassMayBeStatic"}) +public class WorldConfiguration extends ConfigurationPart { @@ -1603,12 +1607,29 @@ index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27 + @MergeMap + public Reference2IntMap spawnLimits = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); + @MergeMap -+ public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> new DespawnRange(category.getNoDespawnDistance(), category.getDespawnDistance()))); ++ public Map despawnRanges = Arrays.stream(MobCategory.values()).collect(Collectors.toMap(Function.identity(), category -> DespawnRangePair.createDefault())); ++ public DespawnRange.Shape despawnRangeShape = DespawnRange.Shape.ELLIPSOID; + @MergeMap + public Reference2IntMap ticksPerSpawn = Util.make(new Reference2IntOpenHashMap<>(NaturalSpawner.SPAWNING_CATEGORIES.length), map -> Arrays.stream(NaturalSpawner.SPAWNING_CATEGORIES).forEach(mobCategory -> map.put(mobCategory, -1))); + + @ConfigSerializable -+ public record DespawnRange(@Required int soft, @Required int hard) { ++ public record DespawnRangePair(@Required DespawnRange hard, @Required DespawnRange soft) { ++ public static DespawnRangePair createDefault() { ++ return new DespawnRangePair( ++ new DespawnRange(IntOr.Default.USE_DEFAULT), ++ new DespawnRange(IntOr.Default.USE_DEFAULT) ++ ); ++ } ++ } ++ ++ @PostProcess ++ public void precomputeDespawnDistances() throws SerializationException { ++ for (Map.Entry entry : this.despawnRanges.entrySet()) { ++ final MobCategory category = entry.getKey(); ++ final DespawnRangePair range = entry.getValue(); ++ range.hard().preComputed(category.getDespawnDistance(), category.getSerializedName()); ++ range.soft().preComputed(category.getNoDespawnDistance(), category.getSerializedName()); ++ } + } + + public WaterAnimalSpawnHeight wateranimalSpawnHeight; @@ -1962,7 +1983,7 @@ index 0000000000000000000000000000000000000000..4bcf27f98765abf693e535cfc1756c27 + public boolean showSignClickCommandFailureMsgsToPlayer = false; + public RedstoneImplementation redstoneImplementation = RedstoneImplementation.VANILLA; + public boolean disableEndCredits = false; -+ public double maxLeashDistance = Leashable.LEASH_TOO_FAR_DIST; ++ public DoubleOr.Default maxLeashDistance = DoubleOr.Default.USE_DEFAULT; + public boolean disableSprintInterruptionOnAttack = false; + public int shieldBlockingDelay = 5; + public boolean disableRelativeProjectileVelocity = false; @@ -2841,7 +2862,7 @@ index 0000000000000000000000000000000000000000..4af710e144b70933d750c22edfe484c1 +} diff --git a/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java new file mode 100644 -index 0000000000000000000000000000000000000000..9b5075c39a4ef931cdb99e9aee8a33c6d88c2a2e +index 0000000000000000000000000000000000000000..e7e997796ec47c742cc1f98e61db75a4231e6f98 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/serializer/collections/MapSerializer.java @@ -0,0 +1,162 @@ @@ -2933,7 +2954,7 @@ index 0000000000000000000000000000000000000000..9b5075c39a4ef931cdb99e9aee8a33c6 + return serializer.deserialize(type, node); + } catch (SerializationException ex) { + ex.initPath(node::path); -+ LOGGER.error("Could not deserialize {} {} into {} at {}", mapPart, node.raw(), type, path); ++ LOGGER.error("Could not deserialize {} {} into {} at {}: {}", mapPart, node.raw(), type, path, ex.rawMessage()); + } + return null; + } @@ -2994,7 +3015,7 @@ index 0000000000000000000000000000000000000000..9b5075c39a4ef931cdb99e9aee8a33c6 + return true; + } catch (SerializationException ex) { + ex.initPath(node::path); -+ LOGGER.error("Could not serialize {} {} from {} at {}", mapPart, object, type, path); ++ LOGGER.error("Could not serialize {} {} from {} at {}: {}", mapPart, object, type, path, ex.rawMessage()); + } + return false; + } @@ -4190,6 +4211,121 @@ index 0000000000000000000000000000000000000000..a3eaa47cfcfc4fd2a607f9b375230fad + } + } +} +diff --git a/src/main/java/io/papermc/paper/configuration/type/DespawnRange.java b/src/main/java/io/papermc/paper/configuration/type/DespawnRange.java +new file mode 100644 +index 0000000000000000000000000000000000000000..8a792a000e924b3ddc572edc788598811e9ef71c +--- /dev/null ++++ b/src/main/java/io/papermc/paper/configuration/type/DespawnRange.java +@@ -0,0 +1,109 @@ ++package io.papermc.paper.configuration.type; ++ ++import io.papermc.paper.configuration.type.number.IntOr; ++import java.lang.reflect.Type; ++import org.checkerframework.checker.nullness.qual.Nullable; ++import org.spongepowered.configurate.ConfigurationNode; ++import org.spongepowered.configurate.serialize.SerializationException; ++import org.spongepowered.configurate.serialize.TypeSerializer; ++ ++/* ++(x/a)^2 + (y/b)^2 + (z/c)^2 < 1 ++a == c ++ac = horizontal limit ++b = vertical limit ++x^2/ac^2 + y^2/b^2 + z^2/ac^2 < 1 ++(x^2 + z^2)/ac^2 + y^2/b^2 < 1 ++x^2 + z^2 + (y^2 * (ac^2/b^2)) < ac^2 ++ */ ++public final class DespawnRange { ++ ++ public static final TypeSerializer SERIALIZER = new Serializer(); ++ ++ private final IntOr.Default horizontalLimit; ++ private final IntOr.Default verticalLimit; ++ private final boolean wasDefinedViaLongSyntax; ++ ++ // cached values ++ private double preComputedHorizontalLimitSquared; // ac^2 ++ private double preComputedHorizontalLimitSquaredOverVerticalLimitSquared; // ac^2/b^2 ++ private int preComputedVanillaDefaultLimit; ++ ++ public DespawnRange(final IntOr.Default generalLimit) { ++ this(generalLimit, generalLimit, false); ++ } ++ ++ public DespawnRange(final IntOr.Default horizontalLimit, final IntOr.Default verticalLimit, final boolean wasDefinedViaLongSyntax) { ++ this.horizontalLimit = horizontalLimit; ++ this.verticalLimit = verticalLimit; ++ this.wasDefinedViaLongSyntax = wasDefinedViaLongSyntax; ++ } ++ ++ public void preComputed(int defaultDistanceLimit, String identifier) throws SerializationException { ++ if (this.verticalLimit.or(defaultDistanceLimit) <= 0) { ++ throw new SerializationException("Vertical limit must be greater than 0 for " + identifier); ++ } ++ if (this.horizontalLimit.or(defaultDistanceLimit) <= 0) { ++ throw new SerializationException("Horizontal limit must be greater than 0 for " + identifier); ++ } ++ this.preComputedVanillaDefaultLimit = defaultDistanceLimit; ++ this.preComputedHorizontalLimitSquared = Math.pow(this.horizontalLimit.or(defaultDistanceLimit), 2); ++ if (!this.horizontalLimit.isDefined() && !this.verticalLimit.isDefined()) { ++ this.preComputedHorizontalLimitSquaredOverVerticalLimitSquared = 1.0; ++ } else { ++ this.preComputedHorizontalLimitSquaredOverVerticalLimitSquared = this.preComputedHorizontalLimitSquared / Math.pow(this.verticalLimit.or(defaultDistanceLimit), 2); ++ } ++ } ++ ++ public boolean shouldDespawn(final Shape shape, final double dxSqr, final double dySqr, final double dzSqr, final double dy) { ++ if (shape == Shape.ELLIPSOID) { ++ return dxSqr + dzSqr + (dySqr * this.preComputedHorizontalLimitSquaredOverVerticalLimitSquared) > this.preComputedHorizontalLimitSquared; ++ } else { ++ return dxSqr + dzSqr > this.preComputedHorizontalLimitSquared || dy > this.verticalLimit.or(this.preComputedVanillaDefaultLimit); ++ } ++ } ++ ++ public boolean wasDefinedViaLongSyntax() { ++ return this.wasDefinedViaLongSyntax; ++ } ++ ++ public enum Shape { ++ CYLINDER, ELLIPSOID ++ } ++ ++ static final class Serializer implements TypeSerializer { ++ ++ public static final String HORIZONTAL = "horizontal"; ++ public static final String VERTICAL = "vertical"; ++ ++ @Override ++ public DespawnRange deserialize(final Type type, final ConfigurationNode node) throws SerializationException { ++ if (node.hasChild(HORIZONTAL) && node.hasChild(VERTICAL)) { ++ return new DespawnRange( ++ node.node(HORIZONTAL).require(IntOr.Default.class), ++ node.node(VERTICAL).require(IntOr.Default.class), ++ true ++ ); ++ } else if (node.hasChild(HORIZONTAL) || node.hasChild(VERTICAL)) { ++ throw new SerializationException(node, DespawnRange.class, "Expected both horizontal and vertical despawn ranges to be defined"); ++ } else { ++ return new DespawnRange(node.require(IntOr.Default.class)); ++ } ++ } ++ ++ @Override ++ public void serialize(final Type type, final @Nullable DespawnRange despawnRange, final ConfigurationNode node) throws SerializationException { ++ if (despawnRange == null) { ++ node.raw(null); ++ return; ++ } ++ ++ if (despawnRange.wasDefinedViaLongSyntax()) { ++ node.node(HORIZONTAL).set(despawnRange.horizontalLimit); ++ node.node(VERTICAL).set(despawnRange.verticalLimit); ++ } else { ++ node.set(despawnRange.verticalLimit); ++ } ++ } ++ } ++} diff --git a/src/main/java/io/papermc/paper/configuration/type/Duration.java b/src/main/java/io/papermc/paper/configuration/type/Duration.java new file mode 100644 index 0000000000000000000000000000000000000000..422ccb0b332b3e94be228b9b94f379467d6461a5 @@ -4689,14 +4825,15 @@ index 0000000000000000000000000000000000000000..31068170086aeac51a2adb952b19672e +} diff --git a/src/main/java/io/papermc/paper/configuration/type/number/DoubleOr.java b/src/main/java/io/papermc/paper/configuration/type/number/DoubleOr.java new file mode 100644 -index 0000000000000000000000000000000000000000..5833c06b0707906ab7d10786ecd115f20e42e925 +index 0000000000000000000000000000000000000000..0e7205e6ba9b207082c8c530142f0b832dcd242d --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/type/number/DoubleOr.java -@@ -0,0 +1,59 @@ +@@ -0,0 +1,74 @@ +package io.papermc.paper.configuration.type.number; + +import com.google.common.base.Preconditions; +import java.util.OptionalDouble; ++import java.util.function.DoublePredicate; +import java.util.function.Function; +import java.util.function.Predicate; +import org.spongepowered.configurate.serialize.ScalarSerializer; @@ -4719,6 +4856,20 @@ index 0000000000000000000000000000000000000000..5833c06b0707906ab7d10786ecd115f2 + public static final ScalarSerializer SERIALIZER = new Serializer<>(Default.class, Default::new, DEFAULT_VALUE, USE_DEFAULT); + } + ++ record Disabled(OptionalDouble value) implements DoubleOr { ++ private static final String DISABLED_VALUE = "disabled"; ++ public static final Disabled DISABLED = new Disabled(OptionalDouble.empty()); ++ public static final ScalarSerializer SERIALIZER = new Serializer<>(Disabled.class, Disabled::new, DISABLED_VALUE, DISABLED); ++ ++ public boolean test(DoublePredicate predicate) { ++ return this.value.isPresent() && predicate.test(this.value.getAsDouble()); ++ } ++ ++ public boolean enabled() { ++ return this.value.isPresent(); ++ } ++ } ++ + final class Serializer extends OptionalNumSerializer { + Serializer(final Class classOfT, final Function factory, String emptySerializedValue, T emptyValue) { + super(classOfT, emptySerializedValue, emptyValue, OptionalDouble::empty, OptionalDouble::isEmpty, factory, double.class); @@ -4754,10 +4905,10 @@ index 0000000000000000000000000000000000000000..5833c06b0707906ab7d10786ecd115f2 + diff --git a/src/main/java/io/papermc/paper/configuration/type/number/IntOr.java b/src/main/java/io/papermc/paper/configuration/type/number/IntOr.java new file mode 100644 -index 0000000000000000000000000000000000000000..09f16e5dde565801b153bd6705637c5f71427c8a +index 0000000000000000000000000000000000000000..73a7b664923121daedac8f01a26253438da68119 --- /dev/null +++ b/src/main/java/io/papermc/paper/configuration/type/number/IntOr.java -@@ -0,0 +1,81 @@ +@@ -0,0 +1,85 @@ +package io.papermc.paper.configuration.type.number; + +import com.google.common.base.Preconditions; @@ -4779,6 +4930,10 @@ index 0000000000000000000000000000000000000000..09f16e5dde565801b153bd6705637c5f + + OptionalInt value(); + ++ default boolean isDefined() { ++ return this.value().isPresent(); ++ } ++ + default int intValue() { + return this.value().orElseThrow(); + } diff --git a/patches/server/0010-Adventure.patch b/patches/server/0010-Adventure.patch index bed3f0467a..c0eaef344c 100644 --- a/patches/server/0010-Adventure.patch +++ b/patches/server/0010-Adventure.patch @@ -2872,7 +2872,7 @@ index e7c407039fef88ef01ba9b6be9ae5bcc3edc026f..5457358bc76889153036818fdfd70a04 @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e244ac9f51a08603a7877e7e655fda26cd396772..556d8f23ee2de77cea71abcc0e56718e60b20b05 100644 +index 2de70e3a3038b2d2bb47b58f0e14d937c35d55ba..4acee8121ff62413dbbf2294d17da3bd2f974d5a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -45,6 +45,7 @@ import net.minecraft.nbt.CompoundTag; @@ -4677,10 +4677,10 @@ index 5725b0281ac53a2354b233223259d6784353bc6e..9ef939b76d06874b856e0c850addb364 @Override public int getLineWidth() { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 938a7ee49a727d5929d1d049c61d2881cf24ff9c..78f4bb474c85e32448a385e108707d92082bfe02 100644 +index 20eb63eeac7f5c9a1d98a9aa8f90a588cb036c70..8f468a3bfa8ef381eabb45ebb3dd9a4942e98dd5 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -915,7 +915,7 @@ public class CraftEventFactory { +@@ -917,7 +917,7 @@ public class CraftEventFactory { return event; } @@ -4689,7 +4689,7 @@ index 938a7ee49a727d5929d1d049c61d2881cf24ff9c..78f4bb474c85e32448a385e108707d92 CraftPlayer entity = victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); -@@ -948,7 +948,7 @@ public class CraftEventFactory { +@@ -950,7 +950,7 @@ public class CraftEventFactory { * Server methods */ public static ServerListPingEvent callServerListPingEvent(SocketAddress address, String motd, int numPlayers, int maxPlayers) { diff --git a/patches/server/0031-Add-configurable-entity-despawn-distances.patch b/patches/server/0031-Add-configurable-entity-despawn-distances.patch index fa5b7ed6a7..d7a7254cdd 100644 --- a/patches/server/0031-Add-configurable-entity-despawn-distances.patch +++ b/patches/server/0031-Add-configurable-entity-despawn-distances.patch @@ -5,23 +5,43 @@ Subject: [PATCH] Add configurable entity despawn distances diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 0593d828c911c94c9833bf12b9c294e5dac1f4e8..5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e 100644 +index 0593d828c911c94c9833bf12b9c294e5dac1f4e8..02c8c52930640114592148fd5509ad8fffee5435 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -864,14 +864,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -863,20 +863,24 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab + Player entityhuman = this.level().getNearestPlayer(this, -1.0D); if (entityhuman != null) { - double d0 = entityhuman.distanceToSqr((Entity) this); +- double d0 = entityhuman.distanceToSqr((Entity) this); - int i = this.getType().getCategory().getDespawnDistance(); -+ int i = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).hard(); // Paper - Configurable despawn distances - int j = i * i; - - if (d0 > (double) j && this.removeWhenFarAway(d0)) { +- int j = i * i; +- +- if (d0 > (double) j && this.removeWhenFarAway(d0)) { ++ // Paper start - Configurable despawn distances ++ final io.papermc.paper.configuration.WorldConfiguration.Entities.Spawning.DespawnRangePair despawnRangePair = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()); ++ final io.papermc.paper.configuration.type.DespawnRange.Shape shape = this.level().paperConfig().entities.spawning.despawnRangeShape; ++ final double dy = Math.abs(entityhuman.getY() - this.getY()); ++ final double dySqr = Math.pow(dy, 2); ++ final double dxSqr = Math.pow(entityhuman.getX() - this.getX(), 2); ++ final double dzSqr = Math.pow(entityhuman.getZ() - this.getZ(), 2); ++ final double distanceSquared = dxSqr + dzSqr + dySqr; ++ // Despawn if hard/soft limit is exceeded ++ if (despawnRangePair.hard().shouldDespawn(shape, dxSqr, dySqr, dzSqr, dy) && this.removeWhenFarAway(distanceSquared)) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } - +- - int k = this.getType().getCategory().getNoDespawnDistance(); -+ int k = this.level().paperConfig().entities.spawning.despawnRanges.get(this.getType().getCategory()).soft(); // Paper - Configurable despawn distances - int l = k * k; - - if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) { +- int l = k * k; +- +- if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && d0 > (double) l && this.removeWhenFarAway(d0)) { +- this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause +- } else if (d0 < (double) l) { ++ if (despawnRangePair.soft().shouldDespawn(shape, dxSqr, dySqr, dzSqr, dy)) { ++ if (this.noActionTime > 600 && this.random.nextInt(800) == 0 && this.removeWhenFarAway(distanceSquared)) { ++ this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause ++ } ++ } else { ++ // Paper end - Configurable despawn distances + this.noActionTime = 0; + } + } diff --git a/patches/server/0034-Player-affects-spawning-API.patch b/patches/server/0034-Player-affects-spawning-API.patch index cf0d8b3c60..654234cc36 100644 --- a/patches/server/0034-Player-affects-spawning-API.patch +++ b/patches/server/0034-Player-affects-spawning-API.patch @@ -21,7 +21,7 @@ index 3126e8cab3c40e3af47f4c8925e1c6a9523309ba..3207166061bf9c4d7bf3f38e5a9f7aff public static Predicate withinDistance(double x, double y, double z, double max) { double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e..a753fd0434f611d8c77270012e383e3210f1194b 100644 +index 4ce1586351b417aede1fd401907388b5fa0e9fd6..d8beadc96a7f779c39c8e22ffe52d872ac49a0ad 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -860,7 +860,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -32,7 +32,7 @@ index 5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e..a753fd0434f611d8c77270012e383e32 + Player entityhuman = this.level().findNearbyPlayer(this, -1.0D, EntitySelector.PLAYER_AFFECTS_SPAWNING); // Paper - Affects Spawning API if (entityhuman != null) { - double d0 = entityhuman.distanceToSqr((Entity) this); + // Paper start - Configurable despawn distances diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java b/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java index 3b7fc11b7832a72fb9b0806fe9847f4e30759e7b..3cb84856c10347162a8736ae1ef65165183ec8fe 100644 --- a/src/main/java/net/minecraft/world/entity/animal/horse/SkeletonTrapGoal.java diff --git a/patches/server/0039-Check-online-mode-before-converting-and-renaming-pla.patch b/patches/server/0039-Check-online-mode-before-converting-and-renaming-pla.patch index f89cf885a5..70183b1722 100644 --- a/patches/server/0039-Check-online-mode-before-converting-and-renaming-pla.patch +++ b/patches/server/0039-Check-online-mode-before-converting-and-renaming-pla.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Check online mode before converting and renaming player data diff --git a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java -index 79222a04ef104bf2eed85684479384b7c350ea19..e11c8523e633d2a8e3cea7ecd54978b2958b9684 100644 +index 79222a04ef104bf2eed85684479384b7c350ea19..cd013567dd6224c86c0f1813d8a3d5fb7b8cabb5 100644 --- a/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java +++ b/src/main/java/net/minecraft/world/level/storage/PlayerDataStorage.java @@ -78,7 +78,7 @@ public class PlayerDataStorage { @@ -13,7 +13,7 @@ index 79222a04ef104bf2eed85684479384b7c350ea19..e11c8523e633d2a8e3cea7ecd54978b2 // Spigot Start boolean usingWrongFile = false; - if ( !file1.exists() ) -+ if ( org.bukkit.Bukkit.getOnlineMode() && !file.exists() ) // Paper - Check online mode first ++ if ( org.bukkit.Bukkit.getOnlineMode() && !file1.exists() ) // Paper - Check online mode first { file1 = new File( file, java.util.UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + name ).getBytes( java.nio.charset.StandardCharsets.UTF_8 ) ).toString() + s ); if ( file1.exists() ) diff --git a/patches/server/0060-Add-configurable-portal-search-radius.patch b/patches/server/0060-Add-configurable-portal-search-radius.patch index 4a5099223d..9ba19afb3e 100644 --- a/patches/server/0060-Add-configurable-portal-search-radius.patch +++ b/patches/server/0060-Add-configurable-portal-search-radius.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add configurable portal search radius diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java -index 462afb22cce2376789e44283032e63a6264cf851..19c813ab9e71eed150ae569f903287e9283d9292 100644 +index 462afb22cce2376789e44283032e63a6264cf851..8072e67f7b2f5944670159d3de1b01090bd1019d 100644 --- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java +++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java @@ -139,8 +139,14 @@ public class NetherPortalBlock extends Block implements Portal { @@ -20,7 +20,7 @@ index 462afb22cce2376789e44283032e63a6264cf851..19c813ab9e71eed150ae569f903287e9 + // Paper end - Configurable portal search radius // CraftBukkit start - CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, flag ? 16 : 128, 16); -+ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, 16); // Paper - use custom portal search radius ++ CraftPortalEvent event = entity.callPortalEvent(entity, CraftLocation.toBukkit(blockposition1, worldserver1.getWorld()), PlayerTeleportEvent.TeleportCause.NETHER_PORTAL, portalSearchRadius, worldserver1.paperConfig().environment.portalCreateRadius); // Paper - use custom portal search radius if (event == null) { return null; } diff --git a/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch b/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch index 3ac4e0b315..99eaab4c61 100644 --- a/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch +++ b/patches/server/0083-Add-PlayerUseUnknownEntityEvent.patch @@ -28,7 +28,7 @@ index 1e9c68cd1868d083e6a790d56006dd4aa432010a..8a0ee9564fc36a2badf1357f7e6c47b5 + // Paper end - PlayerUseUnknownEntityEvent } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 64db7e017b41bffcaac202ee4ecfd7df46d69331..14a821bfc6b20475889d3138b8da9e6bfaf1787c 100644 +index 02b9e1ed57f5d65698c461387ff7d48450e6a70f..0d18b12d0755c14bd041e0f98177469612262fde 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2493,7 +2493,26 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -59,10 +59,10 @@ index 64db7e017b41bffcaac202ee4ecfd7df46d69331..14a821bfc6b20475889d3138b8da9e6b @Override diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 78f4bb474c85e32448a385e108707d92082bfe02..b68068c783f782258f86e5ecf54664916f069e38 100644 +index 8f468a3bfa8ef381eabb45ebb3dd9a4942e98dd5..96e0fc5c8a018fd579f24529175decdac634cfa1 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1915,4 +1915,13 @@ public class CraftEventFactory { +@@ -1931,4 +1931,13 @@ public class CraftEventFactory { Bukkit.getPluginManager().callEvent(new EntityRemoveEvent(entity.getBukkitEntity(), cause)); } diff --git a/patches/server/0108-Add-EntityZapEvent.patch b/patches/server/0108-Add-EntityZapEvent.patch index 3f2644e38f..cb6ab1da64 100644 --- a/patches/server/0108-Add-EntityZapEvent.patch +++ b/patches/server/0108-Add-EntityZapEvent.patch @@ -28,10 +28,10 @@ index 63c10be6eacd7108b8b4795d76bf624e0614440a..243eb1e54293c763a06febff551c0513 entitywitch.finalizeSpawn(world, world.getCurrentDifficultyAt(entitywitch.blockPosition()), MobSpawnType.CONVERSION, (SpawnGroupData) null); entitywitch.setNoAi(this.isNoAi()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b68068c783f782258f86e5ecf54664916f069e38..44c416f812867f19a26aeefc5710a7aef9dfdf64 100644 +index 96e0fc5c8a018fd579f24529175decdac634cfa1..50f33c6029c190f947b6bf6215004416b034c0cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1215,6 +1215,14 @@ public class CraftEventFactory { +@@ -1217,6 +1217,14 @@ public class CraftEventFactory { return !event.isCancelled(); } diff --git a/patches/server/0112-Add-source-to-PlayerExpChangeEvent.patch b/patches/server/0112-Add-source-to-PlayerExpChangeEvent.patch index 46f6c063c9..539523b8dd 100644 --- a/patches/server/0112-Add-source-to-PlayerExpChangeEvent.patch +++ b/patches/server/0112-Add-source-to-PlayerExpChangeEvent.patch @@ -18,10 +18,10 @@ index 56402312e44d12c859e2c4b39902d31b7cfd1573..25a45e680f9fdea90f43d59de87a3a50 --this.count; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 44c416f812867f19a26aeefc5710a7aef9dfdf64..a83b7f350bf20f944de92df76e112aaa49dc608d 100644 +index 50f33c6029c190f947b6bf6215004416b034c0cc..d36e039aa5f1cf84179def5df5addaf448f54bd2 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1168,6 +1168,17 @@ public class CraftEventFactory { +@@ -1170,6 +1170,17 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0113-Add-ProjectileCollideEvent.patch b/patches/server/0113-Add-ProjectileCollideEvent.patch index 4a6b57dae0..f2c7317621 100644 --- a/patches/server/0113-Add-ProjectileCollideEvent.patch +++ b/patches/server/0113-Add-ProjectileCollideEvent.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add ProjectileCollideEvent Deprecated now and replaced with ProjectileHitEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a83b7f350bf20f944de92df76e112aaa49dc608d..b5b237c56575e8ceb3e6471deec1e7712891a8e0 100644 +index d36e039aa5f1cf84179def5df5addaf448f54bd2..91180d7ad705ca97c0df43debc14b204127165d0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1321,6 +1321,16 @@ public class CraftEventFactory { +@@ -1323,6 +1323,16 @@ public class CraftEventFactory { Bukkit.getPluginManager().callEvent(crafterCraftEvent); return crafterCraftEvent; } @@ -26,7 +26,7 @@ index a83b7f350bf20f944de92df76e112aaa49dc608d..b5b237c56575e8ceb3e6471deec1e771 public static ProjectileLaunchEvent callProjectileLaunchEvent(Entity entity) { Projectile bukkitEntity = (Projectile) entity.getBukkitEntity(); -@@ -1346,8 +1356,15 @@ public class CraftEventFactory { +@@ -1348,8 +1358,15 @@ public class CraftEventFactory { if (position.getType() == HitResult.Type.ENTITY) { hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity(); } diff --git a/patches/server/0132-Item-canEntityPickup.patch b/patches/server/0132-Item-canEntityPickup.patch index 42c74b33f3..58d3e70770 100644 --- a/patches/server/0132-Item-canEntityPickup.patch +++ b/patches/server/0132-Item-canEntityPickup.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index a753fd0434f611d8c77270012e383e3210f1194b..55aecada617bd84676928a7818f1511b2d85e7bf 100644 +index d8beadc96a7f779c39c8e22ffe52d872ac49a0ad..fe00b73b0aeac4e4c1496dcaf81595f57a4a073f 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -673,6 +673,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab diff --git a/patches/server/0141-Entity-fromMobSpawner.patch b/patches/server/0141-Entity-fromMobSpawner.patch index 4afd9e1ed2..8c8147c6ec 100644 --- a/patches/server/0141-Entity-fromMobSpawner.patch +++ b/patches/server/0141-Entity-fromMobSpawner.patch @@ -49,10 +49,10 @@ index aa54237205989f619ac6a3faa2e4285427b9e31d..43d399e1a0ba2fb0541f851a28032fa6 if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) { continue; diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java -index 571756dacfa16f6755b67457e17969c35104f971..52d71a03cd5b2af56704f265ce5b5f14d3236ebb 100644 +index 55d63de57ec740fc4ea5faa3db9a092b8e4fed95..c3f6522a7dc0777c5b3fa2bac63a8901f96d9f38 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java +++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java -@@ -225,6 +225,7 @@ public final class TrialSpawner { +@@ -230,6 +230,7 @@ public final class TrialSpawner { optional1.ifPresent(entityinsentient::equip); } diff --git a/patches/server/0169-Add-ArmorStand-Item-Meta.patch b/patches/server/0169-Add-ArmorStand-Item-Meta.patch index 554e001492..46624a41d4 100644 --- a/patches/server/0169-Add-ArmorStand-Item-Meta.patch +++ b/patches/server/0169-Add-ArmorStand-Item-Meta.patch @@ -33,10 +33,10 @@ index eef3517833ff5c0cf41b89973ebc972b8ed31e0f..c9fbc01be0b0e7fd1cafb091d06496f4 (type, meta) -> meta instanceof CraftMetaArmorStand armorStand ? armorStand : new CraftMetaArmorStand(meta)); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -index c4f12f96e39cb6189799a796b4cb2cb4f0b92392..59bdac414e8205ed608f79ef0d1502acd826d216 100644 +index c4f12f96e39cb6189799a796b4cb2cb4f0b92392..ecce5d0da946ca279c5608068442cc53437dd2a5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -@@ -11,9 +11,22 @@ import org.bukkit.Material; +@@ -11,9 +11,17 @@ import org.bukkit.Material; import org.bukkit.configuration.serialization.DelegateDeserialization; @DelegateDeserialization(SerializableMeta.class) @@ -45,229 +45,182 @@ index c4f12f96e39cb6189799a796b4cb2cb4f0b92392..59bdac414e8205ed608f79ef0d1502ac static final ItemMetaKeyType ENTITY_TAG = new ItemMetaKeyType<>(DataComponents.ENTITY_DATA, "entity-tag"); + // Paper start ++ static final ItemMetaKey ENTITY_ID = new ItemMetaKey("id", "entity-id"); + static final ItemMetaKey INVISIBLE = new ItemMetaKey("Invisible", "invisible"); + static final ItemMetaKey NO_BASE_PLATE = new ItemMetaKey("NoBasePlate", "no-base-plate"); + static final ItemMetaKey SHOW_ARMS = new ItemMetaKey("ShowArms", "show-arms"); + static final ItemMetaKey SMALL = new ItemMetaKey("Small", "small"); + static final ItemMetaKey MARKER = new ItemMetaKey("Marker", "marker"); -+ -+ private Boolean invisible = null; -+ private Boolean noBasePlate = null; -+ private Boolean showArms = null; -+ private Boolean small = null; -+ private Boolean marker = null; + // Paper end CompoundTag entityTag; CraftMetaArmorStand(CraftMetaItem meta) { -@@ -24,6 +37,13 @@ public class CraftMetaArmorStand extends CraftMetaItem { - } - - CraftMetaArmorStand armorStand = (CraftMetaArmorStand) meta; -+ // Paper start -+ this.invisible = armorStand.invisible; -+ this.noBasePlate = armorStand.noBasePlate; -+ this.showArms = armorStand.showArms; -+ this.small = armorStand.small; -+ this.marker = armorStand.marker; -+ // Paper end - this.entityTag = armorStand.entityTag; - } - -@@ -32,11 +52,39 @@ public class CraftMetaArmorStand extends CraftMetaItem { - - getOrEmpty(tag, CraftMetaArmorStand.ENTITY_TAG).ifPresent((nbt) -> { - this.entityTag = nbt.copyTag(); -+ // Paper start -+ if (entityTag.contains(INVISIBLE.NBT)) { -+ invisible = entityTag.getBoolean(INVISIBLE.NBT); -+ } -+ -+ if (entityTag.contains(NO_BASE_PLATE.NBT)) { -+ noBasePlate = entityTag.getBoolean(NO_BASE_PLATE.NBT); -+ } -+ -+ if (entityTag.contains(SHOW_ARMS.NBT)) { -+ showArms = entityTag.getBoolean(SHOW_ARMS.NBT); -+ } -+ -+ if (entityTag.contains(SMALL.NBT)) { -+ small = entityTag.getBoolean(SMALL.NBT); -+ } -+ -+ if (entityTag.contains(MARKER.NBT)) { -+ marker = entityTag.getBoolean(MARKER.NBT); -+ } -+ // Paper end - }); - } +@@ -37,6 +45,42 @@ public class CraftMetaArmorStand extends CraftMetaItem { CraftMetaArmorStand(Map map) { super(map); + // Paper start -+ this.invisible = SerializableMeta.getBoolean(map, INVISIBLE.BUKKIT); -+ this.noBasePlate = SerializableMeta.getBoolean(map, NO_BASE_PLATE.BUKKIT); -+ this.showArms = SerializableMeta.getBoolean(map, SHOW_ARMS.BUKKIT); -+ this.small = SerializableMeta.getBoolean(map, SMALL.BUKKIT); -+ this.marker = SerializableMeta.getBoolean(map, MARKER.BUKKIT); ++ String entityTag = SerializableMeta.getString(map, ENTITY_TAG.BUKKIT, true); ++ if (entityTag != null) { ++ java.io.ByteArrayInputStream buf = new java.io.ByteArrayInputStream(java.util.Base64.getDecoder().decode(entityTag)); ++ try { ++ this.entityTag = net.minecraft.nbt.NbtIo.readCompressed(buf, net.minecraft.nbt.NbtAccounter.unlimitedHeap()); ++ } catch (java.io.IOException ex) { ++ java.util.logging.Logger.getLogger(CraftMetaItem.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); ++ } ++ return; ++ } ++ SerializableMeta.getObjectOptionally(Boolean.class, map, INVISIBLE.BUKKIT, true).ifPresent((value) -> { ++ populateTagIfNull(); ++ this.entityTag.putBoolean(INVISIBLE.NBT, value); ++ }); ++ SerializableMeta.getObjectOptionally(Boolean.class, map, NO_BASE_PLATE.BUKKIT, true).ifPresent((value) -> { ++ populateTagIfNull(); ++ this.entityTag.putBoolean(NO_BASE_PLATE.NBT, value); ++ }); ++ SerializableMeta.getObjectOptionally(Boolean.class, map, SHOW_ARMS.BUKKIT, true).ifPresent((value) -> { ++ populateTagIfNull(); ++ this.entityTag.putBoolean(SHOW_ARMS.NBT, value); ++ }); ++ SerializableMeta.getObjectOptionally(Boolean.class, map, SMALL.BUKKIT, true).ifPresent((value) -> { ++ populateTagIfNull(); ++ this.entityTag.putBoolean(SMALL.NBT, value); ++ }); ++ SerializableMeta.getObjectOptionally(Boolean.class, map, MARKER.BUKKIT, true).ifPresent((value) -> { ++ populateTagIfNull(); ++ this.entityTag.putBoolean(MARKER.NBT, value); ++ }); ++ SerializableMeta.getObjectOptionally(String.class, map, ENTITY_ID, true).ifPresent((value) -> { ++ populateTagIfNull(); ++ this.entityTag.putString(ENTITY_ID.NBT, value); ++ }); + // Paper end } @Override -@@ -59,6 +107,31 @@ public class CraftMetaArmorStand extends CraftMetaItem { - void applyToItem(CraftMetaItem.Applicator tag) { - super.applyToItem(tag); +@@ -45,12 +89,13 @@ public class CraftMetaArmorStand extends CraftMetaItem { -+ // Paper start -+ if (!isArmorStandEmpty() && this.entityTag == null) { -+ this.entityTag = new CompoundTag(); -+ } -+ -+ if (this.invisible != null) { -+ this.entityTag.putBoolean(INVISIBLE.NBT, this.invisible); -+ } -+ -+ if (this.noBasePlate != null) { -+ this.entityTag.putBoolean(NO_BASE_PLATE.NBT, this.noBasePlate); -+ } -+ -+ if (this.showArms != null) { -+ this.entityTag.putBoolean(SHOW_ARMS.NBT, this.showArms); -+ } -+ -+ if (this.small != null) { -+ this.entityTag.putBoolean(SMALL.NBT, this.small); -+ } -+ -+ if (this.marker != null) { -+ this.entityTag.putBoolean(MARKER.NBT, this.marker); -+ } -+ // Paper end - if (this.entityTag != null) { - tag.put(CraftMetaArmorStand.ENTITY_TAG, CustomData.of(this.entityTag)); + if (tag.contains(CraftMetaArmorStand.ENTITY_TAG.NBT)) { + this.entityTag = tag.getCompound(CraftMetaArmorStand.ENTITY_TAG.NBT); ++ if (!this.entityTag.contains(ENTITY_ID.NBT)) entityTag.putString(ENTITY_ID.NBT, "minecraft:armor_stand"); // Paper - fixup legacy armorstand metas that did not include this. } -@@ -75,7 +148,7 @@ public class CraftMetaArmorStand extends CraftMetaItem { + } + + @Override + void serializeInternal(Map internalTags) { +- if (this.entityTag != null && !this.entityTag.isEmpty()) { ++ if (false && this.entityTag != null && !this.entityTag.isEmpty()) { // Paper - now correctly serialised as entity tag + internalTags.put(CraftMetaArmorStand.ENTITY_TAG.NBT, this.entityTag); + } + } +@@ -75,7 +120,7 @@ public class CraftMetaArmorStand extends CraftMetaItem { } boolean isArmorStandEmpty() { - return !(this.entityTag != null); -+ return !(this.invisible != null || this.noBasePlate != null || this.showArms != null || this.small != null || this.marker != null || this.entityTag != null); // Paper ++ return entityTag == null || entityTag.isEmpty(); // Paper - consider armor stand empty if tag is empty. } @Override -@@ -86,7 +159,14 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -86,7 +131,9 @@ public class CraftMetaArmorStand extends CraftMetaItem { if (meta instanceof CraftMetaArmorStand) { CraftMetaArmorStand that = (CraftMetaArmorStand) meta; - return this.entityTag != null ? that.entityTag != null && this.entityTag.equals(that.entityTag) : this.entityTag == null; + // Paper start -+ return java.util.Objects.equals(this.entityTag, that.entityTag) && -+ this.invisible == that.invisible && -+ this.noBasePlate == that.noBasePlate && -+ this.showArms == that.showArms && -+ this.small == that.small && -+ this.marker == that.marker; ++ return java.util.Objects.equals(this.entityTag, that.entityTag); + // Paper end } return true; } -@@ -104,6 +184,13 @@ public class CraftMetaArmorStand extends CraftMetaItem { - if (this.entityTag != null) { - hash = 73 * hash + this.entityTag.hashCode(); - } -+ // Paper start -+ hash = 61 * hash + (this.invisible != null ? Boolean.hashCode(this.isInvisible()) : 0); -+ hash = 61 * hash + (this.noBasePlate != null ? Boolean.hashCode(this.hasNoBasePlate()) : 0); -+ hash = 61 * hash + (this.showArms != null ? Boolean.hashCode(this.shouldShowArms()) : 0); -+ hash = 61 * hash + (this.small != null ? Boolean.hashCode(this.isSmall()) : 0); -+ hash = 61 * hash + (this.marker != null ? Boolean.hashCode(this.isMarker()) : 0); -+ // Paper end - - return original != hash ? CraftMetaArmorStand.class.hashCode() ^ hash : hash; - } -@@ -112,6 +199,28 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -112,6 +159,21 @@ public class CraftMetaArmorStand extends CraftMetaItem { Builder serialize(Builder builder) { super.serialize(builder); + // Paper start -+ if (invisible != null) { -+ builder.put(INVISIBLE.BUKKIT, invisible); -+ } -+ -+ if (noBasePlate != null) { -+ builder.put(NO_BASE_PLATE.BUKKIT, noBasePlate); -+ } -+ -+ if (showArms != null) { -+ builder.put(SHOW_ARMS.BUKKIT, showArms); -+ } -+ -+ if (small != null) { -+ builder.put(SMALL.BUKKIT, small); -+ } -+ -+ if (marker != null) { -+ builder.put(MARKER.BUKKIT, marker); ++ if (entityTag == null) { ++ return builder; ++ } else if (true) { ++ java.io.ByteArrayOutputStream buf = new java.io.ByteArrayOutputStream(); ++ try { ++ net.minecraft.nbt.NbtIo.writeCompressed(entityTag, buf); ++ } catch (java.io.IOException ex) { ++ java.util.logging.Logger.getLogger(CraftMetaItem.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); ++ } ++ builder.put(ENTITY_TAG.BUKKIT, java.util.Base64.getEncoder().encodeToString(buf.toByteArray())); ++ return builder; + } + // Paper end + return builder; } -@@ -125,4 +234,56 @@ public class CraftMetaArmorStand extends CraftMetaItem { +@@ -125,4 +187,68 @@ public class CraftMetaArmorStand extends CraftMetaItem { return clone; } + + // Paper start ++ private void populateTagIfNull() { ++ if (this.entityTag == null) { ++ this.entityTag = new CompoundTag(); ++ this.entityTag.putString(ENTITY_ID.NBT, "minecraft:armor_stand"); ++ } ++ } ++ + @Override + public boolean isInvisible() { -+ return invisible != null && invisible; ++ return entityTag != null && entityTag.contains(INVISIBLE.NBT) && entityTag.getBoolean(INVISIBLE.NBT); + } + + @Override + public boolean hasNoBasePlate() { -+ return noBasePlate != null && noBasePlate; ++ return entityTag != null && entityTag.contains(NO_BASE_PLATE.NBT) && entityTag.getBoolean(NO_BASE_PLATE.NBT); + } + + @Override + public boolean shouldShowArms() { -+ return showArms != null && showArms; ++ return entityTag != null && entityTag.contains(SHOW_ARMS.NBT) && entityTag.getBoolean(SHOW_ARMS.NBT); + } + + @Override + public boolean isSmall() { -+ return small != null && small; ++ return entityTag != null && entityTag.contains(SMALL.NBT) && entityTag.getBoolean(SMALL.NBT); + } + + @Override + public boolean isMarker() { -+ return marker != null && marker; ++ return entityTag != null && entityTag.contains(MARKER.NBT) && entityTag.getBoolean(MARKER.NBT); + } + + @Override + public void setInvisible(boolean invisible) { -+ this.invisible = invisible; ++ populateTagIfNull(); ++ entityTag.putBoolean(INVISIBLE.NBT, invisible); + } + + @Override + public void setNoBasePlate(boolean noBasePlate) { -+ this.noBasePlate = noBasePlate; ++ populateTagIfNull(); ++ entityTag.putBoolean(NO_BASE_PLATE.NBT, noBasePlate); + } + + @Override + public void setShowArms(boolean showArms) { -+ this.showArms = showArms; ++ populateTagIfNull(); ++ entityTag.putBoolean(SHOW_ARMS.NBT, showArms); + } + + @Override + public void setSmall(boolean small) { -+ this.small = small; ++ populateTagIfNull(); ++ entityTag.putBoolean(SMALL.NBT, small); + } + + @Override + public void setMarker(boolean marker) { -+ this.marker = marker; ++ populateTagIfNull(); ++ entityTag.putBoolean(MARKER.NBT, marker); + } + // Paper end } diff --git a/patches/server/0192-WitchReadyPotionEvent.patch b/patches/server/0192-WitchReadyPotionEvent.patch index 56d606d8f3..8cad7e4409 100644 --- a/patches/server/0192-WitchReadyPotionEvent.patch +++ b/patches/server/0192-WitchReadyPotionEvent.patch @@ -22,10 +22,10 @@ index a14e00d55930628333cc63b18727ea56dbdc4ee3..f6d01d21745391595d61b191832be4c2 this.setUsingItem(true); if (!this.isSilent()) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b5b237c56575e8ceb3e6471deec1e7712891a8e0..cfdabb93c2d30845af9108552ed9bee9929250ce 100644 +index 91180d7ad705ca97c0df43debc14b204127165d0..e3af0db8082e4e90902197f96f1c833405bf5f63 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1960,4 +1960,14 @@ public class CraftEventFactory { +@@ -1976,4 +1976,14 @@ public class CraftEventFactory { ).callEvent(); } // Paper end - PlayerUseUnknownEntityEvent diff --git a/patches/server/0202-Add-entity-knockback-events.patch b/patches/server/0202-Add-entity-knockback-events.patch index f6ab3bd4fe..699b9c9703 100644 --- a/patches/server/0202-Add-entity-knockback-events.patch +++ b/patches/server/0202-Add-entity-knockback-events.patch @@ -93,10 +93,10 @@ index cccc60602360f25f0aeddbd16dad2bb63a1728a8..ada79af49d1cafe25ca6c1fb456e1c4c } } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 55aecada617bd84676928a7818f1511b2d85e7bf..f56d431207323a80b7f566ac6e30eebf232ee695 100644 +index 62c3b3d992aff2aa20857e2b3bee464a377a0857..25a71cc5ca8cf8a5070cd24eb56fe0d79e765669 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1691,7 +1691,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1695,7 +1695,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (f1 > 0.0F && target instanceof LivingEntity) { LivingEntity entityliving = (LivingEntity) target; @@ -273,10 +273,10 @@ index 6476c644d3da824c5ee4190cb45cde678ff1188f..b216140a8be65e210250358af8daf493 // CraftBukkit end entity.setDeltaMovement(entity.getDeltaMovement().add(vec3d1)); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index cfdabb93c2d30845af9108552ed9bee9929250ce..e1b7bd5c23ba79b84ad257b7fb45e251da3978e5 100644 +index e3af0db8082e4e90902197f96f1c833405bf5f63..3059a21b554db99af96c76f72dd08591c00e3e08 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1922,19 +1922,33 @@ public class CraftEventFactory { +@@ -1938,19 +1938,33 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch b/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch index c9acef0191..0d69ebd2b4 100644 --- a/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/patches/server/0206-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -5,17 +5,19 @@ Subject: [PATCH] Add config to disable ender dragon legacy check diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 1a56247191172622f2bde6d799bc44f70b9ce3ae..6f9c78b124a33212125e98905efc8a09a1891500 100644 +index 1a56247191172622f2bde6d799bc44f70b9ce3ae..93337fd026fefb76c8a288674fed05cb3c1eca38 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -106,6 +106,10 @@ public class EndDragonFight { - this.ticksSinceLastPlayerScan = 21; - this.skipArenaLoadedCheck = false; - this.needsStateScanning = true; +@@ -116,6 +116,12 @@ public class EndDragonFight { + if (data.isRespawning) { + this.respawnStage = DragonRespawnAnimation.START; + } + // Paper start - Add config to disable ender dragon legacy check -+ this.needsStateScanning = world.paperConfig().entities.spawning.scanForLegacyEnderDragon; -+ if (!this.needsStateScanning) this.dragonKilled = true; ++ if (data == EndDragonFight.Data.DEFAULT && !world.paperConfig().entities.spawning.scanForLegacyEnderDragon) { ++ this.needsStateScanning = false; ++ this.dragonKilled = true; ++ } + // Paper end - Add config to disable ender dragon legacy check - this.level = world; - this.origin = origin; - this.validPlayer = EntitySelector.ENTITY_STILL_ALIVE.and(EntitySelector.withinDistance((double) origin.getX(), (double) (128 + origin.getY()), (double) origin.getZ(), 192.0D)); + + this.portalLocation = (BlockPos) data.exitPortalLocation.orElse(null); // CraftBukkit - decompile error + this.gateways.addAll((Collection) data.gateways.orElseGet(() -> { diff --git a/patches/server/0208-InventoryCloseEvent-Reason-API.patch b/patches/server/0208-InventoryCloseEvent-Reason-API.patch index 04cfe0f0de..6e38650f62 100644 --- a/patches/server/0208-InventoryCloseEvent-Reason-API.patch +++ b/patches/server/0208-InventoryCloseEvent-Reason-API.patch @@ -75,7 +75,7 @@ index fb5130b6378554ccb23fb7992e408497ca093ff3..0dee94f1dd27a0d7e709367450c5ef79 this.doCloseContainer(); } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 72edfb965aca81c2d2442b794b42baa04ec713b3..a954d3b0ff0917d857002dba70c54b3fcdf77943 100644 +index 0073c6c5433be3193a01257a26c7035e544f37dd..0321128ab745250e79fa5f66079c9aeb7f394cc0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -2619,10 +2619,15 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -178,10 +178,10 @@ index 4e5dba1da323f12d77a36635c9227b1239856254..12c61db6d4b1284765f9bed3ae26131a // Check if the fromWorld and toWorld are the same. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 9225746382bcecb0bab655a8232fecc09169225d..bf3995795295c3224db97e4d6809c0f5da6ce55c 100644 +index 3059a21b554db99af96c76f72dd08591c00e3e08..9b6607700ed23b97755a2171a49b22d498a60626 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1281,7 +1281,7 @@ public class CraftEventFactory { +@@ -1283,7 +1283,7 @@ public class CraftEventFactory { public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container, boolean cancelled) { if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open @@ -190,7 +190,7 @@ index 9225746382bcecb0bab655a8232fecc09169225d..bf3995795295c3224db97e4d6809c0f5 } CraftServer server = player.level().getCraftServer(); -@@ -1477,8 +1477,18 @@ public class CraftEventFactory { +@@ -1479,8 +1479,18 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0217-Vanished-players-don-t-have-rights.patch b/patches/server/0217-Vanished-players-don-t-have-rights.patch index 3ee31bb1d3..5820c721da 100644 --- a/patches/server/0217-Vanished-players-don-t-have-rights.patch +++ b/patches/server/0217-Vanished-players-don-t-have-rights.patch @@ -89,10 +89,10 @@ index a9227581ec78a56e96dc3a342006e4a649906326..5929b450a26e7c3cf63de3dc1d0e67cb public boolean isClientSide() { return this.isClientSide; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ad271871b207b425ef8d599fe74a67d065d66686..d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223 100644 +index 9b6607700ed23b97755a2171a49b22d498a60626..0613bdf3c2325d5cab64783af7211b07fcf5124a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1327,6 +1327,14 @@ public class CraftEventFactory { +@@ -1329,6 +1329,14 @@ public class CraftEventFactory { Projectile projectile = (Projectile) entity.getBukkitEntity(); org.bukkit.entity.Entity collided = position.getEntity().getBukkitEntity(); com.destroystokyo.paper.event.entity.ProjectileCollideEvent event = new com.destroystokyo.paper.event.entity.ProjectileCollideEvent(projectile, collided); diff --git a/patches/server/0243-Improve-death-events.patch b/patches/server/0243-Improve-death-events.patch index 235279b5fe..32eb4bc818 100644 --- a/patches/server/0243-Improve-death-events.patch +++ b/patches/server/0243-Improve-death-events.patch @@ -19,7 +19,7 @@ public net.minecraft.world.entity.LivingEntity getDeathSound()Lnet/minecraft/sou public net.minecraft.world.entity.LivingEntity getSoundVolume()F diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index a3a1450949703851625bbb257e92b3be4d79a06a..ff3f70b8c266dc3b2ab374ffd6905ecbfe8510be 100644 +index 0dee94f1dd27a0d7e709367450c5ef7956e27217..fa8640f961b93dc811296131dfda58faa1908add 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -269,6 +269,10 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -80,7 +80,7 @@ index a3a1450949703851625bbb257e92b3be4d79a06a..ff3f70b8c266dc3b2ab374ffd6905ecb } } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41c27bd933 100644 +index 39dff0a38b53624c935f27cc86ff036c831f407f..bdee5725029eda3a0e7bee407286480c0bb47db1 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -283,6 +283,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -229,10 +229,10 @@ index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41 public int getExpReward(@Nullable Entity entity) { // CraftBukkit Level world = this.level(); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85f16b14cb 100644 +index 25a71cc5ca8cf8a5070cd24eb56fe0d79e765669..b46572f6e3b52f498b395d3b8c5def2aa799ff03 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1119,6 +1119,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1123,6 +1123,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @@ -245,7 +245,7 @@ index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85 @Override protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { super.dropCustomDeathLoot(world, source, causedByPlayer); -@@ -1127,6 +1133,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1131,6 +1137,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab for (int j = 0; j < i; ++j) { EquipmentSlot enumitemslot = aenumitemslot[j]; @@ -253,7 +253,7 @@ index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85 ItemStack itemstack = this.getItemBySlot(enumitemslot); float f = this.getEquipmentDropChance(enumitemslot); -@@ -1151,7 +1158,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1155,7 +1162,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } this.spawnAtLocation(itemstack); @@ -423,7 +423,7 @@ index ee3902cbada46ffb78c42dbf6f00c859546c76e1..92bb0c63330ad3a4cb13b2dc65502071 // CraftBukkit end this.gameEvent(GameEvent.ENTITY_DIE); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 92f9502a2d5721ebb1757a069a0f138db66628d7..6c5bd88777ff79c7408cf5ffed0f099a79e5429a 100644 +index a7e611aaeb457820ad303b95822d8ea86b060477..004ac565d4124f6059d530034cf0c9a28f0be467 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2517,7 +2517,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -443,10 +443,10 @@ index 92f9502a2d5721ebb1757a069a0f138db66628d7..6c5bd88777ff79c7408cf5ffed0f099a public void injectScaledMaxHealth(Collection collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223..a9a2b35378d6654ba00a48737f596553445214aa 100644 +index 0613bdf3c2325d5cab64783af7211b07fcf5124a..6a018f9c289a539b07855d75e4cc2d3c2828ded1 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -901,9 +901,16 @@ public class CraftEventFactory { +@@ -903,9 +903,16 @@ public class CraftEventFactory { CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); @@ -463,7 +463,7 @@ index d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223..a9a2b35378d6654ba00a48737f596553 victim.expToDrop = event.getDroppedExp(); for (org.bukkit.inventory.ItemStack stack : event.getDrops()) { -@@ -921,7 +928,14 @@ public class CraftEventFactory { +@@ -923,7 +930,14 @@ public class CraftEventFactory { PlayerDeathEvent event = new PlayerDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity()), 0, deathMessage); event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel @@ -478,7 +478,7 @@ index d1b473ef83df0ed4ae7cd9dd0525dac5e8a41223..a9a2b35378d6654ba00a48737f596553 victim.keepLevel = event.getKeepLevel(); victim.newLevel = event.getNewLevel(); -@@ -944,6 +958,31 @@ public class CraftEventFactory { +@@ -946,6 +960,31 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0270-Book-size-limits.patch b/patches/server/0270-Book-size-limits.patch index f4a8924ba4..de9ce90396 100644 --- a/patches/server/0270-Book-size-limits.patch +++ b/patches/server/0270-Book-size-limits.patch @@ -5,38 +5,58 @@ Subject: [PATCH] Book size limits Puts some limits on the size of books. +diff --git a/src/main/java/net/minecraft/network/protocol/game/ServerboundEditBookPacket.java b/src/main/java/net/minecraft/network/protocol/game/ServerboundEditBookPacket.java +index ed61767a64cdce37dc7c226ebd0d693a60de24a9..f634a830a2b58a419e84f969bd53eeae4f4513bb 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/ServerboundEditBookPacket.java ++++ b/src/main/java/net/minecraft/network/protocol/game/ServerboundEditBookPacket.java +@@ -16,9 +16,9 @@ public record ServerboundEditBookPacket(int slot, List pages, Optional STREAM_CODEC = StreamCodec.composite( + ByteBufCodecs.VAR_INT, + ServerboundEditBookPacket::slot, +- ByteBufCodecs.stringUtf8(8192).apply(ByteBufCodecs.list(200)), ++ ByteBufCodecs.stringUtf8(net.minecraft.world.item.component.WritableBookContent.PAGE_EDIT_LENGTH).apply(ByteBufCodecs.list(net.minecraft.world.item.component.WritableBookContent.MAX_PAGES)), // Paper - limit books + ServerboundEditBookPacket::pages, +- ByteBufCodecs.stringUtf8(128).apply(ByteBufCodecs::optional), ++ ByteBufCodecs.stringUtf8(net.minecraft.world.item.component.WrittenBookContent.TITLE_MAX_LENGTH).apply(ByteBufCodecs::optional), // Paper - limit books + ServerboundEditBookPacket::title, + ServerboundEditBookPacket::new + ); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2e35c6cfdf0cded5adc9f512612faaa68876961c..d69b678b2611f3d1b1ef64541863256868969671 100644 +index ce06a41d98bafc878918507404bd5d6cabc45776..d8f940016b68f488b5061d2826607c0db7e8f852 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1043,6 +1043,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1043,6 +1043,44 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleEditBook(ServerboundEditBookPacket packet) { + // Paper start - Book size limits -+ if (!this.cserver.isPrimaryThread()) { -+ List pageList = packet.pages(); ++ final io.papermc.paper.configuration.type.number.IntOr.Disabled pageMax = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; ++ if (!this.cserver.isPrimaryThread() && pageMax.enabled()) { ++ final List pageList = packet.pages(); + long byteTotal = 0; -+ int maxBookPageSize = io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.pageMax; -+ double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D); ++ final int maxBookPageSize = pageMax.intValue(); ++ final double multiplier = Math.clamp(io.papermc.paper.configuration.GlobalConfiguration.get().itemValidation.bookSize.totalMultiplier, 0.3D, 1D); + long byteAllowed = maxBookPageSize; -+ for (String testString : pageList) { -+ int byteLength = testString.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; ++ for (final String page : pageList) { ++ final int byteLength = page.getBytes(java.nio.charset.StandardCharsets.UTF_8).length; + byteTotal += byteLength; -+ int length = testString.length(); -+ int multibytes = 0; ++ final int length = page.length(); ++ int multiByteCharacters = 0; + if (byteLength != length) { -+ for (char c : testString.toCharArray()) { ++ // Count the number of multi byte characters ++ for (final char c : page.toCharArray()) { + if (c > 127) { -+ multibytes++; ++ multiByteCharacters++; + } + } + } ++ ++ // Allow pages with fewer characters to consume less of the allowed byte quota + byteAllowed += maxBookPageSize * Math.clamp((double) length / 255D, 0.1D, 1) * multiplier; + -+ if (multibytes > 1) { -+ // penalize MB -+ byteAllowed -= multibytes; ++ if (multiByteCharacters > 1) { ++ // Penalize multibyte characters ++ byteAllowed -= multiByteCharacters; + } + } + diff --git a/patches/server/0279-Limit-Client-Sign-length-more.patch b/patches/server/0279-Limit-Client-Sign-length-more.patch index d24066269f..57e96a49d8 100644 --- a/patches/server/0279-Limit-Client-Sign-length-more.patch +++ b/patches/server/0279-Limit-Client-Sign-length-more.patch @@ -22,7 +22,7 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1c91e1812e536bb59dbb37aec47afca1d59ffa8d..e78a6234d6699e7f14c5ac7faa7d1ee60e46d7f9 100644 +index 33a7aaf8c6b73b1732465125edd43cce06da7dc9..88fa94f33e5939bc8a5acb20f48ad5bdf35c2ada 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -299,6 +299,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -33,7 +33,7 @@ index 1c91e1812e536bb59dbb37aec47afca1d59ffa8d..e78a6234d6699e7f14c5ac7faa7d1ee6 public ServerGamePacketListenerImpl(MinecraftServer server, Connection connection, ServerPlayer player, CommonListenerCookie clientData) { super(server, connection, clientData, player); // CraftBukkit -@@ -3146,7 +3147,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3150,7 +3151,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleSignUpdate(ServerboundSignUpdatePacket packet) { diff --git a/patches/server/0281-Fixes-and-additions-to-the-spawn-reason-API.patch b/patches/server/0281-Fixes-and-additions-to-the-spawn-reason-API.patch index 944ab1ff65..a8fda4a8d7 100644 --- a/patches/server/0281-Fixes-and-additions-to-the-spawn-reason-API.patch +++ b/patches/server/0281-Fixes-and-additions-to-the-spawn-reason-API.patch @@ -202,10 +202,10 @@ index dbc0b69603dcffbf3d41d79719aa0f2b7da4a131..dd86f5ec5b2051aeea4e19ff97146362 } diff --git a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java -index 52d71a03cd5b2af56704f265ce5b5f14d3236ebb..ffca6563c20f53c92b162054fec727d83e54e58a 100644 +index c3f6522a7dc0777c5b3fa2bac63a8901f96d9f38..9b336f651ead8111a0b2c0fedad9331f594b2990 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java +++ b/src/main/java/net/minecraft/world/level/block/entity/trialspawner/TrialSpawner.java -@@ -226,6 +226,7 @@ public final class TrialSpawner { +@@ -231,6 +231,7 @@ public final class TrialSpawner { } entity.spawnedViaMobSpawner = true; // Paper diff --git a/patches/server/0283-Add-PlayerPostRespawnEvent.patch b/patches/server/0283-Add-PlayerPostRespawnEvent.patch index 2babd115c1..719434b7d5 100644 --- a/patches/server/0283-Add-PlayerPostRespawnEvent.patch +++ b/patches/server/0283-Add-PlayerPostRespawnEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerPostRespawnEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 8f90e8cd36348089799097807ead774e186c2604..f0cc34002e260567322d7acaf803f43a8b92e563 100644 +index 79203d0e5cdb86d9e2fb22cdaeb8cf3a93e43dcc..a2a913e20cdea9518da5ad0d1ef8908538860890 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -738,6 +738,10 @@ public abstract class PlayerList { @@ -19,15 +19,18 @@ index 8f90e8cd36348089799097807ead774e186c2604..f0cc34002e260567322d7acaf803f43a // CraftBukkit start - fire PlayerRespawnEvent DimensionTransition dimensiontransition; -@@ -745,6 +749,7 @@ public abstract class PlayerList { +@@ -745,6 +749,10 @@ public abstract class PlayerList { dimensiontransition = entityplayer.findRespawnPositionAndUseSpawnBlock(flag, DimensionTransition.DO_NOTHING, reason); if (!flag) entityplayer.reset(); // SPIGOT-4785 -+ isRespawn = true; // Paper - Add PlayerPostRespawnEvent ++ // Paper start - Add PlayerPostRespawnEvent ++ isRespawn = true; ++ location = CraftLocation.toBukkit(dimensiontransition.pos(), dimensiontransition.newLevel().getWorld(), dimensiontransition.yRot(), dimensiontransition.xRot()); ++ // Paper end - Add PlayerPostRespawnEvent } else { dimensiontransition = new DimensionTransition(((CraftWorld) location.getWorld()).getHandle(), CraftLocation.toVec3D(location), Vec3.ZERO, location.getYaw(), location.getPitch(), DimensionTransition.DO_NOTHING); } -@@ -795,6 +800,11 @@ public abstract class PlayerList { +@@ -795,6 +803,11 @@ public abstract class PlayerList { if (iblockdata.is(Blocks.RESPAWN_ANCHOR)) { entityplayer1.connection.send(new ClientboundSoundPacket(SoundEvents.RESPAWN_ANCHOR_DEPLETE, SoundSource.BLOCKS, (double) blockposition.getX(), (double) blockposition.getY(), (double) blockposition.getZ(), 1.0F, 1.0F, worldserver.getRandom().nextLong())); } @@ -39,7 +42,7 @@ index 8f90e8cd36348089799097807ead774e186c2604..f0cc34002e260567322d7acaf803f43a } // Added from changeDimension this.sendAllPlayerInfo(entityplayer); // Update health, etc... -@@ -816,6 +826,13 @@ public abstract class PlayerList { +@@ -816,6 +829,13 @@ public abstract class PlayerList { if (entityplayer.connection.isDisconnected()) { this.save(entityplayer); } diff --git a/patches/server/0321-add-hand-to-BlockMultiPlaceEvent.patch b/patches/server/0321-add-hand-to-BlockMultiPlaceEvent.patch index ca43013242..56eb680f94 100644 --- a/patches/server/0321-add-hand-to-BlockMultiPlaceEvent.patch +++ b/patches/server/0321-add-hand-to-BlockMultiPlaceEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] add hand to BlockMultiPlaceEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a9a2b35378d6654ba00a48737f596553445214aa..7d21f3ec394b53461ca5fb73449b551fbe6e96aa 100644 +index 6a018f9c289a539b07855d75e4cc2d3c2828ded1..e25ca301a4b9b252d3f75013e4e14df9b14aa7b9 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -410,13 +410,18 @@ public class CraftEventFactory { +@@ -412,13 +412,18 @@ public class CraftEventFactory { } org.bukkit.inventory.ItemStack item; diff --git a/patches/server/0349-Fix-item-duplication-and-teleport-issues.patch b/patches/server/0349-Fix-item-duplication-and-teleport-issues.patch index 3482c69ed8..c577f08518 100644 --- a/patches/server/0349-Fix-item-duplication-and-teleport-issues.patch +++ b/patches/server/0349-Fix-item-duplication-and-teleport-issues.patch @@ -16,7 +16,7 @@ So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index d80fd4e2f41583f83c9527ccf4ce80afe851276a..bd5291ca4680572d2c5f3cec1231b1a3dcf72fa8 100644 +index d80fd4e2f41583f83c9527ccf4ce80afe851276a..10015beb7a2de890fe27bffde8f55c1dd78ce344 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2515,11 +2515,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -52,8 +52,8 @@ index d80fd4e2f41583f83c9527ccf4ce80afe851276a..bd5291ca4680572d2c5f3cec1231b1a3 if (entity2 != null) { if (this != entity2) { + // Paper start - Fix item duplication and teleport issues -+ if (this instanceof Mob) { -+ ((Mob) this).dropLeash(true, true); // Paper drop lead ++ if (this instanceof Leashable leashable) { ++ leashable.dropLeash(true, true); // Paper drop lead + } + // Paper end - Fix item duplication and teleport issues entity2.restoreFrom(this); @@ -69,7 +69,7 @@ index d80fd4e2f41583f83c9527ccf4ce80afe851276a..bd5291ca4680572d2c5f3cec1231b1a3 public float getBlockExplosionResistance(Explosion explosion, BlockGetter world, BlockPos pos, BlockState blockState, FluidState fluidState, float max) { diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index f2e66b50b32d197f9a8d4a9672ebf1413e66d59b..fe73a6728de0fad50451d3090002b6c0421d4c43 100644 +index 926c8fd21bb610dc07658c41431a7795ba4f2870..c0bbeaa4a37c1ba9f5125a0c68f4511aac6a0e71 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1728,9 +1728,9 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -124,10 +124,10 @@ index 92bb0c63330ad3a4cb13b2dc655020714e9b1ffd..cc1189c2d7dc57ba8f29aad4ba5d2a07 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 7d21f3ec394b53461ca5fb73449b551fbe6e96aa..408f677337759f529fa41f6ba2b516b71a7940f1 100644 +index e25ca301a4b9b252d3f75013e4e14df9b14aa7b9..9548ee5b43458ccc865f800d1f1b69245a821658 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -903,6 +903,11 @@ public class CraftEventFactory { +@@ -905,6 +905,11 @@ public class CraftEventFactory { } public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource, List drops) { @@ -139,7 +139,7 @@ index 7d21f3ec394b53461ca5fb73449b551fbe6e96aa..408f677337759f529fa41f6ba2b516b7 CraftLivingEntity entity = (CraftLivingEntity) victim.getBukkitEntity(); CraftDamageSource bukkitDamageSource = new CraftDamageSource(damageSource); EntityDeathEvent event = new EntityDeathEvent(entity, bukkitDamageSource, drops, victim.getExpReward(damageSource.getEntity())); -@@ -917,11 +922,13 @@ public class CraftEventFactory { +@@ -919,11 +924,13 @@ public class CraftEventFactory { playDeathSound(victim, event); // Paper end victim.expToDrop = event.getDroppedExp(); diff --git a/patches/server/0354-Prevent-teleporting-dead-entities.patch b/patches/server/0354-Prevent-teleporting-dead-entities.patch index 4eb4569139..64b5e3f936 100644 --- a/patches/server/0354-Prevent-teleporting-dead-entities.patch +++ b/patches/server/0354-Prevent-teleporting-dead-entities.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent teleporting dead entities diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 2fb31c0223f2638de0ebec170095fa20991738ff..e62415cf6a13634f85289c875092bb706c316fd3 100644 +index 5dcb459b7ae7f31375e982501e7f16beb913114f..175fef59a8853727e58ba48e46009df17d8e7b6e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1548,6 +1548,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1552,6 +1552,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { // Paper diff --git a/patches/server/0357-ExperienceOrb-merging-stacking-API-and-fixes.patch b/patches/server/0357-ExperienceOrb-merging-stacking-API-and-fixes.patch index 6d45bdaa2f..3ebf6e2165 100644 --- a/patches/server/0357-ExperienceOrb-merging-stacking-API-and-fixes.patch +++ b/patches/server/0357-ExperienceOrb-merging-stacking-API-and-fixes.patch @@ -77,10 +77,10 @@ index 5a7d314ec0562e472f5dc45924a7b24841cff126..650e4a01cecc4cc08e7ff9ebcc4c3670 public java.util.UUID getTriggerEntityId() { return getHandle().triggerEntityId; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 408f677337759f529fa41f6ba2b516b71a7940f1..1177a9310f686f3b4d75a713cdac75c5628e8bbb 100644 +index 9548ee5b43458ccc865f800d1f1b69245a821658..752aba27c3eb9815bdd2b4683483c70e891711e7 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -712,15 +712,29 @@ public class CraftEventFactory { +@@ -714,15 +714,29 @@ public class CraftEventFactory { if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) { double radius = world.spigotConfig.expMerge; if (radius > 0) { diff --git a/patches/server/0369-Prevent-position-desync-causing-tp-exploit.patch b/patches/server/0369-Prevent-position-desync-causing-tp-exploit.patch index d6354e0fa5..4e1569de2e 100644 --- a/patches/server/0369-Prevent-position-desync-causing-tp-exploit.patch +++ b/patches/server/0369-Prevent-position-desync-causing-tp-exploit.patch @@ -13,10 +13,10 @@ behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e62415cf6a13634f85289c875092bb706c316fd3..d93415023bed72d736f625977ca3e21497bc8f74 100644 +index 175fef59a8853727e58ba48e46009df17d8e7b6e..c466e405b123ddcd3abe931f83930369ab668b90 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1345,6 +1345,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1349,6 +1349,11 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move diff --git a/patches/server/0371-Add-PlayerRecipeBookClickEvent.patch b/patches/server/0371-Add-PlayerRecipeBookClickEvent.patch index e5ffda1446..0ae3b66096 100644 --- a/patches/server/0371-Add-PlayerRecipeBookClickEvent.patch +++ b/patches/server/0371-Add-PlayerRecipeBookClickEvent.patch @@ -5,10 +5,10 @@ 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 d93415023bed72d736f625977ca3e21497bc8f74..d003494e741b97cbb8541d3132c7c448219e8ced 100644 +index c466e405b123ddcd3abe931f83930369ab668b90..bba23db382a99ea3456bd6aefc437d9f4077705a 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3053,16 +3053,40 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3057,16 +3057,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 { diff --git a/patches/server/0375-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/patches/server/0375-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index d0a4c576b7..661ddc7971 100644 --- a/patches/server/0375-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/patches/server/0375-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -76,10 +76,10 @@ index d6dc8c983d26ce89f17a990be4284fdc78ad164b..2b1d7a2360a9ee7bca9d93a2dc8c61d1 @Override diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index dae64538b34c7cc7d1af0f58e3a150c7f5e3c1c9..19f49465cfc80c1cf36755f24aa246e0656da75a 100644 +index 15db3eaaab7471e6dde0a4f0d6ca2a1c38a3eb2d..0db5407cdf08d63e520db9b847bc9fcae8f585c7 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3256,7 +3256,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3260,7 +3260,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleChangeDifficulty(ServerboundChangeDifficultyPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.hasPermissions(2) || this.isSingleplayerOwner()) { @@ -89,7 +89,7 @@ index dae64538b34c7cc7d1af0f58e3a150c7f5e3c1c9..19f49465cfc80c1cf36755f24aa246e0 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c2ccd10efd5096b2683fe235de1e8176ee7d2083..ebe69ce183b8bba43ed4d6fdbac09fdc1eaaa988 100644 +index 1b3f1b06155e114cd5ab76a406c1b4e745ef58c6..52e8664f8d0368daed43e349aa67e3b295697f26 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -996,8 +996,8 @@ public final class CraftServer implements Server { diff --git a/patches/server/0381-Do-not-accept-invalid-client-settings.patch b/patches/server/0381-Do-not-accept-invalid-client-settings.patch index 9760be5dbe..5cdf534c94 100644 --- a/patches/server/0381-Do-not-accept-invalid-client-settings.patch +++ b/patches/server/0381-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 19f49465cfc80c1cf36755f24aa246e0656da75a..19f13d845467364a25417ac8fd6404f16e18eaa2 100644 +index 0db5407cdf08d63e520db9b847bc9fcae8f585c7..f0e60add7df4d00ee5b84164a532b75f9d90cfa8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3248,6 +3248,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3252,6 +3252,13 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handleClientInformation(ServerboundClientInformationPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); diff --git a/patches/server/0384-Add-PrepareResultEvent.patch b/patches/server/0384-Add-PrepareResultEvent.patch index 24f55e8025..ffb4806752 100644 --- a/patches/server/0384-Add-PrepareResultEvent.patch +++ b/patches/server/0384-Add-PrepareResultEvent.patch @@ -94,10 +94,10 @@ index 30ea1f9e97db86a2ad7baeea4f5a76c821874daa..5b4f03128499b0c1a4b8c5f5ccd17e4b private static SingleRecipeInput createRecipeInput(Container inventory) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 1177a9310f686f3b4d75a713cdac75c5628e8bbb..838ad7bc8a7488adf52d462e1a3f2faa275bebd0 100644 +index 752aba27c3eb9815bdd2b4683483c70e891711e7..44fd82bf887e5c6d946d7eed18e21f966efda9de 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1679,6 +1679,12 @@ public class CraftEventFactory { +@@ -1681,6 +1681,12 @@ public class CraftEventFactory { } public static PrepareAnvilEvent callPrepareAnvilEvent(AnvilView view, ItemStack item) { @@ -110,7 +110,7 @@ index 1177a9310f686f3b4d75a713cdac75c5628e8bbb..838ad7bc8a7488adf52d462e1a3f2faa PrepareAnvilEvent event = new PrepareAnvilEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -1686,6 +1692,12 @@ public class CraftEventFactory { +@@ -1688,6 +1694,12 @@ public class CraftEventFactory { } public static PrepareGrindstoneEvent callPrepareGrindstoneEvent(InventoryView view, ItemStack item) { @@ -123,7 +123,7 @@ index 1177a9310f686f3b4d75a713cdac75c5628e8bbb..838ad7bc8a7488adf52d462e1a3f2faa PrepareGrindstoneEvent event = new PrepareGrindstoneEvent(view, CraftItemStack.asCraftMirror(item).clone()); event.getView().getPlayer().getServer().getPluginManager().callEvent(event); event.getInventory().setItem(2, event.getResult()); -@@ -1693,12 +1705,39 @@ public class CraftEventFactory { +@@ -1695,12 +1707,39 @@ public class CraftEventFactory { } public static PrepareSmithingEvent callPrepareSmithingEvent(InventoryView view, ItemStack item) { diff --git a/patches/server/0401-Add-BellRingEvent.patch b/patches/server/0401-Add-BellRingEvent.patch index 1e306374a2..b774d09a82 100644 --- a/patches/server/0401-Add-BellRingEvent.patch +++ b/patches/server/0401-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 a3e359d174e4c175e49a6e7c03cbca0661cf8b34..2596159784a6ae0502b9a1b5a7cc573966021380 100644 +index 44fd82bf887e5c6d946d7eed18e21f966efda9de..241e6527575c6d6b4facbd3ae1e4a8b65708e397 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -376,10 +376,11 @@ public class CraftEventFactory { +@@ -378,10 +378,11 @@ public class CraftEventFactory { return tradeSelectEvent; } diff --git a/patches/server/0406-Add-methods-to-get-translation-keys.patch b/patches/server/0406-Add-methods-to-get-translation-keys.patch index b6719466b9..5b5a9288df 100644 --- a/patches/server/0406-Add-methods-to-get-translation-keys.patch +++ b/patches/server/0406-Add-methods-to-get-translation-keys.patch @@ -42,21 +42,27 @@ index 338a8f4acf413ef24fedab60c19c7a51a0ea19a6..2d8a509446c0ed0d7358f10f67ef29c4 + // Paper end - add Translatable } diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index f73017bff613bd62b86c974b29576e241c24c927..fc6606e1bf2e2c35cb6c84af78859c3441775907 100644 +index f73017bff613bd62b86c974b29576e241c24c927..59c9c970b83f62245d860994c4ac0c21dcc15398 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -@@ -150,6 +150,11 @@ public class CraftEnchantment extends Enchantment implements Handleable 1.0D) { -@@ -1305,9 +1323,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1309,9 +1327,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl AABB axisalignedbb = this.player.getBoundingBox(); diff --git a/patches/server/0428-Toggle-for-removing-existing-dragon.patch b/patches/server/0428-Toggle-for-removing-existing-dragon.patch index 1bfa511969..23aadb86ee 100644 --- a/patches/server/0428-Toggle-for-removing-existing-dragon.patch +++ b/patches/server/0428-Toggle-for-removing-existing-dragon.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Toggle for removing existing dragon diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 79b63082e849f29244352b9d0d6ac9b7df7813f6..3ea0ca395e0561d96044f0f84442a08b42b539bd 100644 +index f90d637e5477275b870c1a1963774de04aaa218d..943d9f84ad839562a4e30fff1257a1224d0b70b6 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -209,7 +209,7 @@ public class EndDragonFight { +@@ -211,7 +211,7 @@ public class EndDragonFight { this.dragonUUID = entityenderdragon.getUUID(); EndDragonFight.LOGGER.info("Found that there's a dragon still alive ({})", entityenderdragon); this.dragonKilled = false; diff --git a/patches/server/0443-Limit-recipe-packets.patch b/patches/server/0443-Limit-recipe-packets.patch index 8b3e4ef5c1..5ec90fce7f 100644 --- a/patches/server/0443-Limit-recipe-packets.patch +++ b/patches/server/0443-Limit-recipe-packets.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Limit recipe packets diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ffdd7c427bf563b1d87d65586b125fd081e73dd8..cdf29c17cac7a5bcfcd12d6e306efad0bc87a382 100644 +index 172a1acdbdfb639ca4fc6f880570a7829c8b3d45..4bc7ca9ec9eecf3172cf2140a7d2a07c7c708482 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -266,6 +266,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -24,7 +24,7 @@ index ffdd7c427bf563b1d87d65586b125fd081e73dd8..cdf29c17cac7a5bcfcd12d6e306efad0 /* Use thread-safe field access instead if (this.chatSpamTickCount > 0) { --this.chatSpamTickCount; -@@ -3065,6 +3067,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3069,6 +3071,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void handlePlaceRecipe(ServerboundPlaceRecipePacket packet) { diff --git a/patches/server/0448-Add-OBSTRUCTED-reason-to-BedEnterResult.patch b/patches/server/0448-Add-OBSTRUCTED-reason-to-BedEnterResult.patch index e2b1ac7753..11a90a4f27 100644 --- a/patches/server/0448-Add-OBSTRUCTED-reason-to-BedEnterResult.patch +++ b/patches/server/0448-Add-OBSTRUCTED-reason-to-BedEnterResult.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add OBSTRUCTED reason to BedEnterResult diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2596159784a6ae0502b9a1b5a7cc573966021380..2be5135d3e17c3344ffbdb3f2f55d45eb6753c61 100644 +index 241e6527575c6d6b4facbd3ae1e4a8b65708e397..f4a1f96340f8521bc2fecfb2565f7cc8c6453d47 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -311,6 +311,10 @@ public class CraftEventFactory { +@@ -313,6 +313,10 @@ public class CraftEventFactory { return BedEnterResult.TOO_FAR_AWAY; case NOT_SAFE: return BedEnterResult.NOT_SAFE; diff --git a/patches/server/0458-Fix-interact-event-not-being-called-sometimes.patch b/patches/server/0458-Fix-interact-event-not-being-called-sometimes.patch index 50207db6c0..0a9de441a9 100644 --- a/patches/server/0458-Fix-interact-event-not-being-called-sometimes.patch +++ b/patches/server/0458-Fix-interact-event-not-being-called-sometimes.patch @@ -11,10 +11,10 @@ Subject: [PATCH] Fix interact event not being called sometimes Co-authored-by: Moulberry diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index cdf29c17cac7a5bcfcd12d6e306efad0bc87a382..afed142d5155c178807c6b26cb5766ae7d6e328a 100644 +index 4bc7ca9ec9eecf3172cf2140a7d2a07c7c708482..b96490d16d9a38be14d6777213d883f2223fd5a4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1766,7 +1766,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1770,7 +1770,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl MutableComponent ichatmutablecomponent = Component.translatable("build.tooHigh", i - 1).withStyle(ChatFormatting.RED); this.player.sendSystemMessage(ichatmutablecomponent, true); @@ -23,7 +23,7 @@ index cdf29c17cac7a5bcfcd12d6e306efad0bc87a382..afed142d5155c178807c6b26cb5766ae this.player.swing(enumhand, true); } } -@@ -2387,13 +2387,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2391,13 +2391,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d3 = Math.max(this.player.blockInteractionRange(), this.player.entityInteractionRange()); // SPIGOT-5607: Only call interact event if no block or entity is being clicked. Use bukkit ray trace method, because it handles blocks and entities at the same time // SPIGOT-7429: Make sure to call PlayerInteractEvent for spectators and non-pickable entities diff --git a/patches/server/0465-Add-BlockFailedDispenseEvent.patch b/patches/server/0465-Add-BlockFailedDispenseEvent.patch index 2b4d4bdeac..7fd4f0505f 100644 --- a/patches/server/0465-Add-BlockFailedDispenseEvent.patch +++ b/patches/server/0465-Add-BlockFailedDispenseEvent.patch @@ -32,10 +32,10 @@ index a08e8571f3a83afc80c2f1758a9029cd28ed6947..91b514967405115f22edf4255775361a } else { ItemStack itemstack = tileentitydispenser.getItem(i); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2be5135d3e17c3344ffbdb3f2f55d45eb6753c61..c01d4302e145c779cc4031927ab555e1c7748155 100644 +index f4a1f96340f8521bc2fecfb2565f7cc8c6453d47..c5166b0876eb925d30803277beb181ee01120586 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -2111,4 +2111,12 @@ public class CraftEventFactory { +@@ -2127,4 +2127,12 @@ public class CraftEventFactory { return org.bukkit.craftbukkit.inventory.CraftItemStack.asNMSCopy(event.getPotion()); } // Paper end - WitchReadyPotionEvent diff --git a/patches/server/0467-Add-PlayerLoomPatternSelectEvent.patch b/patches/server/0467-Add-PlayerLoomPatternSelectEvent.patch index fbbc2f6ae8..f7032ecdde 100644 --- a/patches/server/0467-Add-PlayerLoomPatternSelectEvent.patch +++ b/patches/server/0467-Add-PlayerLoomPatternSelectEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add PlayerLoomPatternSelectEvent diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -index 2de558dd205a1078fdcac1bce256d059b9bf5d5f..f76ef029132c6a08d4e70585bc440eccdc626b16 100644 +index 2de558dd205a1078fdcac1bce256d059b9bf5d5f..dc23b646e55bb66e0aa584d82b75b4b3d233276a 100644 --- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java +++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java @@ -174,8 +174,32 @@ public class LoomMenu extends AbstractContainerMenu { @@ -16,7 +16,7 @@ index 2de558dd205a1078fdcac1bce256d059b9bf5d5f..f76ef029132c6a08d4e70585bc440ecc - this.setupResultSlot((Holder) this.selectablePatterns.get(id)); + // Paper start - Add PlayerLoomPatternSelectEvent + int selectablePatternIndex = id; -+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.craftbukkit.block.banner.CraftPatternType.minecraftHolderToBukkit((this.selectablePatterns.get(selectablePatternIndex)))); ++ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.craftbukkit.block.banner.CraftPatternType.minecraftHolderToBukkit(this.selectablePatterns.get(selectablePatternIndex))); + if (!event.callEvent()) { + player.containerMenu.sendAllDataToRemote(); + return false; diff --git a/patches/server/0472-Add-sendOpLevel-API.patch b/patches/server/0472-Add-sendOpLevel-API.patch index d1c8e24cc4..b2851eafe2 100644 --- a/patches/server/0472-Add-sendOpLevel-API.patch +++ b/patches/server/0472-Add-sendOpLevel-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 44422100246a61f8353f26d5149f3e96c8832fea..3c7d31725c4a5dd7728fa394f88d37a0e493e919 100644 +index 23bd0e0b62fef174b55b5915a44fee32db02c656..7c334ac1ae2a1b14b7570127e775a5e7d7ab2ae7 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1062,6 +1062,11 @@ public abstract class PlayerList { +@@ -1065,6 +1065,11 @@ public abstract class PlayerList { } private void sendPlayerPermissionLevel(ServerPlayer player, int permissionLevel) { @@ -20,7 +20,7 @@ index 44422100246a61f8353f26d5149f3e96c8832fea..3c7d31725c4a5dd7728fa394f88d37a0 if (player.connection != null) { byte b0; -@@ -1076,8 +1081,10 @@ public abstract class PlayerList { +@@ -1079,8 +1084,10 @@ public abstract class PlayerList { player.connection.send(new ClientboundEntityEventPacket(player, b0)); } @@ -32,7 +32,7 @@ index 44422100246a61f8353f26d5149f3e96c8832fea..3c7d31725c4a5dd7728fa394f88d37a0 public boolean isWhiteListed(GameProfile profile) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index a3b1a19fb28dfba93ae04ea0859f744ede1579f6..963ae66acc25602e15134d30d3e496802b17dc41 100644 +index 39e8dff2a1b62b8313b4d87ce8d2fad7516452c3..3bc62788d63e98eb9b2a2b381272b262040dcb5f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -677,6 +677,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0479-Configurable-max-leash-distance.patch b/patches/server/0479-Configurable-max-leash-distance.patch index 404169cae8..d2f544737b 100644 --- a/patches/server/0479-Configurable-max-leash-distance.patch +++ b/patches/server/0479-Configurable-max-leash-distance.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Configurable max leash distance diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java -index 1f2d04a456c383815b0c5ef331471593556fd128..30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6 100644 +index 1f2d04a456c383815b0c5ef331471593556fd128..5c51dd5229689cba459655d488aee59bd159a414 100644 --- a/src/main/java/net/minecraft/world/entity/Leashable.java +++ b/src/main/java/net/minecraft/world/entity/Leashable.java @@ -179,7 +179,7 @@ public interface Leashable { @@ -13,7 +13,20 @@ index 1f2d04a456c383815b0c5ef331471593556fd128..30d7dd9646ba9d6a9396dc140a61eb2c } - if ((double) f > 10.0D) { -+ if ((double) f > entity.level().paperConfig().misc.maxLeashDistance) { // Paper - Configurable max leash distance ++ if ((double) f > entity.level().paperConfig().misc.maxLeashDistance.or(LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance ((Leashable) entity).leashTooFarBehaviour(); } else if ((double) f > 6.0D) { ((Leashable) entity).elasticRangeLeashBehaviour(entity1, f); +diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +index f2d311a5450eb684603580bbf7e9e7fc73fc2f5c..bf2c9134c7d9d5926add36b55e3cfea79e8c8243 100644 +--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +@@ -97,7 +97,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { + @Override + public boolean handleLeashAtDistance(Entity leashHolder, float distance) { + if (this.isInSittingPose()) { +- if (distance > 10.0F) { ++ if (distance > (float) this.level().paperConfig().misc.maxLeashDistance.or(Leashable.LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance + this.dropLeash(true, true); + } + diff --git a/patches/server/0480-Add-BlockPreDispenseEvent.patch b/patches/server/0480-Add-BlockPreDispenseEvent.patch index b60aca7f7d..a2d508ee1c 100644 --- a/patches/server/0480-Add-BlockPreDispenseEvent.patch +++ b/patches/server/0480-Add-BlockPreDispenseEvent.patch @@ -29,10 +29,10 @@ index 91b514967405115f22edf4255775361a672e5c2f..ddecf443df3679e3098eb54edd19585a } else { // CraftBukkit start - Fire event when pushing items into other inventories diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c01d4302e145c779cc4031927ab555e1c7748155..97a17f2b782196b51ebbc6740aad1768fc73f7ba 100644 +index c5166b0876eb925d30803277beb181ee01120586..6cc729446ff21a5718ff01fcea1496c71f77480c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -2118,5 +2118,11 @@ public class CraftEventFactory { +@@ -2134,5 +2134,11 @@ public class CraftEventFactory { io.papermc.paper.event.block.BlockFailedDispenseEvent event = new io.papermc.paper.event.block.BlockFailedDispenseEvent(block); return event.callEvent(); } diff --git a/patches/server/0482-Add-toggle-for-always-placing-the-dragon-egg.patch b/patches/server/0482-Add-toggle-for-always-placing-the-dragon-egg.patch index 2576990e24..39031695e8 100644 --- a/patches/server/0482-Add-toggle-for-always-placing-the-dragon-egg.patch +++ b/patches/server/0482-Add-toggle-for-always-placing-the-dragon-egg.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add toggle for always placing the dragon egg diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 3ea0ca395e0561d96044f0f84442a08b42b539bd..f81dab25fedeed08f4d3ba2d7435e2da526e6056 100644 +index 943d9f84ad839562a4e30fff1257a1224d0b70b6..412838a4eb3d29da5955bf1c279f66a2e7ccad12 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -407,7 +407,7 @@ public class EndDragonFight { +@@ -409,7 +409,7 @@ public class EndDragonFight { this.dragonEvent.setVisible(false); this.spawnExitPortal(true); this.spawnNewGateway(); diff --git a/patches/server/0484-Expand-EntityUnleashEvent.patch b/patches/server/0484-Expand-EntityUnleashEvent.patch index 4c9e6f4afd..8d0a37b004 100644 --- a/patches/server/0484-Expand-EntityUnleashEvent.patch +++ b/patches/server/0484-Expand-EntityUnleashEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Expand EntityUnleashEvent diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 44efb857aa839bbc0eca608661f22750bb059f4f..1ca18b0c4af08c998636bb3938a3dfdfb1d80cf0 100644 +index 7d131f3b3f5739468aa3115e97ed28b6bfeca33d..da184893d617311a43f9ce176a965f8417a2876d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2574,12 +2574,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -26,12 +26,14 @@ index 44efb857aa839bbc0eca608661f22750bb059f4f..1ca18b0c4af08c998636bb3938a3dfdf this.gameEvent(GameEvent.ENTITY_INTERACT, player); } -@@ -3450,8 +3453,11 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess +@@ -3449,9 +3452,12 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess + protected void removeAfterChangingDimensions() { this.setRemoved(Entity.RemovalReason.CHANGED_DIMENSION, null); // CraftBukkit - add Bukkit remove cause - if (this instanceof Leashable leashable) { +- if (this instanceof Leashable leashable) { - this.level().getCraftServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN)); // CraftBukkit - leashable.dropLeash(true, false); ++ if (this instanceof Leashable leashable && leashable.isLeashed()) { // Paper - only call if it is leashed + // Paper start - Expand EntityUnleashEvent + final EntityUnleashEvent event = new EntityUnleashEvent(this.getBukkitEntity(), UnleashReason.UNKNOWN, false); // CraftBukkit + event.callEvent(); @@ -41,7 +43,7 @@ index 44efb857aa839bbc0eca608661f22750bb059f4f..1ca18b0c4af08c998636bb3938a3dfdf } diff --git a/src/main/java/net/minecraft/world/entity/Leashable.java b/src/main/java/net/minecraft/world/entity/Leashable.java -index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..bc03f1fe2a311bf61449879751360c6775dde6ac 100644 +index 5c51dd5229689cba459655d488aee59bd159a414..e7535f15be3cc1537aafee53779ccfb4f21d1f38 100644 --- a/src/main/java/net/minecraft/world/entity/Leashable.java +++ b/src/main/java/net/minecraft/world/entity/Leashable.java @@ -166,8 +166,11 @@ public interface Leashable { @@ -78,10 +80,10 @@ index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..bc03f1fe2a311bf61449879751360c67 default void closeRangeLeashBehaviour(Entity entity) {} diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index c2b10c3dba9d4d08e48f8e8836142b85f16b14cb..37a8e426ca65587863bd22d2b7f32fae854c322e 100644 +index b46572f6e3b52f498b395d3b8c5def2aa799ff03..e87360e21e6eb7b0161c34a3ac6cb83d18bcd1e8 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1617,8 +1617,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1621,8 +1621,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab boolean flag1 = super.startRiding(entity, force); if (flag1 && this.isLeashed()) { @@ -95,6 +97,23 @@ index c2b10c3dba9d4d08e48f8e8836142b85f16b14cb..37a8e426ca65587863bd22d2b7f32fae } return flag1; +diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +index bf2c9134c7d9d5926add36b55e3cfea79e8c8243..7b7bc1a205dfacbe5709011b6b6799e75af9e4cc 100644 +--- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java +@@ -98,7 +98,11 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { + public boolean handleLeashAtDistance(Entity leashHolder, float distance) { + if (this.isInSittingPose()) { + if (distance > (float) this.level().paperConfig().misc.maxLeashDistance.or(Leashable.LEASH_TOO_FAR_DIST)) { // Paper - Configurable max leash distance +- this.dropLeash(true, true); ++ // Paper start - Expand EntityUnleashEvent ++ org.bukkit.event.entity.EntityUnleashEvent event = new org.bukkit.event.entity.EntityUnleashEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityUnleashEvent.UnleashReason.DISTANCE, true); ++ if (!event.callEvent()) return false; ++ this.dropLeash(true, event.isDropLeash()); ++ // Paper end - Expand EntityUnleashEvent + } + + return false; diff --git a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java b/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java index 3c0af74ed65610b1d5e3b72fdcf28c5a3423f0da..01173fc7177d78588978e087e63efda0b0527c2f 100644 --- a/src/main/java/net/minecraft/world/entity/decoration/LeashFenceKnotEntity.java @@ -121,10 +140,10 @@ index 3c0af74ed65610b1d5e3b72fdcf28c5a3423f0da..01173fc7177d78588978e087e63efda0 flag1 = true; } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 97a17f2b782196b51ebbc6740aad1768fc73f7ba..2786398e99af94d8dc1251009cdb5fa71206bcf3 100644 +index 6cc729446ff21a5718ff01fcea1496c71f77480c..ad49a7cb16de3dac7a5232abded3635a4b0b8848 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1596,8 +1596,10 @@ public class CraftEventFactory { +@@ -1598,8 +1598,10 @@ public class CraftEventFactory { Bukkit.getPluginManager().callEvent(new PlayerRecipeBookSettingsChangeEvent(player.getBukkitEntity(), bukkitType, open, filter)); } diff --git a/patches/server/0486-Add-DragonEggFormEvent.patch b/patches/server/0486-Add-DragonEggFormEvent.patch index c9ec752038..1277e3504a 100644 --- a/patches/server/0486-Add-DragonEggFormEvent.patch +++ b/patches/server/0486-Add-DragonEggFormEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add DragonEggFormEvent diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index f81dab25fedeed08f4d3ba2d7435e2da526e6056..609b20e2b222c5b1fddf22c2621d0d7a88cabcfa 100644 +index 412838a4eb3d29da5955bf1c279f66a2e7ccad12..0455c5fd2bb7955a0f343468b4bea760d6d35310 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -407,8 +407,22 @@ public class EndDragonFight { +@@ -409,8 +409,22 @@ public class EndDragonFight { this.dragonEvent.setVisible(false); this.spawnExitPortal(true); this.spawnNewGateway(); diff --git a/patches/server/0490-Allow-adding-items-to-BlockDropItemEvent.patch b/patches/server/0490-Allow-adding-items-to-BlockDropItemEvent.patch index 9b70fab956..5082d493dc 100644 --- a/patches/server/0490-Allow-adding-items-to-BlockDropItemEvent.patch +++ b/patches/server/0490-Allow-adding-items-to-BlockDropItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 2786398e99af94d8dc1251009cdb5fa71206bcf3..4f05f8d73b824cd2985e6c6d90338fc7479ef2a5 100644 +index ad49a7cb16de3dac7a5232abded3635a4b0b8848..3e1a70fe1e523946512ac71772439f7fd292623f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -460,13 +460,30 @@ public class CraftEventFactory { +@@ -462,13 +462,30 @@ public class CraftEventFactory { } public static void handleBlockDropItemEvent(Block block, BlockState state, ServerPlayer player, List items) { diff --git a/patches/server/0502-Allow-using-signs-inside-spawn-protection.patch b/patches/server/0502-Allow-using-signs-inside-spawn-protection.patch index cac2a775a6..898cf6905b 100644 --- a/patches/server/0502-Allow-using-signs-inside-spawn-protection.patch +++ b/patches/server/0502-Allow-using-signs-inside-spawn-protection.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow using signs inside spawn protection diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index afed142d5155c178807c6b26cb5766ae7d6e328a..8e888be601190e69389fa5a8596a4e7d52dd1749 100644 +index b96490d16d9a38be14d6777213d883f2223fd5a4..1cff57113816614c5b6a43056bb47f29c5839cc5 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1754,8 +1754,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1758,8 +1758,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl int i = this.player.level().getMaxBuildHeight(); if (blockposition.getY() < i) { diff --git a/patches/server/0503-Expand-world-key-API.patch b/patches/server/0503-Expand-world-key-API.patch index 3a2e31f54d..bf1f6198d8 100644 --- a/patches/server/0503-Expand-world-key-API.patch +++ b/patches/server/0503-Expand-world-key-API.patch @@ -20,7 +20,7 @@ index 1963e826548c5a8859c50f57654784c3aef50e44..04a39cb6c13c26e2cb1d73a9da98df5d // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c6566a5af 100644 +index f79af6910c4c83f1c56bc73434846f3e5270509f..3b1e073f8873e23eee187a2d60529c044e3d2f55 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1181,9 +1181,15 @@ public final class CraftServer implements Server { @@ -56,8 +56,8 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c + // Paper start + @Override -+ public World getWorld(NamespacedKey worldKey) { -+ ServerLevel worldServer = console.getLevel(ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, CraftNamespacedKey.toMinecraft(worldKey))); ++ public World getWorld(net.kyori.adventure.key.Key worldKey) { ++ ServerLevel worldServer = console.getLevel(ResourceKey.create(net.minecraft.core.registries.Registries.DIMENSION, io.papermc.paper.adventure.PaperAdventure.asVanilla(worldKey))); + if (worldServer == null) return null; + return worldServer.getWorld(); + } @@ -67,7 +67,7 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 5fe9b94c342a91d6fb3bc582ac7e84cb25b90a9e..e44bcf61c09245a63d50dd1be3c5b1fca7225ff9 100644 +index 481aeb922952578ea68ce2425c84e1a93eff0cf9..b075d4b21b53a3f39094444e4024556b23e399f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/patches/server/0507-Don-t-ignore-result-of-PlayerEditBookEvent.patch b/patches/server/0507-Don-t-ignore-result-of-PlayerEditBookEvent.patch index 55667fd1f5..cd6c157f9c 100644 --- a/patches/server/0507-Don-t-ignore-result-of-PlayerEditBookEvent.patch +++ b/patches/server/0507-Don-t-ignore-result-of-PlayerEditBookEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't ignore result of PlayerEditBookEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 8e888be601190e69389fa5a8596a4e7d52dd1749..773ada940f3bb2cf6a9ff1c32b3306d91dda27d9 100644 +index 1cff57113816614c5b6a43056bb47f29c5839cc5..0b6db265a2a7a20be647bf6e3387af20634af68c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1150,7 +1150,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1154,7 +1154,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl List> list1 = pages.stream().map(this::filterableFromOutgoing).toList(); itemstack.set(DataComponents.WRITABLE_BOOK_CONTENT, new WritableBookContent(list1)); diff --git a/patches/server/0517-fix-PlayerItemHeldEvent-firing-twice.patch b/patches/server/0517-fix-PlayerItemHeldEvent-firing-twice.patch index c5f9160f22..11155e76d5 100644 --- a/patches/server/0517-fix-PlayerItemHeldEvent-firing-twice.patch +++ b/patches/server/0517-fix-PlayerItemHeldEvent-firing-twice.patch @@ -5,10 +5,10 @@ Subject: [PATCH] fix PlayerItemHeldEvent firing twice diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 773ada940f3bb2cf6a9ff1c32b3306d91dda27d9..4ed4a2f5f03790fab394429334881377c1b3ab60 100644 +index 0b6db265a2a7a20be647bf6e3387af20634af68c..4b9b8cda8578c871c677f283ba0746460a0fadf0 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1929,6 +1929,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1933,6 +1933,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (this.player.isImmobile()) return; // CraftBukkit if (packet.getSlot() >= 0 && packet.getSlot() < Inventory.getSelectionSize()) { diff --git a/patches/server/0534-Expand-PlayerGameModeChangeEvent.patch b/patches/server/0534-Expand-PlayerGameModeChangeEvent.patch index e24fdaca27..b9d7a9d493 100644 --- a/patches/server/0534-Expand-PlayerGameModeChangeEvent.patch +++ b/patches/server/0534-Expand-PlayerGameModeChangeEvent.patch @@ -134,10 +134,10 @@ index 5de472df78940d1b8320f73d18b2edf3a796227e..073cf184a0e7af41048ae67a9b17b4cd } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7721d329e9949bf84f31792d4c06ab9e04ab4ade..75cb96d392eff322eb93894b5c2b5ad22c3fd261 100644 +index 4b9b8cda8578c871c677f283ba0746460a0fadf0..baa01aaeeb710f160c470702649356e5be124fa9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2727,7 +2727,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2731,7 +2731,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player = this.server.getPlayerList().respawn(this.player, false, Entity.RemovalReason.KILLED, RespawnReason.DEATH); // CraftBukkit if (this.server.isHardcore()) { diff --git a/patches/server/0536-More-Enchantment-API.patch b/patches/server/0536-More-Enchantment-API.patch index 692f90b66a..a3bf8f8e7e 100644 --- a/patches/server/0536-More-Enchantment-API.patch +++ b/patches/server/0536-More-Enchantment-API.patch @@ -10,7 +10,7 @@ Co-authored-by: Luis Co-authored-by: Janet Blackquill diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java -index fc6606e1bf2e2c35cb6c84af78859c3441775907..edf4df4d13dc814e98b897a3f8a5fd4757284299 100644 +index 59c9c970b83f62245d860994c4ac0c21dcc15398..4221a1e9cba35c8dc58e51e162e7fcbd0e8b31af 100644 --- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java @@ -5,6 +5,7 @@ import java.util.Locale; @@ -30,23 +30,24 @@ index fc6606e1bf2e2c35cb6c84af78859c3441775907..edf4df4d13dc814e98b897a3f8a5fd47 } @Override -@@ -148,12 +149,66 @@ public class CraftEnchantment extends Enchantment implements Handleable byteAllowed) { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to send a book too large. Book size: {} - Allowed: {} - Pages: {}", this.player.getScoreboardName(), byteTotal, byteAllowed, pageList.size()); @@ -301,7 +301,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 return; } this.lastBookTick = MinecraftServer.currentTick; -@@ -1225,7 +1225,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1229,7 +1229,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void handleMovePlayer(ServerboundMovePlayerPacket packet) { PacketUtils.ensureRunningOnSameThread(packet, this, this.player.serverLevel()); if (ServerGamePacketListenerImpl.containsInvalidValues(packet.getX(0.0D), packet.getY(0.0D), packet.getZ(0.0D), packet.getYRot(0.0F), packet.getXRot(0.0F))) { @@ -310,7 +310,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } else { ServerLevel worldserver = this.player.serverLevel(); -@@ -1663,7 +1663,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1667,7 +1667,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.dropCount++; if (this.dropCount >= 20) { ServerGamePacketListenerImpl.LOGGER.warn(this.player.getScoreboardName() + " dropped their items too quickly!"); @@ -319,7 +319,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 return; } } -@@ -1951,7 +1951,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1955,7 +1955,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.resetLastActionTime(); } else { ServerGamePacketListenerImpl.LOGGER.warn("{} tried to set an invalid carried item", this.player.getName().getString()); @@ -328,7 +328,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } } -@@ -2149,7 +2149,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2153,7 +2153,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void tryHandleChat(String s, Runnable runnable, boolean sync) { // CraftBukkit if (ServerGamePacketListenerImpl.isChatMessageIllegal(s)) { @@ -337,7 +337,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } else if (this.player.isRemoved() || this.player.getChatVisibility() == ChatVisiblity.HIDDEN) { // CraftBukkit - dead men tell no tales this.send(new ClientboundSystemChatPacket(Component.translatable("chat.disabled.options").withStyle(ChatFormatting.RED), false)); } else { -@@ -2172,7 +2172,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2176,7 +2176,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (optional.isEmpty()) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); @@ -346,7 +346,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } return optional; -@@ -2358,7 +2358,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2362,7 +2362,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // this.chatSpamTickCount += 20; if (this.chatSpamTickCount.addAndGet(20) > 200 && !this.server.getPlayerList().isOp(this.player.getGameProfile()) && !this.server.isSingleplayerOwner(this.player.getGameProfile())) { // CraftBukkit end @@ -355,7 +355,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } } -@@ -2370,7 +2370,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2374,7 +2374,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl synchronized (this.lastSeenMessages) { if (!this.lastSeenMessages.applyOffset(packet.offset())) { ServerGamePacketListenerImpl.LOGGER.warn("Failed to validate message acknowledgements from {}", this.player.getName().getString()); @@ -364,7 +364,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } } -@@ -2518,7 +2518,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2522,7 +2522,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (i > 4096) { @@ -373,7 +373,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } } -@@ -2576,7 +2576,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2580,7 +2580,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Spigot Start if ( entity == this.player && !this.player.isSpectator() ) { @@ -382,7 +382,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 return; } // Spigot End -@@ -2690,7 +2690,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2694,7 +2694,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -391,7 +391,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 ServerGamePacketListenerImpl.LOGGER.warn("Player {} tried to attack an invalid entity", ServerGamePacketListenerImpl.this.player.getName().getString()); } }); -@@ -3087,7 +3087,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3091,7 +3091,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Paper start - auto recipe limit if (!org.bukkit.Bukkit.isPrimaryThread()) { if (this.recipeSpamPackets.addAndGet(io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamIncrement) > io.papermc.paper.configuration.GlobalConfiguration.get().spamLimiter.recipeSpamLimit) { @@ -400,7 +400,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 return; } } -@@ -3329,7 +3329,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3333,7 +3333,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (!Objects.equals(profilepublickey_a, profilepublickey_a1)) { if (profilepublickey_a != null && profilepublickey_a1.expiresAt().isBefore(profilepublickey_a.expiresAt())) { @@ -409,7 +409,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } else { try { SignatureValidator signaturevalidator = this.server.getProfileKeySignatureValidator(); -@@ -3342,7 +3342,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3346,7 +3346,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { ServerGamePacketListenerImpl.LOGGER.error("Failed to validate profile key: {}", profilepublickey_b.getMessage()); @@ -419,7 +419,7 @@ index b908e292d7b2fbff6cc5058ea32648dbde52fa19..c07d6a05737da570e7dc52e73b45e755 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0cbd4e6bc9b3695fd2ff0b943a69b8fd393e0f36..46f46685081c3c164bd4ba306dfb1220a4e13e52 100644 +index 28d99ca33606d2ff44c639c78edfcaa131faf626..2b15648549245962c6427af27c3ea34e443b37f3 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -675,7 +675,7 @@ public abstract class PlayerList { @@ -431,7 +431,7 @@ index 0cbd4e6bc9b3695fd2ff0b943a69b8fd393e0f36..46f46685081c3c164bd4ba306dfb1220 } // Instead of kicking then returning, we need to store the kick reason -@@ -1273,7 +1273,7 @@ public abstract class PlayerList { +@@ -1276,7 +1276,7 @@ public abstract class PlayerList { // Paper end // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -471,7 +471,7 @@ index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66c } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 3f603688b9ad895edc2bfc07093c42bc17a35b19..6bc3209b6039ed3d33131e1c6bc56a47916be3ee 100644 +index c9dc7c570e86f420cf8c6343c6ffbdbca427e7a7..7fb6bfe2863d856f27da29a77026f4bc821c929c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -635,7 +635,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0557-Fix-potions-splash-events.patch b/patches/server/0557-Fix-potions-splash-events.patch index d086a3db0a..27cedac8c8 100644 --- a/patches/server/0557-Fix-potions-splash-events.patch +++ b/patches/server/0557-Fix-potions-splash-events.patch @@ -143,10 +143,10 @@ index be787a5b52e90796d4f06e17e564f4324807c3e6..cb34cc9443da56c0497c7a0192c8b836 public boolean isLingering() { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 4f05f8d73b824cd2985e6c6d90338fc7479ef2a5..61caedf05b28b2ba351e231c5f76e4df1ebd271a 100644 +index 3e1a70fe1e523946512ac71772439f7fd292623f..88a5b50396fddc18b733a52ad66eedd10751f8ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -884,6 +884,32 @@ public class CraftEventFactory { +@@ -886,6 +886,32 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0564-Add-PlayerArmSwingEvent.patch b/patches/server/0564-Add-PlayerArmSwingEvent.patch index 3c7532588e..ac8cbf34d7 100644 --- a/patches/server/0564-Add-PlayerArmSwingEvent.patch +++ b/patches/server/0564-Add-PlayerArmSwingEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerArmSwingEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 3a656daa941993f240fa7fc54ee1106eaa504673..633c13dc22793f5a5c4c137c614c1bb695308888 100644 +index f098997bab367e50781e3062fd2de73454a711a3..9095e6eb99cb00af976ffa48ecbbc69a0c9c931c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2408,7 +2408,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2412,7 +2412,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper end - Call interact event // Arm swing animation diff --git a/patches/server/0565-Fix-kick-event-leave-message-not-being-sent.patch b/patches/server/0565-Fix-kick-event-leave-message-not-being-sent.patch index 716ccd113a..e417ff0549 100644 --- a/patches/server/0565-Fix-kick-event-leave-message-not-being-sent.patch +++ b/patches/server/0565-Fix-kick-event-leave-message-not-being-sent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix kick event leave message not being sent diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 38d493b03c02bbfed297b7735590e799d26c07f7..09e72aee16ceb7b300482fbaf28f856d4ed472d3 100644 +index f20019261a09f425137731f7a4b92e889b617334..9982940af7d10ca7799e2c21ac994ea3afa0b805 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -290,7 +290,6 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -55,10 +55,10 @@ index feb529adf2168025c785ab92d95a3246e73c0236..b43f87ff4b9853b5d4bbea5ff9686d64 MinecraftServer minecraftserver = this.server; Connection networkmanager = this.connection; diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 633c13dc22793f5a5c4c137c614c1bb695308888..5276ce5b6fa19e0810da61c9a3c51b6318356339 100644 +index 9095e6eb99cb00af976ffa48ecbbc69a0c9c931c..de07fd466c9ac79d6f8122c619f2b4be65f31f69 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1890,6 +1890,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1894,6 +1894,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @Override public void onDisconnect(DisconnectionDetails info) { @@ -71,7 +71,7 @@ index 633c13dc22793f5a5c4c137c614c1bb695308888..5276ce5b6fa19e0810da61c9a3c51b63 // CraftBukkit start - Rarely it would send a disconnect line twice if (this.processedDisconnect) { return; -@@ -1898,11 +1904,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1902,11 +1908,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // CraftBukkit end ServerGamePacketListenerImpl.LOGGER.info("{} lost connection: {}", this.player.getName().getString(), info.reason().getString()); @@ -91,7 +91,7 @@ index 633c13dc22793f5a5c4c137c614c1bb695308888..5276ce5b6fa19e0810da61c9a3c51b63 this.chatMessageChain.close(); // CraftBukkit start - Replace vanilla quit message handling with our own. /* -@@ -1912,7 +1924,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1916,7 +1928,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.disconnect(); // Paper start - Adventure @@ -101,7 +101,7 @@ index 633c13dc22793f5a5c4c137c614c1bb695308888..5276ce5b6fa19e0810da61c9a3c51b63 this.server.getPlayerList().broadcastSystemMessage(PaperAdventure.asVanilla(quitMessage), false); // Paper end diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 46f46685081c3c164bd4ba306dfb1220a4e13e52..b36cb031b153c452c7f030105f6963072b5858fc 100644 +index 2b15648549245962c6427af27c3ea34e443b37f3..2f22ae87cd467b73883a38553fab23f8590d17a1 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -561,6 +561,11 @@ public abstract class PlayerList { diff --git a/patches/server/0573-Add-PlayerSetSpawnEvent.patch b/patches/server/0573-Add-PlayerSetSpawnEvent.patch index 4e745dc806..15c8e734d8 100644 --- a/patches/server/0573-Add-PlayerSetSpawnEvent.patch +++ b/patches/server/0573-Add-PlayerSetSpawnEvent.patch @@ -154,10 +154,10 @@ index d1b21afe48dbe1e53d4a046434336be580497165..2dd10cada8d36ed5565481f3f5a5fba1 public SectionPos getLastSectionPos() { diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index b36cb031b153c452c7f030105f6963072b5858fc..d4fa173cebcef5fa86e5d077c2bad8e831392bf0 100644 +index 2f22ae87cd467b73883a38553fab23f8590d17a1..bc5088b4b8a60dcd87eb9a7e0858a5c45bd9a7d4 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -841,7 +841,7 @@ public abstract class PlayerList { +@@ -844,7 +844,7 @@ public abstract class PlayerList { // CraftBukkit end if (dimensiontransition.missingRespawnBlock()) { entityplayer1.connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.NO_RESPAWN_BLOCK_AVAILABLE, 0.0F)); diff --git a/patches/server/0591-Add-critical-damage-API.patch b/patches/server/0591-Add-critical-damage-API.patch index 0cb51d12e2..dd78b506dd 100644 --- a/patches/server/0591-Add-critical-damage-API.patch +++ b/patches/server/0591-Add-critical-damage-API.patch @@ -61,10 +61,10 @@ index 746bb8a36bd6c6ef953289576af499caad588d79..57ebb96707748e90810dc07471f9769f int k = entity.getRemainingFireTicks(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 61caedf05b28b2ba351e231c5f76e4df1ebd271a..4180b86620aa18a95e0793f646515779801a343e 100644 +index 88a5b50396fddc18b733a52ad66eedd10751f8ea..03a6ca13218d43ad0c5fc461564d004008ee3e06 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1078,7 +1078,7 @@ public class CraftEventFactory { +@@ -1080,7 +1080,7 @@ public class CraftEventFactory { return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.BLOCK_EXPLOSION, bukkitDamageSource, modifiers, modifierFunctions, cancelled); } DamageCause damageCause = (damager.getBukkitEntity() instanceof org.bukkit.entity.TNTPrimed) ? DamageCause.BLOCK_EXPLOSION : DamageCause.ENTITY_EXPLOSION; @@ -73,7 +73,7 @@ index 61caedf05b28b2ba351e231c5f76e4df1ebd271a..4180b86620aa18a95e0793f646515779 } else if (damager != null || source.getDirectEntity() != null) { DamageCause cause = (source.isSweep()) ? DamageCause.ENTITY_SWEEP_ATTACK : DamageCause.ENTITY_ATTACK; -@@ -1104,7 +1104,7 @@ public class CraftEventFactory { +@@ -1106,7 +1106,7 @@ public class CraftEventFactory { cause = DamageCause.MAGIC; } @@ -82,7 +82,7 @@ index 61caedf05b28b2ba351e231c5f76e4df1ebd271a..4180b86620aa18a95e0793f646515779 } else if (source.is(DamageTypes.FELL_OUT_OF_WORLD)) { return CraftEventFactory.callEntityDamageEvent(source.getDirectBlock(), source.getDirectBlockState(), entity, DamageCause.VOID, bukkitDamageSource, modifiers, modifierFunctions, cancelled); } else if (source.is(DamageTypes.LAVA)) { -@@ -1164,13 +1164,13 @@ public class CraftEventFactory { +@@ -1166,13 +1166,13 @@ public class CraftEventFactory { cause = DamageCause.CUSTOM; } diff --git a/patches/server/0600-Improve-and-expand-AsyncCatcher.patch b/patches/server/0600-Improve-and-expand-AsyncCatcher.patch index 9d162a5387..c61b62c621 100644 --- a/patches/server/0600-Improve-and-expand-AsyncCatcher.patch +++ b/patches/server/0600-Improve-and-expand-AsyncCatcher.patch @@ -17,10 +17,10 @@ Async catch modifications to critical entity state Co-authored-by: Jake Potrebic diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 1e442429d30886eee96f68d212548ff741e3e07e..fa1fbd41fce44bb8bb9e3435abfcac4e0652c968 100644 +index dd96075fbffb9d912310d7c3d8a1348ade25c3ef..3762cd8bfd1544df5f5a2eefbd0490fe0c656cff 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1573,6 +1573,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1577,6 +1577,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } public void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { // Paper @@ -29,7 +29,7 @@ index 1e442429d30886eee96f68d212548ff741e3e07e..fa1fbd41fce44bb8bb9e3435abfcac4e if (player.isRemoved()) { LOGGER.info("Attempt to teleport removed player {} restricted", player.getScoreboardName()); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 85f3dcdc8349683cb79ce1d9fe56eff02af2a7a7..4714931fd5218df160e39f013278b7996cc5eca6 100644 +index a3a19f288643ce290c1e2119ba794f2409e83ed0..6625d0b4cec8e5660c0dbd7965130495e3c94682 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -1122,7 +1122,7 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/0618-Prevent-softlocked-end-exit-portal-generation.patch b/patches/server/0618-Prevent-softlocked-end-exit-portal-generation.patch index e2698e961b..ddf9bf2d23 100644 --- a/patches/server/0618-Prevent-softlocked-end-exit-portal-generation.patch +++ b/patches/server/0618-Prevent-softlocked-end-exit-portal-generation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent softlocked end exit portal generation diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 609b20e2b222c5b1fddf22c2621d0d7a88cabcfa..b8bba857aa390e5435b8a199a25065a940d6a972 100644 +index 0455c5fd2bb7955a0f343468b4bea760d6d35310..e5927f378789e1d8b83ca5c84d657e0e637cc575 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -466,6 +466,11 @@ public class EndDragonFight { +@@ -468,6 +468,11 @@ public class EndDragonFight { } } diff --git a/patches/server/0677-More-Projectile-API.patch b/patches/server/0677-More-Projectile-API.patch index 3d4ddc9624..280d31b759 100644 --- a/patches/server/0677-More-Projectile-API.patch +++ b/patches/server/0677-More-Projectile-API.patch @@ -713,10 +713,10 @@ index e374b9f40eddca13b30855d25a2030f8df98138f..4fc893378fb0568ddcffc7593d66df6b // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 48f320333fa859796f4fff01f721fda903238197..9c85cbc65bf7e1f539f12644ed391c98118c08d2 100644 +index 03a6ca13218d43ad0c5fc461564d004008ee3e06..6aa954c168e5503c1e4cf069e13f518da277cdef 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -841,19 +841,19 @@ public class CraftEventFactory { +@@ -843,19 +843,19 @@ public class CraftEventFactory { /** * PotionSplashEvent */ @@ -739,7 +739,7 @@ index 48f320333fa859796f4fff01f721fda903238197..9c85cbc65bf7e1f539f12644ed391c98 hitEntity = ((EntityHitResult) position).getEntity().getBukkitEntity(); } -@@ -862,20 +862,20 @@ public class CraftEventFactory { +@@ -864,20 +864,20 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0685-Add-TameableDeathMessageEvent.patch b/patches/server/0685-Add-TameableDeathMessageEvent.patch index e683289da1..b2ed688a59 100644 --- a/patches/server/0685-Add-TameableDeathMessageEvent.patch +++ b/patches/server/0685-Add-TameableDeathMessageEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add TameableDeathMessageEvent diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index f2d311a5450eb684603580bbf7e9e7fc73fc2f5c..07ec4837d17a9cb7db2fa310a42fc87e052b3f9b 100644 +index 0eebf7ce352e7d811bd5798bf19c399e61affb09..5405792eea1d90492183faa23367f13b88cd1721 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -237,7 +237,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -241,7 +241,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { @Override public void die(DamageSource damageSource) { if (!this.level().isClientSide && this.level().getGameRules().getBoolean(GameRules.RULE_SHOWDEATHMESSAGES) && this.getOwner() instanceof ServerPlayer) { diff --git a/patches/server/0686-Fix-new-block-data-for-EntityChangeBlockEvent.patch b/patches/server/0686-Fix-new-block-data-for-EntityChangeBlockEvent.patch index 48633dc491..58f3e0a3d9 100644 --- a/patches/server/0686-Fix-new-block-data-for-EntityChangeBlockEvent.patch +++ b/patches/server/0686-Fix-new-block-data-for-EntityChangeBlockEvent.patch @@ -196,10 +196,10 @@ index edc20745649b0837f1371c8d29e71fc0c8e5528f..932831bb5632ead5850842fc77192c84 } // CraftBukkit end diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index ffc55cf79d0e7f90ba2816d7604477f018d75ecd..697ef7d19cca2d3f51ccff9e4ab14d87a7ddaf00 100644 +index 6aa954c168e5503c1e4cf069e13f518da277cdef..d793566b2b5b0e996e4122087a883e92b24c216f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1378,11 +1378,11 @@ public class CraftEventFactory { +@@ -1380,11 +1380,11 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0692-Prevent-tile-entity-copies-loading-chunks.patch b/patches/server/0692-Prevent-tile-entity-copies-loading-chunks.patch index bcd195d880..f14c496562 100644 --- a/patches/server/0692-Prevent-tile-entity-copies-loading-chunks.patch +++ b/patches/server/0692-Prevent-tile-entity-copies-loading-chunks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Prevent tile entity copies loading chunks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 15bee10f167ebd134688ff570c4773fe088e149a..efa6e8a85f27c18bddd91b7f83656457e58a16bd 100644 +index a94c253758200ee91a911783a9505214ddd984ba..6091462cbdecfac5e6bcc92e6bbb45a680f03b05 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3197,7 +3197,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3201,7 +3201,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl BlockPos blockposition = BlockEntity.getPosFromTag(customdata.getUnsafe()); if (this.player.level().isLoaded(blockposition)) { diff --git a/patches/server/0693-Use-username-instead-of-display-name-in-PlayerList-g.patch b/patches/server/0693-Use-username-instead-of-display-name-in-PlayerList-g.patch index d98876142b..8da1a5ddd1 100644 --- a/patches/server/0693-Use-username-instead-of-display-name-in-PlayerList-g.patch +++ b/patches/server/0693-Use-username-instead-of-display-name-in-PlayerList-g.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 2916328a5b94783e68688756b5ad7685f180e27f..b0a1f6cf2cc96a2ddc8232f929c134501d99411e 100644 +index 22c1bf5989065016364505a0665a5205fd8528b5..be842c81ae6c6ec64a233f126d7221a37d66439c 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1389,7 +1389,7 @@ public abstract class PlayerList { +@@ -1392,7 +1392,7 @@ public abstract class PlayerList { // CraftBukkit start public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) { ServerStatsCounter serverstatisticmanager = entityhuman.getStats(); diff --git a/patches/server/0723-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch b/patches/server/0723-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch index fcf350cf20..da1e0bead1 100644 --- a/patches/server/0723-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch +++ b/patches/server/0723-Fix-Spigot-Config-not-using-commands.spam-exclusions.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix Spigot Config not using commands.spam-exclusions diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index efa6e8a85f27c18bddd91b7f83656457e58a16bd..52ff31d33edb0c55e2ec4a982525d47e4a19428b 100644 +index 6091462cbdecfac5e6bcc92e6bbb45a680f03b05..e804e08e8b99d10b513972bd42a1257a66baeff4 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2379,7 +2379,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2383,7 +2383,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Spigot end // this.chatSpamTickCount += 20; diff --git a/patches/server/0724-More-Teleport-API.patch b/patches/server/0724-More-Teleport-API.patch index 608b370dbf..ccfe8ed6d0 100644 --- a/patches/server/0724-More-Teleport-API.patch +++ b/patches/server/0724-More-Teleport-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] More Teleport API diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 52ff31d33edb0c55e2ec4a982525d47e4a19428b..77e31c3851813651dc00e59f8ef31134e3540b91 100644 +index e804e08e8b99d10b513972bd42a1257a66baeff4..857f6dedacf0533856e26b0a9a6f8e25c1f7bad9 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1561,11 +1561,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1565,11 +1565,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return true; // CraftBukkit - Return event status } @@ -23,8 +23,8 @@ index 52ff31d33edb0c55e2ec4a982525d47e4a19428b..77e31c3851813651dc00e59f8ef31134 this.cserver.getPluginManager().callEvent(event); if (event.isCancelled() || !to.equals(event.getTo())) { -- set.clear(); // Can't relative teleport -+ // set.clear(); // Can't relative teleport // Paper - Teleport API; Now you can! +- set = Collections.emptySet(); // Can't relative teleport ++ // set = Collections.emptySet(); // Can't relative teleport // Paper - Teleport API; Now you can! to = event.isCancelled() ? event.getFrom() : event.getTo(); d0 = to.getX(); d1 = to.getY(); @@ -112,7 +112,7 @@ index 4c09f2529dd8eb7ac7d260d177f5292ff2339442..94051ae8ea93ab144f3767345b1cda04 private final org.bukkit.entity.Entity.Spigot spigot = new org.bukkit.entity.Entity.Spigot() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4b7b812a0203ef8a586c0e0cee10c41935487309..d2f6fb41b16468bf03675b3a331c707e21f8c9ce 100644 +index 252309281f440e9b7a6be3118363c4d97e5dd767..78c11d99b6dfdf742dbe24f7b3c2ddbcfd433fd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1286,13 +1286,101 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0727-Send-block-entities-after-destroy-prediction.patch b/patches/server/0727-Send-block-entities-after-destroy-prediction.patch index 88deca43ca..5c6437afa0 100644 --- a/patches/server/0727-Send-block-entities-after-destroy-prediction.patch +++ b/patches/server/0727-Send-block-entities-after-destroy-prediction.patch @@ -57,10 +57,10 @@ index 4d024956156aefde7df308642dfd0a40779e0633..6abecaac8407b992d208a9108e11fd49 } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 77e31c3851813651dc00e59f8ef31134e3540b91..719f44cf1bca2cd834b7909e135b0a636c4ccb5e 100644 +index 857f6dedacf0533856e26b0a9a6f8e25c1f7bad9..3637eebdf9841b97e2086ce611af27c052ac0461 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1707,8 +1707,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1711,8 +1711,28 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl return; } // Paper end - Don't allow digging into unloaded chunks diff --git a/patches/server/0744-Configurable-chat-thread-limit.patch b/patches/server/0744-Configurable-chat-thread-limit.patch index 8b31661dd0..57178397ba 100644 --- a/patches/server/0744-Configurable-chat-thread-limit.patch +++ b/patches/server/0744-Configurable-chat-thread-limit.patch @@ -22,10 +22,10 @@ is actually processed, this is honestly really just exposed for the misnomers or who just wanna ensure that this won't grow over a specific size if chat gets stupidly active diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index e727414d784debd276dcc42aabf588d6fcbccc91..b2031483a327e22116e2584b278c3f0d59bf90a6 100644 +index 45ab7ff5497ceccb85944d2e8d354d9c860abf3b..917bd0c1dd8f356edc3741ee59d24e4d090af182 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -295,7 +295,18 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -296,7 +296,18 @@ public class GlobalConfiguration extends ConfigurationPart { @PostProcess private void postProcess() { diff --git a/patches/server/0752-EntityPickupItemEvent-fixes.patch b/patches/server/0752-EntityPickupItemEvent-fixes.patch index 375a09d01d..91c0eac860 100644 --- a/patches/server/0752-EntityPickupItemEvent-fixes.patch +++ b/patches/server/0752-EntityPickupItemEvent-fixes.patch @@ -25,7 +25,7 @@ index d2dfa49e124460f4762b950f9ded106d2ec15dc2..bc58323801ee16fe9b63c21332144ec0 } diff --git a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java -index d3d50ec0f4466464c048449d8a844569c447d59b..0192b62fd66621a72fcf2f20896647e5950ba993 100644 +index d3d50ec0f4466464c048449d8a844569c447d59b..b9810a1f6ac91ae9631dd1ebc225f009d91b7845 100644 --- a/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java +++ b/src/main/java/net/minecraft/world/entity/monster/piglin/PiglinAi.java @@ -242,11 +242,16 @@ public class PiglinAi { @@ -46,6 +46,15 @@ index d3d50ec0f4466464c048449d8a844569c447d59b..0192b62fd66621a72fcf2f20896647e5 piglin.take(drop, 1); itemstack = PiglinAi.removeOneItemFromItemEntity(drop); } else { +@@ -261,7 +266,7 @@ public class PiglinAi { + } else if (PiglinAi.isFood(itemstack) && !PiglinAi.hasEatenRecently(piglin)) { + PiglinAi.eat(piglin); + } else { +- boolean flag = !piglin.equipItemIfPossible(itemstack, drop).equals(ItemStack.EMPTY); // CraftBukkit ++ boolean flag = !piglin.equipItemIfPossible(itemstack, null).equals(ItemStack.EMPTY); // CraftBukkit // Paper - pass null item entity to prevent duplicate pickup item event call - called above. + + if (!flag) { + PiglinAi.putInInventory(piglin, itemstack); diff --git a/src/main/java/net/minecraft/world/entity/raid/Raider.java b/src/main/java/net/minecraft/world/entity/raid/Raider.java index 174d246b0a4d0fc9d769aad08da627ca8487bdf2..bbf21ea433f9e3963aac0ede597ed8d3c8e50ed8 100644 --- a/src/main/java/net/minecraft/world/entity/raid/Raider.java diff --git a/patches/server/0753-Correctly-handle-interactions-with-items-on-cooldown.patch b/patches/server/0753-Correctly-handle-interactions-with-items-on-cooldown.patch index e533866d2a..0622f3fbf7 100644 --- a/patches/server/0753-Correctly-handle-interactions-with-items-on-cooldown.patch +++ b/patches/server/0753-Correctly-handle-interactions-with-items-on-cooldown.patch @@ -30,10 +30,10 @@ index 03d89f326d320c5d778c3d1e2db7d6b88753faec..717d015dd4637dd9d568b751be1dc104 this.interactResult = event.useItemInHand() == Event.Result.DENY; this.interactPosition = blockposition.immutable(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 697ef7d19cca2d3f51ccff9e4ab14d87a7ddaf00..668becf24a16af6b834d05608787c8f9420e9ad3 100644 +index d793566b2b5b0e996e4122087a883e92b24c216f..e1e5a195c2a415d214c5bf8a2364835f7332751b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -554,6 +554,12 @@ public class CraftEventFactory { +@@ -556,6 +556,12 @@ public class CraftEventFactory { } public static PlayerInteractEvent callPlayerInteractEvent(net.minecraft.world.entity.player.Player who, Action action, BlockPos position, Direction direction, ItemStack itemstack, boolean cancelledBlock, InteractionHand hand, Vec3 targetPos) { @@ -46,7 +46,7 @@ index 697ef7d19cca2d3f51ccff9e4ab14d87a7ddaf00..668becf24a16af6b834d05608787c8f9 Player player = (who == null) ? null : (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); -@@ -588,6 +594,11 @@ public class CraftEventFactory { +@@ -590,6 +596,11 @@ public class CraftEventFactory { if (cancelledBlock) { event.setUseInteractedBlock(Event.Result.DENY); } diff --git a/patches/server/0760-Add-EntityToggleSitEvent.patch b/patches/server/0760-Add-EntityToggleSitEvent.patch index c9aef59416..28d2cdd4b0 100644 --- a/patches/server/0760-Add-EntityToggleSitEvent.patch +++ b/patches/server/0760-Add-EntityToggleSitEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add EntityToggleSitEvent diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 07ec4837d17a9cb7db2fa310a42fc87e052b3f9b..39adc89b35213d5d5fb71bb4b7e0c641f77e4a06 100644 +index 5405792eea1d90492183faa23367f13b88cd1721..8a4f15964449a40ae4fffc5d16b7789d61c4c594 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java @@ -86,7 +86,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { @@ -17,7 +17,7 @@ index 07ec4837d17a9cb7db2fa310a42fc87e052b3f9b..39adc89b35213d5d5fb71bb4b7e0c641 } @Override -@@ -162,6 +162,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -166,6 +166,12 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } public void setInSittingPose(boolean inSittingPose) { diff --git a/patches/server/0764-Fix-EntityArgument-suggestion-permissions-to-align-w.patch b/patches/server/0764-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch similarity index 52% rename from patches/server/0764-Fix-EntityArgument-suggestion-permissions-to-align-w.patch rename to patches/server/0764-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch index 6ec183532e..2fe35c8b32 100644 --- a/patches/server/0764-Fix-EntityArgument-suggestion-permissions-to-align-w.patch +++ b/patches/server/0764-Fix-EntityArgument-and-EntitySelectorParser-permissi.patch @@ -1,15 +1,15 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jason Penilla <11360596+jpenilla@users.noreply.github.com> Date: Wed, 26 Oct 2022 13:13:12 -0700 -Subject: [PATCH] Fix EntityArgument suggestion permissions to align with - EntitySelector#checkPermissions +Subject: [PATCH] Fix EntityArgument and EntitySelectorParser permissions to + align with EntitySelector#checkPermissions Fixes where the user has permission for selectors but not their suggestions, which especially matters when we force suggestions to the server for this type diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java -index a327939abe2cce22747366051b6b7aaa2db3a8cc..a8487c18d7ef28143a7750bf096d00bcf1e67113 100644 +index a327939abe2cce22747366051b6b7aaa2db3a8cc..3281ea4dca20d2bb22b2b1c6b9abb1329bc829c1 100644 --- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java @@ -135,7 +135,12 @@ public class EntityArgument implements ArgumentType { @@ -17,12 +17,25 @@ index a327939abe2cce22747366051b6b7aaa2db3a8cc..a8487c18d7ef28143a7750bf096d00bc stringreader.setCursor(suggestionsbuilder.getStart()); - EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, EntitySelectorParser.allowSelectors(icompletionprovider)); -+ // Paper start - Fix EntityArgument suggestion permissions ++ // Paper start - Fix EntityArgument permissions + final boolean permission = object instanceof CommandSourceStack stack + ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector") + : icompletionprovider.hasPermission(2); + EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission); -+ // Paper end - Fix EntityArgument suggestion permissions ++ // Paper end - Fix EntityArgument permissions try { argumentparserselector.parse(); +diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +index dd50a530439576f56f245ff0b7eb090f9f0c9180..9d31e29ec62f437e642ed60da69c4b106bd9e770 100644 +--- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java ++++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +@@ -133,7 +133,7 @@ public class EntitySelectorParser { + boolean flag; + + if (source instanceof SharedSuggestionProvider icompletionprovider) { +- if (icompletionprovider.hasPermission(2)) { ++ if (source instanceof net.minecraft.commands.CommandSourceStack stack ? stack.bypassSelectorPermissions || stack.hasPermission(2, "minecraft.command.selector") : icompletionprovider.hasPermission(2)) { // Paper - Fix EntityArgument permissions + flag = true; + return flag; + } diff --git a/patches/server/0767-ensure-reset-EnderDragon-boss-event-name.patch b/patches/server/0767-ensure-reset-EnderDragon-boss-event-name.patch index 854c391fc5..47272d2095 100644 --- a/patches/server/0767-ensure-reset-EnderDragon-boss-event-name.patch +++ b/patches/server/0767-ensure-reset-EnderDragon-boss-event-name.patch @@ -6,7 +6,7 @@ Subject: [PATCH] ensure reset EnderDragon boss event name Fix MC-257487 diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index b8bba857aa390e5435b8a199a25065a940d6a972..f6f5fad52e41d5ccc37dc28c40904fce014907fb 100644 +index e5927f378789e1d8b83ca5c84d657e0e637cc575..0100d3f4cb2c1d3e2e052ee109aea707029d0c10 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java @@ -73,6 +73,7 @@ public class EndDragonFight { @@ -26,7 +26,7 @@ index b8bba857aa390e5435b8a199a25065a940d6a972..f6f5fad52e41d5ccc37dc28c40904fce this.gateways = new ObjectArrayList(); this.ticksSinceLastPlayerScan = 21; this.skipArenaLoadedCheck = false; -@@ -503,6 +504,10 @@ public class EndDragonFight { +@@ -505,6 +506,10 @@ public class EndDragonFight { this.ticksSinceDragonSeen = 0; if (dragon.hasCustomName()) { this.dragonEvent.setName(dragon.getDisplayName()); diff --git a/patches/server/0783-Add-BlockLockCheckEvent.patch b/patches/server/0783-Add-BlockLockCheckEvent.patch index deeeae6839..31fba739ae 100644 --- a/patches/server/0783-Add-BlockLockCheckEvent.patch +++ b/patches/server/0783-Add-BlockLockCheckEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add BlockLockCheckEvent diff --git a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java -index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..15fd1fe1b55b6421d2c09e8385c9f69fa0152e56 100644 +index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..2ddf349fde5b310ec3f74baee1f3d33e09d5286c 100644 --- a/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/BaseContainerBlockEntity.java @@ -73,17 +73,44 @@ public abstract class BaseContainerBlockEntity extends BlockEntity implements Co @@ -26,7 +26,7 @@ index bf9ae460bdfb247456b895f026f6a7a2e162c5f5..15fd1fe1b55b6421d2c09e8385c9f69f + final org.bukkit.block.Block block = org.bukkit.craftbukkit.block.CraftBlock.at(blockEntity.getLevel(), blockEntity.getBlockPos()); + net.kyori.adventure.text.Component lockedMessage = net.kyori.adventure.text.Component.translatable("container.isLocked", io.papermc.paper.adventure.PaperAdventure.asAdventure(containerName)); + net.kyori.adventure.sound.Sound lockedSound = net.kyori.adventure.sound.Sound.sound(org.bukkit.Sound.BLOCK_CHEST_LOCKED, net.kyori.adventure.sound.Sound.Source.BLOCK, 1.0F, 1.0F); -+ final io.papermc.paper.event.block.BlockLockCheckEvent event = new io.papermc.paper.event.block.BlockLockCheckEvent(block, (io.papermc.paper.block.LockableTileState) block.getState(), serverPlayer.getBukkitEntity(), lockedMessage, lockedSound); ++ final io.papermc.paper.event.block.BlockLockCheckEvent event = new io.papermc.paper.event.block.BlockLockCheckEvent(block, serverPlayer.getBukkitEntity(), lockedMessage, lockedSound); + event.callEvent(); + if (event.getResult() == org.bukkit.event.Event.Result.ALLOW) { + return true; diff --git a/patches/server/0785-Improve-logging-and-errors.patch b/patches/server/0785-Improve-logging-and-errors.patch index 13a5a1f58b..2b5cda2c15 100644 --- a/patches/server/0785-Improve-logging-and-errors.patch +++ b/patches/server/0785-Improve-logging-and-errors.patch @@ -52,10 +52,10 @@ index aa39bdb0a4ba8fedf5052ea9700afa7d4d2a4300..b4af03c4bdd1ce0861f36c3b75fc7e89 } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 719f44cf1bca2cd834b7909e135b0a636c4ccb5e..af2fb05406616849c8f65bbd971b354d1931a6ac 100644 +index 3637eebdf9841b97e2086ce611af27c052ac0461..a5e1d26bd0cb063b9bbc525eafaf7039ab84708f 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3395,7 +3395,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3399,7 +3399,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.resetPlayerChatState(remotechatsession_a.validate(this.player.getGameProfile(), signaturevalidator)); } catch (ProfilePublicKey.ValidationException profilepublickey_b) { diff --git a/patches/server/0788-Add-missing-SpigotConfig-logCommands-check.patch b/patches/server/0788-Add-missing-SpigotConfig-logCommands-check.patch index 75fc07c3c6..4c67b4d5f2 100644 --- a/patches/server/0788-Add-missing-SpigotConfig-logCommands-check.patch +++ b/patches/server/0788-Add-missing-SpigotConfig-logCommands-check.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing SpigotConfig logCommands check Co-authored-by: david diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index af2fb05406616849c8f65bbd971b354d1931a6ac..50896a73387f9467b83f9a685ab346e3edb4e040 100644 +index a5e1d26bd0cb063b9bbc525eafaf7039ab84708f..3ca5fc1ec2e97164e2f905d9a8a3cbaa0ed23c64 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2053,7 +2053,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2057,7 +2057,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void performUnsignedChatCommand(String command) { // CraftBukkit start String command1 = "/" + command; @@ -19,7 +19,7 @@ index af2fb05406616849c8f65bbd971b354d1931a6ac..50896a73387f9467b83f9a685ab346e3 PlayerCommandPreprocessEvent event = new PlayerCommandPreprocessEvent(this.getCraftPlayer(), command1, new LazyPlayerSet(this.server)); this.cserver.getPluginManager().callEvent(event); -@@ -2093,7 +2095,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2097,7 +2099,9 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void performSignedChatCommand(ServerboundChatCommandSignedPacket packet, LastSeenMessages lastSeenMessages) { // CraftBukkit start String command = "/" + packet.command(); diff --git a/patches/server/0793-Use-single-player-info-update-packet-on-join.patch b/patches/server/0793-Use-single-player-info-update-packet-on-join.patch index 7067fafbf3..2d4fec688e 100644 --- a/patches/server/0793-Use-single-player-info-update-packet-on-join.patch +++ b/patches/server/0793-Use-single-player-info-update-packet-on-join.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Use single player info update packet on join diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 50896a73387f9467b83f9a685ab346e3edb4e040..e38c437a2e55d0e1cc7ed60f7994232880342c9e 100644 +index 3ca5fc1ec2e97164e2f905d9a8a3cbaa0ed23c64..111daa178ae9ad5a53266cf7e460f1213f9c5a88 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3433,7 +3433,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3437,7 +3437,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.signedMessageDecoder = session.createMessageDecoder(this.player.getUUID()); this.chatMessageChain.append(() -> { this.player.setChatSession(session); @@ -18,7 +18,7 @@ index 50896a73387f9467b83f9a685ab346e3edb4e040..e38c437a2e55d0e1cc7ed60f79942328 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 84add5cc89ec912389500b6140a39d6b7ddc9e86..944c727fd7770fe4c06af67304005664a7ab9e8a 100644 +index b54e8da2209d99696e12c65a23323a68b7da272b..d210df131bac0604eb44e7a772ec48089c043746 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -361,6 +361,7 @@ public abstract class PlayerList { diff --git a/patches/server/0800-Add-EntityFertilizeEggEvent.patch b/patches/server/0800-Add-EntityFertilizeEggEvent.patch index 241552c5fe..f940f43c54 100644 --- a/patches/server/0800-Add-EntityFertilizeEggEvent.patch +++ b/patches/server/0800-Add-EntityFertilizeEggEvent.patch @@ -69,10 +69,10 @@ index d34d8fe70379dcad9540739ec0ae1c94f01fc46b..fadd341ff398886a4da102eefa1beb95 this.playSound(SoundEvents.SNIFFER_EGG_PLOP, 1.0F, (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 0.5F); } // Paper - Call EntityDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 668becf24a16af6b834d05608787c8f9420e9ad3..8a1f52eeace48ed65bdc077923d0763d5e4369b6 100644 +index e1e5a195c2a415d214c5bf8a2364835f7332751b..2eb6080c92b2557c77d826300db5104db830bc7f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -2181,4 +2181,28 @@ public class CraftEventFactory { +@@ -2197,4 +2197,28 @@ public class CraftEventFactory { return event.callEvent(); } // Paper end diff --git a/patches/server/0810-Treat-sequence-violations-like-they-should-be.patch b/patches/server/0810-Treat-sequence-violations-like-they-should-be.patch index 0ba419a953..d8156489e2 100644 --- a/patches/server/0810-Treat-sequence-violations-like-they-should-be.patch +++ b/patches/server/0810-Treat-sequence-violations-like-they-should-be.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Treat sequence violations like they should be diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index e38c437a2e55d0e1cc7ed60f7994232880342c9e..207cc06d857ffca4c0aac98221a31014b42fac3f 100644 +index 111daa178ae9ad5a53266cf7e460f1213f9c5a88..14256242c87a167dc35025f3d53e778a83adaadd 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1972,6 +1972,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1976,6 +1976,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl public void ackBlockChangesUpTo(int sequence) { if (sequence < 0) { diff --git a/patches/server/0811-Prevent-causing-expired-keys-from-impacting-new-join.patch b/patches/server/0811-Prevent-causing-expired-keys-from-impacting-new-join.patch index ca01894b5f..ee5e9c9da0 100644 --- a/patches/server/0811-Prevent-causing-expired-keys-from-impacting-new-join.patch +++ b/patches/server/0811-Prevent-causing-expired-keys-from-impacting-new-join.patch @@ -26,7 +26,7 @@ index 68c062cbaa030d62d97c9c003651f8fc17a00a6b..6247a21c9c391abf1f6db3482c659593 UPDATE_GAME_MODE((serialized, buf) -> serialized.gameMode = GameType.byId(buf.readVarInt()), (buf, entry) -> buf.writeVarInt(entry.gameMode().getId())), UPDATE_LISTED((serialized, buf) -> serialized.listed = buf.readBoolean(), (buf, entry) -> buf.writeBoolean(entry.listed())), diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 207cc06d857ffca4c0aac98221a31014b42fac3f..d3e0fb1292e1bae22ea70835b45fc36aa9cf254c 100644 +index 14256242c87a167dc35025f3d53e778a83adaadd..8130db188a7014cff572743b06ca14806bbacdc2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -295,6 +295,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -51,7 +51,7 @@ index 207cc06d857ffca4c0aac98221a31014b42fac3f..d3e0fb1292e1bae22ea70835b45fc36a } private int getMaximumFlyingTicks(Entity vehicle) { -@@ -3431,6 +3439,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3435,6 +3443,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private void resetPlayerChatState(RemoteChatSession session) { this.chatSession = session; diff --git a/patches/server/0820-Expand-PlayerItemMendEvent.patch b/patches/server/0820-Expand-PlayerItemMendEvent.patch index 5ce5d5fde3..6c302fd085 100644 --- a/patches/server/0820-Expand-PlayerItemMendEvent.patch +++ b/patches/server/0820-Expand-PlayerItemMendEvent.patch @@ -30,7 +30,7 @@ index a758b2456acac23095fe4619ae10300a034cb460..a58ff67052fb5f33782f8b5c83465ec0 if (l > 0) { // this.value = l; // CraftBukkit - update exp value of orb for PlayerItemMendEvent calls // Paper - the value field should not be mutated here because it doesn't take "count" into account diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 384165d6747c61d0d306fa63773cbca560dfae9b..e7235efba6b68917a646083c150655cb42a738e5 100644 +index 34c16525d9393a3f111e3df387b55d28b875cb06..d7437bdfca45ee89cef23c6466c3d7d8a3f5c8d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1853,11 +1853,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -49,10 +49,10 @@ index 384165d6747c61d0d306fa63773cbca560dfae9b..e7235efba6b68917a646083c150655cb } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8a1f52eeace48ed65bdc077923d0763d5e4369b6..bbc5143940b5f028051cb5897a5b510e35a5d354 100644 +index 2eb6080c92b2557c77d826300db5104db830bc7f..3af97418a7e28037ed59dea7f37e0785cf9d46e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1284,10 +1284,10 @@ public class CraftEventFactory { +@@ -1286,10 +1286,10 @@ public class CraftEventFactory { return event; } diff --git a/patches/server/0835-Call-missing-BlockDispenseEvent.patch b/patches/server/0835-Call-missing-BlockDispenseEvent.patch index b1e8b7b6fb..1ee26b1b62 100644 --- a/patches/server/0835-Call-missing-BlockDispenseEvent.patch +++ b/patches/server/0835-Call-missing-BlockDispenseEvent.patch @@ -50,10 +50,10 @@ index 96db0b1041a4c0f054d4f3f2bdced960b119664e..78951f50188528718cdb3dbbaabe3f9f for (int k = 0; k < 5; ++k) { worldserver.sendParticles(ParticleTypes.SPLASH, (double) blockposition.getX() + worldserver.random.nextDouble(), (double) (blockposition.getY() + 1), (double) blockposition.getZ() + worldserver.random.nextDouble(), 1, 0.0D, 0.0D, 0.0D, 1.0D); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index bbc5143940b5f028051cb5897a5b510e35a5d354..fd648c176733dcaa03d2bbec4000381d58fc357e 100644 +index 3af97418a7e28037ed59dea7f37e0785cf9d46e4..736244853af33891609ab71fc50d259918574f3d 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -2182,6 +2182,32 @@ public class CraftEventFactory { +@@ -2198,6 +2198,32 @@ public class CraftEventFactory { } // Paper end diff --git a/patches/server/0838-Add-Sign-getInteractableSideFor.patch b/patches/server/0838-More-Sign-Block-API.patch similarity index 68% rename from patches/server/0838-Add-Sign-getInteractableSideFor.patch rename to patches/server/0838-More-Sign-Block-API.patch index 2833829ce4..3be6f4e353 100644 --- a/patches/server/0838-Add-Sign-getInteractableSideFor.patch +++ b/patches/server/0838-More-Sign-Block-API.patch @@ -1,48 +1,61 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Fri, 23 Jun 2023 12:16:28 -0700 -Subject: [PATCH] Add Sign#getInteractableSideFor +Subject: [PATCH] More Sign Block API +Co-authored-by: SoSeDiK 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 bfe8029852385875af4ebe73c63e688f61042021..a28be7a332659be655f419d969e0c64e659b6c21 100644 +index bfe8029852385875af4ebe73c63e688f61042021..3070cd2b588f5a69fd8c0d3551e16251680d8c27 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 @@ -68,12 +68,17 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C } public boolean isFacingFrontText(net.minecraft.world.entity.player.Player player) { -+ // Paper start - Add Sign#getInteractableSideFor ++ // Paper start - More Sign Block API + return this.isFacingFrontText(player.getX(), player.getZ()); + } + public boolean isFacingFrontText(double x, double z) { -+ // Paper end - Add Sign#getInteractableSideFor ++ // Paper end - More Sign Block API Block block = this.getBlockState().getBlock(); if (block instanceof SignBlock blocksign) { Vec3 vec3d = blocksign.getSignHitboxCenterPosition(this.getBlockState()); - double d0 = player.getX() - ((double) this.getBlockPos().getX() + vec3d.x); - double d1 = player.getZ() - ((double) this.getBlockPos().getZ() + vec3d.z); -+ double d0 = x - ((double) this.getBlockPos().getX() + vec3d.x); // Paper - Add Sign#getInteractableSideFor -+ double d1 = z - ((double) this.getBlockPos().getZ() + vec3d.z); // Paper - Add Sign#getInteractableSideFor ++ double d0 = x - ((double) this.getBlockPos().getX() + vec3d.x); // Paper - More Sign Block API ++ double d1 = z - ((double) this.getBlockPos().getZ() + vec3d.z); // Paper - More Sign Block API float f = blocksign.getYRotationDegrees(this.getBlockState()); float f1 = (float) (Mth.atan2(d1, d0) * 57.2957763671875D) - 90.0F; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -index 8303343ecca91076839f4436d6b3a3bf4739c2fd..cefbb015a77b9e3cab56e5ed4fe35fba91641632 100644 +index 8303343ecca91076839f4436d6b3a3bf4739c2fd..e3c333d26dea9af9dd51e1662f81f1d472ab0233 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSign.java -@@ -198,6 +198,14 @@ public class CraftSign extends CraftBlockEntityState< +@@ -198,6 +198,26 @@ public class CraftSign extends CraftBlockEntityState< } // Paper end -+ // Paper start - side facing API ++ // Paper start - More Sign Block API ++ @Override ++ public java.util.UUID getAllowedEditorUniqueId() { ++ this.ensureNoWorldGeneration(); ++ return this.getTileEntity().getPlayerWhoMayEdit(); ++ } ++ ++ @Override ++ public void setAllowedEditorUniqueId(java.util.UUID uuid) { ++ this.ensureNoWorldGeneration(); ++ this.getTileEntity().setAllowedPlayerEditor(uuid); ++ } ++ + @Override + public Side getInteractableSideFor(final double x, final double z) { + this.requirePlaced(); + return this.getSnapshot().isFacingFrontText(x, z) ? Side.FRONT : Side.BACK; + } -+ // Paper end ++ // Paper end - More Sign Block API + public static Component[] sanitizeLines(String[] lines) { Component[] components = new Component[4]; diff --git a/patches/server/0844-ExperienceOrb-should-call-EntitySpawnEvent.patch b/patches/server/0844-ExperienceOrb-should-call-EntitySpawnEvent.patch index 54f3923604..8199743d6f 100644 --- a/patches/server/0844-ExperienceOrb-should-call-EntitySpawnEvent.patch +++ b/patches/server/0844-ExperienceOrb-should-call-EntitySpawnEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ExperienceOrb should call EntitySpawnEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index fd648c176733dcaa03d2bbec4000381d58fc357e..3f9a309d4d0685aec0fabb16a1bd51931048525b 100644 +index 736244853af33891609ab71fc50d259918574f3d..50346dda83472bddc043f8e8c45f9131c2e5958c 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -744,7 +744,8 @@ public class CraftEventFactory { +@@ -746,7 +746,8 @@ public class CraftEventFactory { // Spigot start - SPIGOT-7523: Merge after spawn event and only merge if the event was not cancelled (gets checked above) if (entity instanceof net.minecraft.world.entity.ExperienceOrb xp) { double radius = world.spigotConfig.expMerge; diff --git a/patches/server/0847-Implement-PlayerFailMoveEvent.patch b/patches/server/0847-Implement-PlayerFailMoveEvent.patch index 0e5b8355f0..1bed027fcc 100644 --- a/patches/server/0847-Implement-PlayerFailMoveEvent.patch +++ b/patches/server/0847-Implement-PlayerFailMoveEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Implement PlayerFailMoveEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index d3e0fb1292e1bae22ea70835b45fc36aa9cf254c..be9c3a48fd1c44b5b5e2680c35c91c5058010e23 100644 +index 8130db188a7014cff572743b06ca14806bbacdc2..a8d6d032605d2da10c84c71fca67998705ff27ff 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1256,8 +1256,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1260,8 +1260,8 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl double d0 = ServerGamePacketListenerImpl.clampHorizontal(packet.getX(this.player.getX())); final double toX = d0; // Paper - OBFHELPER double d1 = ServerGamePacketListenerImpl.clampVertical(packet.getY(this.player.getY())); final double toY = d1; // Paper - OBFHELPER double d2 = ServerGamePacketListenerImpl.clampHorizontal(packet.getZ(this.player.getZ())); final double toZ = d2; // Paper - OBFHELPER @@ -19,7 +19,7 @@ index d3e0fb1292e1bae22ea70835b45fc36aa9cf254c..be9c3a48fd1c44b5b5e2680c35c91c50 if (this.player.isPassenger()) { this.player.absMoveTo(this.player.getX(), this.player.getY(), this.player.getZ(), f, f1); -@@ -1324,8 +1324,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1328,8 +1328,14 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper start - Prevent moving into unloaded chunks if (this.player.level().paperConfig().chunks.preventMovingIntoUnloadedChunks && (this.player.getX() != toX || this.player.getZ() != toZ) && !worldserver.areChunksLoadedForMove(this.player.getBoundingBox().expandTowards(new Vec3(toX, toY, toZ).subtract(this.player.position())))) { @@ -36,7 +36,7 @@ index d3e0fb1292e1bae22ea70835b45fc36aa9cf254c..be9c3a48fd1c44b5b5e2680c35c91c50 } // Paper end - Prevent moving into unloaded chunks -@@ -1334,9 +1340,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1338,9 +1344,16 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl if (d10 - d9 > Math.max(f2, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isSingleplayerOwner()) { // CraftBukkit end @@ -56,7 +56,7 @@ index d3e0fb1292e1bae22ea70835b45fc36aa9cf254c..be9c3a48fd1c44b5b5e2680c35c91c50 } } } -@@ -1398,14 +1411,31 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1402,14 +1415,31 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl d8 = d2 - this.player.getZ(); d10 = d6 * d6 + d7 * d7 + d8 * d8; @@ -91,7 +91,7 @@ index d3e0fb1292e1bae22ea70835b45fc36aa9cf254c..be9c3a48fd1c44b5b5e2680c35c91c50 this.internalTeleport(d3, d4, d5, f, f1, Collections.emptySet()); // CraftBukkit - SPIGOT-1807: Don't call teleport event, when the client thinks the player is falling, because the chunks are not loaded on the client yet. this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround()); } else { -@@ -3462,4 +3492,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3466,4 +3496,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl InteractionResult run(ServerPlayer player, Entity entity, InteractionHand hand); } diff --git a/patches/server/0850-API-for-updating-recipes-on-clients.patch b/patches/server/0850-API-for-updating-recipes-on-clients.patch index 373578055d..08d622fad8 100644 --- a/patches/server/0850-API-for-updating-recipes-on-clients.patch +++ b/patches/server/0850-API-for-updating-recipes-on-clients.patch @@ -5,10 +5,10 @@ Subject: [PATCH] API for updating recipes on clients diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index f9dcbf7d51680e8dfdda1350e0632dec675f3d44..1b83d8f723410c405746faa59783e6ba7a66fd56 100644 +index b8e79cf272f0a87b0fc0c0f61d325ec780b0f6b5..1eed5ebf96f8e8889d5af346d45a401b282bab21 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1485,6 +1485,13 @@ public abstract class PlayerList { +@@ -1488,6 +1488,13 @@ public abstract class PlayerList { } public void reloadResources() { @@ -22,7 +22,7 @@ index f9dcbf7d51680e8dfdda1350e0632dec675f3d44..1b83d8f723410c405746faa59783e6ba // CraftBukkit start /*Iterator iterator = this.advancements.values().iterator(); -@@ -1500,7 +1507,15 @@ public abstract class PlayerList { +@@ -1503,7 +1510,15 @@ public abstract class PlayerList { } // CraftBukkit end @@ -39,7 +39,7 @@ index f9dcbf7d51680e8dfdda1350e0632dec675f3d44..1b83d8f723410c405746faa59783e6ba Iterator iterator1 = this.players.iterator(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3e78a420ea183f4044873bb1fd89e9b9749032b8..e81ec7b81302ea5eb5fe75117a7aacbb8b88d0a6 100644 +index fffdb6db002ce36ecd60bd8f916c878ac8423fed..d7b495643914d651d7b8b04e9a5595ff1e05e4e2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1174,6 +1174,18 @@ public final class CraftServer implements Server { diff --git a/patches/server/0869-Add-BlockFace-to-BlockDamageEvent.patch b/patches/server/0869-Add-BlockFace-to-BlockDamageEvent.patch index 3a44f17ce6..28fdbf6dc6 100644 --- a/patches/server/0869-Add-BlockFace-to-BlockDamageEvent.patch +++ b/patches/server/0869-Add-BlockFace-to-BlockDamageEvent.patch @@ -18,10 +18,10 @@ index c680f081ba548f84f07a968a46811090c53e57e3..d839f8df658c894f144ba4637d290ffb if (blockEvent.isCancelled()) { // Let the client know the block still exists diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 3f9a309d4d0685aec0fabb16a1bd51931048525b..3dae4bc26ac6de7ee07eeca7763e2078cb2b7101 100644 +index 50346dda83472bddc043f8e8c45f9131c2e5958c..d80587afa3d0c8c5a0dd8112bbb73bc56ac1722d 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -659,13 +659,13 @@ public class CraftEventFactory { +@@ -661,13 +661,13 @@ public class CraftEventFactory { /** * BlockDamageEvent */ diff --git a/patches/server/0872-More-DragonBattle-API.patch b/patches/server/0872-More-DragonBattle-API.patch index a6e0c111c0..f505ebe14d 100644 --- a/patches/server/0872-More-DragonBattle-API.patch +++ b/patches/server/0872-More-DragonBattle-API.patch @@ -10,10 +10,10 @@ public net.minecraft.world.level.dimension.end.EndDragonFight respawnCrystals public net.minecraft.world.level.dimension.end.EndDragonFight spawnNewGateway(Lnet/minecraft/core/BlockPos;)V diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index f6f5fad52e41d5ccc37dc28c40904fce014907fb..6b59c4b5906c0fb4fdbc674452c6ff3df42b099b 100644 +index 0100d3f4cb2c1d3e2e052ee109aea707029d0c10..10683807a273be95a40794a7b562a15fc5dec2cc 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -439,6 +439,24 @@ public class EndDragonFight { +@@ -441,6 +441,24 @@ public class EndDragonFight { this.gateways.clear(); } diff --git a/patches/server/0879-Add-titleOverride-to-InventoryOpenEvent.patch b/patches/server/0879-Add-titleOverride-to-InventoryOpenEvent.patch index 0d8a9544c7..707a896b95 100644 --- a/patches/server/0879-Add-titleOverride-to-InventoryOpenEvent.patch +++ b/patches/server/0879-Add-titleOverride-to-InventoryOpenEvent.patch @@ -79,10 +79,10 @@ index 12ab8f7cde88cd6ce3ad474fe2843d5d30c3c0d7..c1bad887d1340ebc7c63fda3dceff929 if (!player.isImmobile()) player.connection.send(new ClientboundOpenScreenPacket(container.containerId, windowType, io.papermc.paper.adventure.PaperAdventure.asVanilla(adventure$title))); // Paper - Prevent opening inventories when frozen player.containerMenu = container; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index e5fa1ece90c38bb73bba5721e6f8d4ea240a1d6d..786b3c60086faee8d6ee23c862f3ad7ff4f3581e 100644 +index d80587afa3d0c8c5a0dd8112bbb73bc56ac1722d..3e1ef91d7f0bd098e7c7ebee49c43ca9436947b8 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1401,10 +1401,21 @@ public class CraftEventFactory { +@@ -1403,10 +1403,21 @@ public class CraftEventFactory { } public static AbstractContainerMenu callInventoryOpenEvent(ServerPlayer player, AbstractContainerMenu container) { @@ -105,7 +105,7 @@ index e5fa1ece90c38bb73bba5721e6f8d4ea240a1d6d..786b3c60086faee8d6ee23c862f3ad7f if (player.containerMenu != player.inventoryMenu) { // fire INVENTORY_CLOSE if one already open player.connection.handleContainerClose(new ServerboundContainerClosePacket(player.containerMenu.containerId), InventoryCloseEvent.Reason.OPEN_NEW); // Paper - Inventory close reason } -@@ -1419,10 +1430,10 @@ public class CraftEventFactory { +@@ -1421,10 +1432,10 @@ public class CraftEventFactory { if (event.isCancelled()) { container.transferTo(player.containerMenu, craftPlayer); diff --git a/patches/server/0881-Do-crystal-portal-proximity-check-before-entity-look.patch b/patches/server/0881-Do-crystal-portal-proximity-check-before-entity-look.patch index 67d506a715..b64a33079d 100644 --- a/patches/server/0881-Do-crystal-portal-proximity-check-before-entity-look.patch +++ b/patches/server/0881-Do-crystal-portal-proximity-check-before-entity-look.patch @@ -34,10 +34,10 @@ index 273bb38f14b8af08d123e02742d365fb5d91cdf5..5f51e64cb0611a4ba6bdcdcacbcba106 } diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -index 6b59c4b5906c0fb4fdbc674452c6ff3df42b099b..18a1b4325cac81b040596071dab99ef9bf6f3142 100644 +index 10683807a273be95a40794a7b562a15fc5dec2cc..aa7e8cdcc1979397fc60a8517f2f504bce84f19f 100644 --- a/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java +++ b/src/main/java/net/minecraft/world/level/dimension/end/EndDragonFight.java -@@ -558,6 +558,12 @@ public class EndDragonFight { +@@ -560,6 +560,12 @@ public class EndDragonFight { } public boolean tryRespawn() { // CraftBukkit - return boolean @@ -50,7 +50,7 @@ index 6b59c4b5906c0fb4fdbc674452c6ff3df42b099b..18a1b4325cac81b040596071dab99ef9 if (this.dragonKilled && this.respawnStage == null) { BlockPos blockposition = this.portalLocation; -@@ -575,6 +581,22 @@ public class EndDragonFight { +@@ -577,6 +583,22 @@ public class EndDragonFight { blockposition = this.portalLocation; } diff --git a/patches/server/0883-Add-slot-sanity-checks-in-container-clicks.patch b/patches/server/0883-Add-slot-sanity-checks-in-container-clicks.patch index 36fc080610..1b9227be71 100644 --- a/patches/server/0883-Add-slot-sanity-checks-in-container-clicks.patch +++ b/patches/server/0883-Add-slot-sanity-checks-in-container-clicks.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add slot sanity checks in container clicks diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index c17115368e36bce710a494334969676edb0f9a5c..599c620cfbf478cd3674bf4691d70000d1fd6987 100644 +index d14cb295fa3a3a2aa14efd58cccdaa9471955548..50f2834b803fb646ff177e56e1c3b1b11c033c83 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2982,6 +2982,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2986,6 +2986,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl break; case SWAP: if ((packet.getButtonNum() >= 0 && packet.getButtonNum() < 9) || packet.getButtonNum() == 40) { @@ -22,7 +22,7 @@ index c17115368e36bce710a494334969676edb0f9a5c..599c620cfbf478cd3674bf4691d70000 Slot clickedSlot = this.player.containerMenu.getSlot(packet.getSlotNum()); if (clickedSlot.mayPickup(this.player)) { diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java -index 85fb19177690ea7235c10f64789066599db08b05..428e454116804c27496cfbf796edd44780890d33 100644 +index 0e380151b038e2133013eb7d73621cf247b5b954..afd8f48bd41d2cac413c292f7988c903da1dc700 100644 --- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java @@ -423,6 +423,7 @@ public abstract class AbstractContainerMenu { diff --git a/patches/server/0886-Fix-silent-equipment-change-for-mobs.patch b/patches/server/0886-Fix-silent-equipment-change-for-mobs.patch index f3cdc6b20c..793470108f 100644 --- a/patches/server/0886-Fix-silent-equipment-change-for-mobs.patch +++ b/patches/server/0886-Fix-silent-equipment-change-for-mobs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix silent equipment change for mobs diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 37a8e426ca65587863bd22d2b7f32fae854c322e..1a2efd8b77d65606994f13980ddbe018f90d0c35 100644 +index e87360e21e6eb7b0161c34a3ac6cb83d18bcd1e8..cf1f6a0081f0dbcf43842ec23accf6c3ae9b79d8 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1102,19 +1102,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1106,19 +1106,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { diff --git a/patches/server/0913-Add-Structure-check-API.patch b/patches/server/0913-Add-Structure-check-API.patch index 38a42bd17d..2ac3cbb18d 100644 --- a/patches/server/0913-Add-Structure-check-API.patch +++ b/patches/server/0913-Add-Structure-check-API.patch @@ -5,24 +5,19 @@ Subject: [PATCH] Add Structure check API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 612dc787880e58e8325a658a63f9fe7536d0860c..ebb119ab9f5a8ae580e54cb3c102cd86f948a8d2 100644 +index 612dc787880e58e8325a658a63f9fe7536d0860c..7d54a29047d210170edf61c6182a6a8d02aa5f72 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -236,6 +236,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -236,6 +236,15 @@ public class CraftWorld extends CraftRegionAccessor implements World { }; } // Paper end + // Paper start - structure check API + @Override + public boolean hasStructureAt(final io.papermc.paper.math.Position position, final Structure structure) { -+ net.minecraft.world.level.levelgen.structure.Structure vanillaStructure = this.world.registryAccess() -+ .registryOrThrow(net.minecraft.core.registries.Registries.STRUCTURE) -+ .getHolder(CraftNamespacedKey.toMinecraft(structure.getStructureType().getKey())) -+ .orElseThrow() -+ .value(); + return this.world.structureManager().getStructureWithPieceAt( + io.papermc.paper.util.MCUtil.toBlockPos(position), -+ vanillaStructure ++ CraftStructure.bukkitToMinecraft(structure) + ).isValid(); + } + // Paper end diff --git a/patches/server/0915-Restore-vanilla-entity-drops-behavior.patch b/patches/server/0915-Restore-vanilla-entity-drops-behavior.patch index 6e06cd8067..45356521db 100644 --- a/patches/server/0915-Restore-vanilla-entity-drops-behavior.patch +++ b/patches/server/0915-Restore-vanilla-entity-drops-behavior.patch @@ -9,7 +9,7 @@ on dropping the item instead of generalizing it for all dropped items like CB does. diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index f56fc6bc4da573cd73c72e3c61a96c4f1eebeb94..e45567e8112483d947e2ff12c01219b85b09b205 100644 +index b65d816bb9feb18ecf74e10e9728c302e5657587..62ec627e80b87a92a2a51ba9fc3626a67636855f 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -976,20 +976,20 @@ public class ServerPlayer extends net.minecraft.world.entity.player.Player { @@ -91,7 +91,7 @@ index 25890e244d8909fdd6f48e148209107a30e3382e..33274654dd7faed3642770fc1d94718f return this.spawnAtLocation(entityitem); } diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 2cbb4ff57117382791eefa4881fc0b328c77d58a..3def6b7919484c330bc1c4aea1a8e2c6ad21f999 100644 +index b28e2d35df067e5f526d8990d633ca4a6d6c453b..306b55276189099bbbc8f2c86ad7428381fcf58c 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -278,7 +278,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -152,10 +152,10 @@ index 5bcb9a53ebebeef4bd6ec2458df4b63002ebd804..2f398750bfee5758ad8b1367b6fc1436 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a8365c67e28d530734b8527ce67d83decee41beb..5ba2fb40e4db033a069b7368b481ac81be109e94 100644 +index 3e1ef91d7f0bd098e7c7ebee49c43ca9436947b8..5dea6473f04bcbbb7d0d8c9289fe31434233065e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -973,18 +973,24 @@ public class CraftEventFactory { +@@ -975,18 +975,24 @@ public class CraftEventFactory { } public static EntityDeathEvent callEntityDeathEvent(net.minecraft.world.entity.LivingEntity victim, DamageSource damageSource) { @@ -184,7 +184,7 @@ index a8365c67e28d530734b8527ce67d83decee41beb..5ba2fb40e4db033a069b7368b481ac81 populateFields(victim, event); // Paper - make cancellable CraftWorld world = (CraftWorld) entity.getWorld(); Bukkit.getServer().getPluginManager().callEvent(event); -@@ -998,20 +1004,24 @@ public class CraftEventFactory { +@@ -1000,20 +1006,24 @@ public class CraftEventFactory { victim.expToDrop = event.getDroppedExp(); lootCheck.run(); // Paper - advancement triggers before destroying items @@ -213,7 +213,7 @@ index a8365c67e28d530734b8527ce67d83decee41beb..5ba2fb40e4db033a069b7368b481ac81 event.setKeepInventory(keepInventory); event.setKeepLevel(victim.keepLevel); // SPIGOT-2222: pre-set keepLevel populateFields(victim, event); // Paper - make cancellable -@@ -1029,16 +1039,14 @@ public class CraftEventFactory { +@@ -1031,16 +1041,14 @@ public class CraftEventFactory { victim.expToDrop = event.getDroppedExp(); victim.newExp = event.getNewExp(); diff --git a/patches/server/0919-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch b/patches/server/0919-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch index 72b2cc189a..75efe1d68f 100644 --- a/patches/server/0919-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch +++ b/patches/server/0919-Fix-NPE-on-null-loc-for-EntityTeleportEvent.patch @@ -26,7 +26,7 @@ index a306b30af19277386a2f3e560b4902a8b5796f2a..54851f6cc0d5fddb32a9a1e84a4f5ae4 x = to.getX(); y = to.getY(); diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 3def6b7919484c330bc1c4aea1a8e2c6ad21f999..ff16c7196b146388c526e3100e561be771ca8a91 100644 +index 306b55276189099bbbc8f2c86ad7428381fcf58c..278e22985ecda6653ce01a29209eb51506c48438 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -4229,7 +4229,7 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -39,10 +39,10 @@ index 3def6b7919484c330bc1c4aea1a8e2c6ad21f999..ff16c7196b146388c526e3100e561be7 this.teleportTo(to.getX(), to.getY(), to.getZ()); } else { diff --git a/src/main/java/net/minecraft/world/entity/TamableAnimal.java b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -index 39adc89b35213d5d5fb71bb4b7e0c641f77e4a06..45224dc3867892b298b006c17f7f85741fcc96d6 100644 +index 8a4f15964449a40ae4fffc5d16b7789d61c4c594..06f74d3aeb35844cbb540a5fcd0da2644556da55 100644 --- a/src/main/java/net/minecraft/world/entity/TamableAnimal.java +++ b/src/main/java/net/minecraft/world/entity/TamableAnimal.java -@@ -299,7 +299,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { +@@ -303,7 +303,7 @@ public abstract class TamableAnimal extends Animal implements OwnableEntity { } else { // CraftBukkit start EntityTeleportEvent event = CraftEventFactory.callEntityTeleportEvent(this, (double) x + 0.5D, (double) y, (double) z + 0.5D); diff --git a/patches/server/0921-Add-drops-to-shear-events.patch b/patches/server/0921-Add-drops-to-shear-events.patch index d434c31a11..b19f491bf1 100644 --- a/patches/server/0921-Add-drops-to-shear-events.patch +++ b/patches/server/0921-Add-drops-to-shear-events.patch @@ -317,10 +317,10 @@ index dc6230458e09f7555eee7f6a567ff60ad454666b..9d50b9ac8084f3db1844cc7ad1ce9153 public boolean readyForShearing() { return !this.isSheared() && this.isAlive(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 5ba2fb40e4db033a069b7368b481ac81be109e94..5af27ba31f293ba6bcac37047b760db1c3bd8c5f 100644 +index 5dea6473f04bcbbb7d0d8c9289fe31434233065e..4efd60ec678a8f291401e293862f6bfbf376a2b0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1689,20 +1689,20 @@ public class CraftEventFactory { +@@ -1691,20 +1691,20 @@ public class CraftEventFactory { player.level().getCraftServer().getPluginManager().callEvent(event); } diff --git a/patches/server/0923-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0923-Validate-ResourceLocation-in-NBT-reading.patch index c8a97d12db..f833c01807 100644 --- a/patches/server/0923-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0923-Validate-ResourceLocation-in-NBT-reading.patch @@ -66,7 +66,7 @@ index b98f9246b60daf31460f41ce214dfa7c011f5684..842b0cec0397d7ae5166617627340ffa @Nullable diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ff16c7196b146388c526e3100e561be771ca8a91..cbf076c5fa69d32ad3c8ea759cd9d405b60f8663 100644 +index 278e22985ecda6653ce01a29209eb51506c48438..474868d362d855423f74fd604c1050cf33ba27f3 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -887,11 +887,13 @@ public abstract class LivingEntity extends Entity implements Attackable { @@ -84,7 +84,7 @@ index ff16c7196b146388c526e3100e561be771ca8a91..cbf076c5fa69d32ad3c8ea759cd9d405 if (nbt.contains("Brain", 10)) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 1a2efd8b77d65606994f13980ddbe018f90d0c35..8b6eed30f84dc98878deaa805e7446ae4b168400 100644 +index 7e26c530783b63f9abbd3a016196e6be06dcd822..fc929c2d306a18e52e41fa4d1ee0badd1ed0bb91 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -603,7 +603,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab diff --git a/patches/server/0925-Fixup-NamespacedKey-handling.patch b/patches/server/0925-Fixup-NamespacedKey-handling.patch index 92a61d5a1e..ac021fa175 100644 --- a/patches/server/0925-Fixup-NamespacedKey-handling.patch +++ b/patches/server/0925-Fixup-NamespacedKey-handling.patch @@ -4,40 +4,6 @@ Date: Sat, 6 Jan 2024 14:31:00 +0100 Subject: [PATCH] Fixup NamespacedKey handling -diff --git a/src/main/java/net/minecraft/world/inventory/LoomMenu.java b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -index 7d7b4e53682107a1a75a7aa205be1e6bfdc8c551..0e954dfe82ed263cbe63dbf49ff49e83f38228b8 100644 ---- a/src/main/java/net/minecraft/world/inventory/LoomMenu.java -+++ b/src/main/java/net/minecraft/world/inventory/LoomMenu.java -@@ -171,12 +171,28 @@ public class LoomMenu extends AbstractContainerMenu { - return stillValid(this.access, player, Blocks.LOOM); - } - -+ private static final org.slf4j.Logger LOGGER = com.mojang.logging.LogUtils.getLogger(); // Paper - handle custom banner pattern, skip the event -+ private static boolean PRINTED_PATTERN_TYPE_NAG = false; // Paper - handle custom banner pattern, skip the event -+ - @Override - public boolean clickMenuButton(net.minecraft.world.entity.player.Player player, int id) { - if (id >= 0 && id < this.selectablePatterns.size()) { -+ // Paper start - handle custom banner pattern, skip the event (todo remove once this is supported) -+ java.util.Optional patternType = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.BANNER_PATTERN, this.selectablePatterns.get(id)); -+ if (patternType.isEmpty()) { -+ if (!PRINTED_PATTERN_TYPE_NAG) { -+ LOGGER.warn("A datapack added a custom banner pattern, those are not supported yet in the API, skipping the PlayerLoomPatternSelectEvent for {}.", player.getScoreboardName()); -+ PRINTED_PATTERN_TYPE_NAG = true; -+ } -+ this.selectedBannerPatternIndex.set(id); -+ this.setupResultSlot((Holder) this.selectablePatterns.get(id)); -+ return true; -+ } -+ // Paper end - handle custom banner pattern -+ - // Paper start - Add PlayerLoomPatternSelectEvent - int selectablePatternIndex = id; -- io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), org.bukkit.craftbukkit.block.banner.CraftPatternType.minecraftHolderToBukkit((this.selectablePatterns.get(selectablePatternIndex)))); -+ io.papermc.paper.event.player.PlayerLoomPatternSelectEvent event = new io.papermc.paper.event.player.PlayerLoomPatternSelectEvent((Player) player.getBukkitEntity(), ((CraftInventoryLoom) getBukkitView().getTopInventory()), patternType.get()); - if (!event.callEvent()) { - player.containerMenu.sendAllDataToRemote(); - return false; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java b/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java index e34deaf398dc6722c3128bdd6b9bc16da2d33bf7..f028daa4f23a1f1868c9922991259739cadc5da2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftLootTable.java @@ -85,7 +51,7 @@ index cc97638e038ea64ad180ebfded2528aa07d1809e..10e4318782107644f67818109784fff6 // Now also convert from when keys where saved return CraftRegistry.get(Registry.ATTRIBUTE, key, ApiVersion.CURRENT); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java -index afed8bdb9bd6a135e9b5f7bd9bfc61964cb240f7..26088d4039599e7bd1ad8017d845e7b1c15be9e1 100644 +index afed8bdb9bd6a135e9b5f7bd9bfc61964cb240f7..bb2d1dddca6bfe719b28df136e80a7c5a339a5ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBanner.java @@ -38,7 +38,11 @@ public class CraftBanner extends CraftBlockEntityState implem @@ -93,14 +59,27 @@ index afed8bdb9bd6a135e9b5f7bd9bfc61964cb240f7..26088d4039599e7bd1ad8017d845e7b1 for (int i = 0; i < banner.getPatterns().layers().size(); i++) { BannerPatternLayers.Layer p = banner.getPatterns().layers().get(i); - this.patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.color().getId()), CraftPatternType.minecraftHolderToBukkit(p.pattern()))); -+ // Paper start - fix upstream not handling custom banner pattern ++ // Paper start - fix upstream not handling inlined banner pattern + java.util.Optional type = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.BANNER_PATTERN, p.pattern()); + if (type.isEmpty()) continue; + this.patterns.add(new Pattern(DyeColor.getByWoolData((byte) p.color().getId()), type.get())); -+ // Paper end ++ // Paper end - fix upstream not handling inlined banner pattern } } } +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java +index bcac1359c667ef1ee46384f9c7a5adf4010d2b08..98a4463c9f194f33f4f85d95a0b9fa061cf6faaf 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPainting.java +@@ -16,7 +16,7 @@ public class CraftPainting extends CraftHanging implements Painting { + + @Override + public Art getArt() { +- return CraftArt.minecraftHolderToBukkit(this.getHandle().getVariant()); ++ return org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.ART, this.getHandle().getVariant()).orElseThrow(() -> new IllegalStateException("Inlined/custom painting variants are not supported yet in the API!")); // Paper + } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java index 2c57fd269484ed79814d974877585f9f7e6393d3..865977ce17fbb8793a1eefd71079729e83f5cfaf 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java @@ -118,7 +97,7 @@ index 2c57fd269484ed79814d974877585f9f7e6393d3..865977ce17fbb8793a1eefd71079729e this.trim = new ArmorTrim(trimMaterial, trimPattern); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java -index 1c1a2d66d1ebcbe2ded732e759d0f9d471d43b56..c56fb1eeea79176c4dbb1e9c0a8023f86220fe6a 100644 +index 1c1a2d66d1ebcbe2ded732e759d0f9d471d43b56..eb44c19f6af624df458981e46c73a64358d6e1ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java @@ -42,7 +42,7 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta { @@ -126,12 +105,12 @@ index 1c1a2d66d1ebcbe2ded732e759d0f9d471d43b56..c56fb1eeea79176c4dbb1e9c0a8023f8 BannerPatternLayers.Layer p = patterns.get(i); DyeColor color = DyeColor.getByWoolData((byte) p.color().getId()); - PatternType pattern = CraftPatternType.minecraftHolderToBukkit(p.pattern()); -+ PatternType pattern = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.BANNER_PATTERN, p.pattern()).orElse(null); // Paper - fix upstream not handling custom banner pattern ++ PatternType pattern = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.BANNER_PATTERN, p.pattern()).orElse(null); // Paper - fix upstream not handling inlined banner pattern if (color != null && pattern != null) { this.patterns.add(new Pattern(color, pattern)); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java -index 478059eb3ad76b41e6a20e9b489a2a4fb19e7c7c..3599ef1675b6091e9b67fb5241886460f106f9b4 100644 +index 478059eb3ad76b41e6a20e9b489a2a4fb19e7c7c..76a3e4893cbdba903a712d6db1d30b9c644795be 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java @@ -30,7 +30,7 @@ public class CraftMetaMusicInstrument extends CraftMetaItem implements MusicInst @@ -139,7 +118,7 @@ index 478059eb3ad76b41e6a20e9b489a2a4fb19e7c7c..3599ef1675b6091e9b67fb5241886460 getOrEmpty(tag, CraftMetaMusicInstrument.GOAT_HORN_INSTRUMENT).ifPresent((instrument) -> { - this.instrument = CraftMusicInstrument.minecraftHolderToBukkit(instrument); -+ this.instrument = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.INSTRUMENT, instrument).orElse(null); // Paper - fix upstream not handling custom instruments ++ this.instrument = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.INSTRUMENT, instrument).orElse(null); // Paper - fix upstream not handling inlined instrument }); } diff --git a/patches/server/0940-Add-CartographyItemEvent.patch b/patches/server/0940-Add-CartographyItemEvent.patch index cabd85961e..56bcd6e6ea 100644 --- a/patches/server/0940-Add-CartographyItemEvent.patch +++ b/patches/server/0940-Add-CartographyItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add CartographyItemEvent diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 599c620cfbf478cd3674bf4691d70000d1fd6987..137754d5fe819956f29f2dd2a97bb4427e0d5339 100644 +index 50f2834b803fb646ff177e56e1c3b1b11c033c83..39488b8547ccf19759ffbd5a38cbe3612253a4eb 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -3104,6 +3104,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -3108,6 +3108,19 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } diff --git a/patches/server/0941-More-Raid-API.patch b/patches/server/0941-More-Raid-API.patch index 5f013c673c..c01c87283b 100644 --- a/patches/server/0941-More-Raid-API.patch +++ b/patches/server/0941-More-Raid-API.patch @@ -86,10 +86,10 @@ index b8ce1c1c2447f9cff1717bfcfd6eb911ade0d4b3..51f21af9d75769abdcba713b9aa33392 + // Paper end - more Raid API } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ebb119ab9f5a8ae580e54cb3c102cd86f948a8d2..94640aa827c9b2e1d0174eb012fdb37c0851f501 100644 +index c664e8ca115c0a0f64e6b54478a0a2e88e8a58b7..1beb22285857778f7b0f33daa265046f657be854 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2306,6 +2306,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2301,6 +2301,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { return (raid == null) ? null : new CraftRaid(raid); } diff --git a/patches/server/0942-Add-onboarding-message-for-initial-server-start.patch b/patches/server/0942-Add-onboarding-message-for-initial-server-start.patch index 88c251c845..d3fb21c7a3 100644 --- a/patches/server/0942-Add-onboarding-message-for-initial-server-start.patch +++ b/patches/server/0942-Add-onboarding-message-for-initial-server-start.patch @@ -17,10 +17,10 @@ index d9502ba028a96f9cc846f9ed428bd8066b857ca3..87e5f614ba988547a827486740db217e node = loader.load(); this.verifyGlobalConfigVersion(node); diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index b2031483a327e22116e2584b278c3f0d59bf90a6..9db431ddb43e94d5e8dc3875d8d9c6fa5a05bbea 100644 +index 917bd0c1dd8f356edc3741ee59d24e4d090af182..f19b4a17a7e22969f7b51d3bea4056b41ab25484 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -26,6 +26,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -27,6 +27,7 @@ public class GlobalConfiguration extends ConfigurationPart { private static final Logger LOGGER = LogUtils.getLogger(); static final int CURRENT_VERSION = 29; // (when you change the version, change the comment, so it conflicts on rebases): private static GlobalConfiguration instance; diff --git a/patches/server/0947-Fix-DamageSource-API.patch b/patches/server/0947-Fix-DamageSource-API.patch index 13022d2d45..2028016bcd 100644 --- a/patches/server/0947-Fix-DamageSource-API.patch +++ b/patches/server/0947-Fix-DamageSource-API.patch @@ -220,10 +220,10 @@ index 4c6e15535fa40aad8cf1920f392589404f9ba79c..35eb95ef6fb6a0f7ea63351e90741c48 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 5af27ba31f293ba6bcac37047b760db1c3bd8c5f..c21acdf5b445a7f24e0d7a6dfd07a097cb6a95b4 100644 +index 4efd60ec678a8f291401e293862f6bfbf376a2b0..9f66fd2f248f0f63c729eb7bb902a5786dfa2cbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1092,7 +1092,7 @@ public class CraftEventFactory { +@@ -1094,7 +1094,7 @@ public class CraftEventFactory { private static EntityDamageEvent handleEntityDamageEvent(Entity entity, DamageSource source, Map modifiers, Map> modifierFunctions, boolean cancelled) { CraftDamageSource bukkitDamageSource = new CraftDamageSource(source); diff --git a/patches/server/0950-Improve-tag-parser-handling.patch b/patches/server/0950-Improve-tag-parser-handling.patch index 60b1c1c44a..ba0144b9df 100644 --- a/patches/server/0950-Improve-tag-parser-handling.patch +++ b/patches/server/0950-Improve-tag-parser-handling.patch @@ -109,8 +109,65 @@ index da101bca71f4710812621b98f0a0d8cab180346a..3cd112584accb8e8f050ac99738eed11 + } + } } +diff --git a/src/main/java/net/minecraft/network/chat/ComponentUtils.java b/src/main/java/net/minecraft/network/chat/ComponentUtils.java +index 3365aed2b67ae0e4dd0410f5190ba474f146139b..8b776434a733b91129b089d702b2583b727bf3d2 100644 +--- a/src/main/java/net/minecraft/network/chat/ComponentUtils.java ++++ b/src/main/java/net/minecraft/network/chat/ComponentUtils.java +@@ -33,10 +33,30 @@ public class ComponentUtils { + } + } + ++ @io.papermc.paper.annotation.DoNotUse // Paper - validate separators - right now this method is only used for separator evaluation. Error on build if this changes to re-evaluate. + public static Optional updateForEntity(@Nullable CommandSourceStack source, Optional text, @Nullable Entity sender, int depth) throws CommandSyntaxException { + return text.isPresent() ? Optional.of(updateForEntity(source, text.get(), sender, depth)) : Optional.empty(); + } + ++ // Paper start - validate separator ++ public static Optional updateSeparatorForEntity(@Nullable CommandSourceStack source, Optional text, @Nullable Entity sender, int depth) throws CommandSyntaxException { ++ if (text.isEmpty() || !isValidSelector(text.get())) return Optional.empty(); ++ return Optional.of(updateForEntity(source, text.get(), sender, depth)); ++ } ++ public static boolean isValidSelector(final Component component) { ++ final ComponentContents contents = component.getContents(); ++ ++ if (contents instanceof net.minecraft.network.chat.contents.NbtContents || contents instanceof net.minecraft.network.chat.contents.SelectorContents) return false; ++ if (contents instanceof final net.minecraft.network.chat.contents.TranslatableContents translatableContents) { ++ for (final Object arg : translatableContents.getArgs()) { ++ if (arg instanceof final Component argumentAsComponent && !isValidSelector(argumentAsComponent)) return false; ++ } ++ } ++ ++ return true; ++ } ++ // Paper end - validate separator ++ + public static MutableComponent updateForEntity(@Nullable CommandSourceStack source, Component text, @Nullable Entity sender, int depth) throws CommandSyntaxException { + if (depth > 100) { + return text.copy(); +diff --git a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java +index df26c39a2bb20e2021b50211dce905483a77f4e6..5634122dac8afeecab0cde623e9868d8e865e02a 100644 +--- a/src/main/java/net/minecraft/network/chat/contents/NbtContents.java ++++ b/src/main/java/net/minecraft/network/chat/contents/NbtContents.java +@@ -120,7 +120,7 @@ public class NbtContents implements ComponentContents { + }).map(Tag::getAsString); + if (this.interpreting) { + Component component = DataFixUtils.orElse( +- ComponentUtils.updateForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR ++ ComponentUtils.updateSeparatorForEntity(source, this.separator, sender, depth), ComponentUtils.DEFAULT_NO_STYLE_SEPARATOR // Paper - validate separator + ); + return stream.flatMap(text -> { + try { +@@ -132,7 +132,7 @@ public class NbtContents implements ComponentContents { + } + }).reduce((accumulator, current) -> accumulator.append(component).append(current)).orElseGet(Component::empty); + } else { +- return ComponentUtils.updateForEntity(source, this.separator, sender, depth) ++ return ComponentUtils.updateSeparatorForEntity(source, this.separator, sender, depth) // Paper - validate separator + .map( + text -> stream.map(Component::literal) + .reduce((accumulator, current) -> accumulator.append(text).append(current)) diff --git a/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java b/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java -index 1337853badf8e124aa8439ce33a255bc4164125b..a1869eee2da9b1993b1348ed40ef8fdac092b72a 100644 +index 1337853badf8e124aa8439ce33a255bc4164125b..933388a60eda2af259d4ef761e31c5abb69c31fd 100644 --- a/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java +++ b/src/main/java/net/minecraft/network/chat/contents/SelectorContents.java @@ -50,7 +50,7 @@ public class SelectorContents implements ComponentContents { @@ -122,6 +179,15 @@ index 1337853badf8e124aa8439ce33a255bc4164125b..a1869eee2da9b1993b1348ed40ef8fda } return entitySelector; +@@ -77,7 +77,7 @@ public class SelectorContents implements ComponentContents { + @Override + public MutableComponent resolve(@Nullable CommandSourceStack source, @Nullable Entity sender, int depth) throws CommandSyntaxException { + if (source != null && this.selector != null) { +- Optional optional = ComponentUtils.updateForEntity(source, this.separator, sender, depth); ++ Optional optional = ComponentUtils.updateSeparatorForEntity(source, this.separator, sender, depth); // Paper - validate separator + return ComponentUtils.formatList(this.selector.findEntities(source), optional, Entity::getDisplayName); + } else { + return Component.empty(); diff --git a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java b/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java index 56e641bc5f6edc657647993ea2efbb7bb9c2f732..4aa6232bf0f72fcde32d257100bd15b1c5192aaa 100644 --- a/src/main/java/net/minecraft/network/chat/contents/TranslatableContents.java diff --git a/patches/server/0954-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0954-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 419e036508..12dc4db2ff 100644 --- a/patches/server/0954-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/0954-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -13,7 +13,7 @@ A config is provided if you rather let players use these exploits, and let them destroy the worlds End Portals and get on top of the nether easy. diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 0add20466890db9d2af7c595806d5e767b7ee117..32651ed15e5961a8b27fc0dc8fb54ef05b6064fe 100644 +index 6a1e2614453bc3d6fe082c1fd43228c4a182442e..b70ac21d8dc70fb1513ea7ce5270fb381552c29a 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -193,6 +193,7 @@ public class Explosion { @@ -40,17 +40,16 @@ index b7bf7b3b91046c81467aeb483087e12b6d9191bf..a2877f3eb206ab9ccb93e3606f1c9b34 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, pos, flags); diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index bf52c36f31992a01a7403d8c85151327c9e944c4..d775ab8b0d37797f29e650842191d40691fb7afc 100644 +index bf52c36f31992a01a7403d8c85151327c9e944c4..3b06c080afebde1d649f05eca0af938ba32931c1 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -89,6 +89,20 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -89,6 +89,19 @@ public class Block extends BlockBehaviour implements ItemLike { protected final StateDefinition stateDefinition; private BlockState defaultBlockState; // Paper start + public final boolean isDestroyable() { + return io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowPermanentBlockBreakExploits || + this != Blocks.BARRIER && -+ this != Blocks.LIGHT && + this != Blocks.BEDROCK && + this != Blocks.END_PORTAL_FRAME && + this != Blocks.END_PORTAL && diff --git a/patches/server/0963-Fix-helmet-damage-reduction-inconsistencies.patch b/patches/server/0963-Fix-helmet-damage-reduction-inconsistencies.patch index d394f07802..a9182bdd0a 100644 --- a/patches/server/0963-Fix-helmet-damage-reduction-inconsistencies.patch +++ b/patches/server/0963-Fix-helmet-damage-reduction-inconsistencies.patch @@ -7,10 +7,10 @@ Affect the falling stalactite damage type where the reduction is not applied like in Vanilla diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c21acdf5b445a7f24e0d7a6dfd07a097cb6a95b4..10598b112b66d660f1b1362d9af1ac85201cd0af 100644 +index 9f66fd2f248f0f63c729eb7bb902a5786dfa2cbd..77ef27f9254235180a8596c6c8c4af750dc759d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1226,7 +1226,7 @@ public class CraftEventFactory { +@@ -1228,7 +1228,7 @@ public class CraftEventFactory { modifiers.put(DamageModifier.FREEZING, freezingModifier); modifierFunctions.put(DamageModifier.FREEZING, freezing); } diff --git a/patches/server/0965-improve-checking-handled-tags-in-itemmeta.patch b/patches/server/0965-improve-checking-handled-tags-in-itemmeta.patch index 9284b050d0..3bc62d037f 100644 --- a/patches/server/0965-improve-checking-handled-tags-in-itemmeta.patch +++ b/patches/server/0965-improve-checking-handled-tags-in-itemmeta.patch @@ -246,10 +246,10 @@ index 865977ce17fbb8793a1eefd71079729e83f5cfaf..889d43acf4cf7a5917f110105ed05838 getOrEmpty(tag, CraftMetaArmor.TRIM).ifPresent((trimCompound) -> { TrimMaterial trimMaterial = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(io.papermc.paper.registry.RegistryKey.TRIM_MATERIAL, trimCompound.material()).orElse(null); // Paper - fix upstream not being correct diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -index 59bdac414e8205ed608f79ef0d1502acd826d216..53df7e876c9f3e67aa2326fa1a5ce5e90ab7efd6 100644 +index ecce5d0da946ca279c5608068442cc53437dd2a5..00b5c4ab6111f980db1b9e99f901667741266440 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -@@ -47,8 +47,8 @@ public class CraftMetaArmorStand extends CraftMetaItem implements com.destroysto +@@ -35,8 +35,8 @@ public class CraftMetaArmorStand extends CraftMetaItem implements com.destroysto this.entityTag = armorStand.entityTag; } @@ -276,7 +276,7 @@ index c4beb94d8e5448e69f31f30299448f344b5d8f59..169fefb64e1af444f7c2efb1234cb6e7 getOrEmpty(tag, CraftMetaAxolotlBucket.ENTITY_TAG).ifPresent((nbt) -> { this.entityTag = nbt.copyTag(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java -index c56fb1eeea79176c4dbb1e9c0a8023f86220fe6a..1c17fb294d83d99ae657eff6a8a986bf72c6ec47 100644 +index eb44c19f6af624df458981e46c73a64358d6e1ce..d0a8cd89da3b8d87248494056470c306f8fb5ae8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java @@ -34,8 +34,8 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta { @@ -441,10 +441,10 @@ index 3ff0340c40e9dc9a6e690de15ccade7a0c4e8f02..3f6c5cbbf63631e4b72dc43558651ea9 getOrEmpty(tag, CraftMetaEntityTag.ENTITY_TAG).ifPresent((nbt) -> { this.entityTag = nbt.copyTag(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -index 8c1d2d0521da52f9a1262f5433da21700b9b0454..9600b23666668d7d581e2920a4e03e59cc2339fb 100644 +index 8725cd736d255b070f9f8ce7cf47b21e2407fbdd..e9a9882d5030040fb3759c623e99d74f8e5292b2 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -@@ -59,8 +59,8 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -60,8 +60,8 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { } } @@ -669,7 +669,7 @@ index 08e18dcabbf52aae5c3843d49a72d1d52baa729b..149356981e586e4f67d4543d3df94a2e getOrEmpty(tag, CraftMetaMap.MAP_ID).ifPresent((mapId) -> { this.mapId = mapId.id(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java -index 3599ef1675b6091e9b67fb5241886460f106f9b4..2664d0dbe0d828a67ef551aa341a497a8bd0ea14 100644 +index 76a3e4893cbdba903a712d6db1d30b9c644795be..a80b9b142ca99c7c0257b1bdeb059dce5f92ae93 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaMusicInstrument.java @@ -26,8 +26,8 @@ public class CraftMetaMusicInstrument extends CraftMetaItem implements MusicInst @@ -682,7 +682,7 @@ index 3599ef1675b6091e9b67fb5241886460f106f9b4..2664d0dbe0d828a67ef551aa341a497a + super(tag, extraHandledDcts); // Paper getOrEmpty(tag, CraftMetaMusicInstrument.GOAT_HORN_INSTRUMENT).ifPresent((instrument) -> { - this.instrument = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.INSTRUMENT, instrument).orElse(null); // Paper - fix upstream not handling custom instruments + this.instrument = org.bukkit.craftbukkit.CraftRegistry.unwrapAndConvertHolder(org.bukkit.Registry.INSTRUMENT, instrument).orElse(null); // Paper - fix upstream not handling inlined instrument diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaOminousBottle.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaOminousBottle.java index 17336c177a969f04c51ff12de4599ef261d79fef..90c554dcbfe2bcca3f742379499f1e8e8665c512 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaOminousBottle.java @@ -714,7 +714,7 @@ index d1cb8d520b6d7b0981d70412def71e7aab04560a..7f9182809f6e67ff571db0f365bc7e05 potionContents.potion().ifPresent((potion) -> { this.type = CraftPotionType.minecraftHolderToBukkit(potion); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java -index c10609472c1b86c3abb19a62bef4c9ce436307ea..d2b74daa5788c1e6d9eaddb47bc3a062287ba036 100644 +index bcd6cc29e4e621805cbd923d747f652ced240c6d..967d8940aec0065bce496d5d7a8c73de5733bd2c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java @@ -42,8 +42,8 @@ public class CraftMetaShield extends CraftMetaItem implements ShieldMeta, BlockS diff --git a/patches/server/0966-General-ItemMeta-fixes.patch b/patches/server/0966-General-ItemMeta-fixes.patch index 81edf89f6d..17b7102b0e 100644 --- a/patches/server/0966-General-ItemMeta-fixes.patch +++ b/patches/server/0966-General-ItemMeta-fixes.patch @@ -12,7 +12,7 @@ public net/minecraft/world/level/block/entity/BlockEntity saveId(Lnet/minecraft/ Co-authored-by: GhastCraftHD diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java -index ebe470ca361ec5747a843b60d82f567d41d7c9fa..f9a4bebb321207abb00b1af1c17ebda623cc950e 100644 +index e22d6f787d73fda00bc0961bd3279da2a8ab56e3..17923ab1ca4d8e04fbbac0471f88a856bbb92d10 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java +++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -1275,6 +1275,11 @@ public final class ItemStack implements DataComponentHolder { @@ -146,7 +146,7 @@ index 169fefb64e1af444f7c2efb1234cb6e7779fb717..cb49ff5c94f33f00f626a31d958d2025 } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java -index 1c17fb294d83d99ae657eff6a8a986bf72c6ec47..b9d6a4a8f78a0e26d888b6bfdff25c3a3ac17e48 100644 +index d0a8cd89da3b8d87248494056470c306f8fb5ae8..fdc0c1d73bb523f003e4169589f1002375b9c88c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBanner.java @@ -69,6 +69,7 @@ public class CraftMetaBanner extends CraftMetaItem implements BannerMeta { @@ -596,42 +596,237 @@ index 6517ec4933b0eae761fceb117ea1db175755d0b1..299f2f4f143f753f3cd8a020c8e6ae46 return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java -index 69a112b3a9726966aecbe687d905fd1a11cfa1e3..6362df65424e53098701b8d54c74b5905648b78a 100644 +index 69a112b3a9726966aecbe687d905fd1a11cfa1e3..ab424926c282fb03eabd1eebd2b7980899ef28e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java -@@ -35,7 +35,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { - private int lodestoneX; - private int lodestoneY; - private int lodestoneZ; +@@ -31,11 +31,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + static final ItemMetaKey LODESTONE_POS_Z = new ItemMetaKey("LodestonePosZ"); + static final ItemMetaKey LODESTONE_TRACKED = new ItemMetaKey("LodestoneTracked"); + +- private ResourceKey lodestoneWorld; +- private int lodestoneX; +- private int lodestoneY; +- private int lodestoneZ; - private boolean tracked = true; -+ private Boolean tracked = null; // Paper - tri-state ++ private LodestoneTracker tracker; // Paper - use LodestoneTracker type CraftMetaCompass(CraftMetaItem meta) { super(meta); -@@ -79,7 +79,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { +@@ -43,24 +39,13 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + return; + } + CraftMetaCompass compassMeta = (CraftMetaCompass) meta; +- this.lodestoneWorld = compassMeta.lodestoneWorld; +- this.lodestoneX = compassMeta.lodestoneX; +- this.lodestoneY = compassMeta.lodestoneY; +- this.lodestoneZ = compassMeta.lodestoneZ; +- this.tracked = compassMeta.tracked; ++ this.tracker = compassMeta.tracker; // Paper - use LodestoneTracker type + } + + CraftMetaCompass(DataComponentPatch tag, java.util.Set> extraHandledDcts) { // Paper + super(tag, extraHandledDcts); // Paper + getOrEmpty(tag, CraftMetaCompass.LODESTONE_TARGET).ifPresent((lodestoneTarget) -> { +- lodestoneTarget.target().ifPresent((target) -> { +- this.lodestoneWorld = target.dimension(); +- BlockPos pos = target.pos(); +- this.lodestoneX = pos.getX(); +- this.lodestoneY = pos.getY(); +- this.lodestoneZ = pos.getZ(); +- }); +- this.tracked = lodestoneTarget.tracked(); ++ this.tracker = lodestoneTarget; // Paper - use LodestoneTracker type + }); + } + +@@ -68,10 +53,13 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + super(map); + String lodestoneWorldString = SerializableMeta.getString(map, CraftMetaCompass.LODESTONE_POS_WORLD.BUKKIT, true); + if (lodestoneWorldString != null) { +- this.lodestoneWorld = ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(lodestoneWorldString)); +- this.lodestoneX = (Integer) map.get(CraftMetaCompass.LODESTONE_POS_X.BUKKIT); +- this.lodestoneY = (Integer) map.get(CraftMetaCompass.LODESTONE_POS_Y.BUKKIT); +- this.lodestoneZ = (Integer) map.get(CraftMetaCompass.LODESTONE_POS_Z.BUKKIT); ++ // Paper start - use LodestoneTracker type ++ ResourceKey lodestoneWorld = ResourceKey.create(Registries.DIMENSION, ResourceLocation.tryParse(lodestoneWorldString)); ++ int lodestoneX = (Integer) map.get(CraftMetaCompass.LODESTONE_POS_X.BUKKIT); ++ int lodestoneY = (Integer) map.get(CraftMetaCompass.LODESTONE_POS_Y.BUKKIT); ++ int lodestoneZ = (Integer) map.get(CraftMetaCompass.LODESTONE_POS_Z.BUKKIT); ++ this.tracker = new LodestoneTracker(Optional.of(new GlobalPos(lodestoneWorld, new BlockPos(lodestoneX, lodestoneY, lodestoneZ))), true); ++ // Paper end - use LodestoneTracker type + } else { + // legacy + Location lodestone = SerializableMeta.getObject(Location.class, map, CraftMetaCompass.LODESTONE_POS.BUKKIT, true); +@@ -79,21 +67,22 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { this.setLodestone(lodestone); } } - this.tracked = SerializableMeta.getBoolean(map, CraftMetaCompass.LODESTONE_TRACKED.BUKKIT); -+ this.tracked = SerializableMeta.getObjectOptionally(Boolean.class, map, CraftMetaCompass.LODESTONE_TRACKED.BUKKIT, true).orElse(null); // Paper - tri-state ++ // Paper start - use LodestoneTracker type ++ final Optional tracked = SerializableMeta.getObjectOptionally(Boolean.class, map, CraftMetaCompass.LODESTONE_TRACKED.BUKKIT, true); ++ final Optional trackedPos = this.tracker != null ? this.tracker.target() : Optional.empty(); ++ tracked.ifPresent(isTracked -> this.tracker = new LodestoneTracker(trackedPos, isTracked)); ++ // Paper end - use LodestoneTracker type } @Override -@@ -140,12 +140,12 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + void applyToItem(CraftMetaItem.Applicator tag) { + super.applyToItem(tag); + +- Optional target = Optional.empty(); +- if (this.lodestoneWorld != null) { +- target = Optional.of(new GlobalPos(this.lodestoneWorld, new BlockPos(this.lodestoneX, this.lodestoneY, this.lodestoneZ))); +- } +- +- if (target.isPresent() || this.hasLodestoneTracked()) { +- tag.put(CraftMetaCompass.LODESTONE_TARGET, new LodestoneTracker(target, this.tracked)); ++ // Paper start - use LodestoneTracker type ++ if (this.tracker != null) { ++ tag.put(CraftMetaCompass.LODESTONE_TARGET, this.tracker); + } ++ // Paper end - use LodestoneTracker type } - boolean hasLodestoneTracked() { + @Override +@@ -102,7 +91,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + } + + boolean isCompassEmpty() { +- return !(this.hasLodestone() || this.hasLodestoneTracked()); ++ return this.tracker == null; // Paper - use LodestoneTracker type + } + + @Override +@@ -113,58 +102,69 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + + @Override + public boolean hasLodestone() { +- return this.lodestoneWorld != null; ++ return this.tracker != null && this.tracker.target().isPresent(); // Paper - use LodestoneTracker type + } + + @Override + public Location getLodestone() { +- if (this.lodestoneWorld == null) { ++ if (this.tracker == null || this.tracker.target().isEmpty()) { // Paper - use LodestoneTracker type + return null; + } +- ServerLevel worldServer = MinecraftServer.getServer().getLevel(this.lodestoneWorld); ++ ServerLevel worldServer = MinecraftServer.getServer().getLevel(this.tracker.target().get().dimension()); // Paper - use LodestoneTracker type + World world = worldServer != null ? worldServer.getWorld() : null; +- return new Location(world, this.lodestoneX, this.lodestoneY, this.lodestoneZ); // world may be null here, if the referenced world is not loaded ++ return org.bukkit.craftbukkit.util.CraftLocation.toBukkit(this.tracker.target().get().pos(), world); // world may be null here, if the referenced world is not loaded // Paper - use LodestoneTracker type + } + + @Override + public void setLodestone(Location lodestone) { + Preconditions.checkArgument(lodestone == null || lodestone.getWorld() != null, "world is null"); + if (lodestone == null) { +- this.lodestoneWorld = null; ++ // Paper start - use LodestoneTracker type ++ if (this.tracker != null) { ++ this.tracker = new LodestoneTracker(java.util.Optional.empty(), this.tracker.tracked()); // Paper - use LodestoneTracker type ++ } ++ // Paper end - use LodestoneTracker type + } else { +- this.lodestoneWorld = ((CraftWorld) lodestone.getWorld()).getHandle().dimension(); +- this.lodestoneX = lodestone.getBlockX(); +- this.lodestoneY = lodestone.getBlockY(); +- this.lodestoneZ = lodestone.getBlockZ(); ++ // Paper start - use LodestoneTracker type ++ GlobalPos pos = GlobalPos.of( ++ ((CraftWorld) lodestone.getWorld()).getHandle().dimension(), ++ io.papermc.paper.util.MCUtil.toBlockPosition(lodestone) ++ ); ++ boolean tracked = this.tracker == null || this.tracker.tracked(); ++ this.tracker = new LodestoneTracker(Optional.of(pos), tracked); ++ // Paper end - use LodestoneTracker type + } + } + +- boolean hasLodestoneTracked() { - return !this.tracked; -+ return this.tracked != null; // Paper - tri-state - } - +- } +- @Override public boolean isLodestoneTracked() { - return this.tracked; -+ return this.tracked != null && this.tracked; // Paper - tri-state ++ return this.tracker != null && this.tracker.tracked(); // Paper - use LodestoneTracker type } @Override + public void setLodestoneTracked(boolean tracked) { +- this.tracked = tracked; ++ final Optional trackedPos = this.tracker != null ? this.tracker.target() : Optional.empty(); // Paper - use LodestoneTracker type ++ this.tracker = new LodestoneTracker(trackedPos, tracked); // Paper - use LodestoneTracker type ++ } ++ ++ // Paper start - Add more lodestone compass methods ++ @Override ++ public boolean isLodestoneCompass() { ++ return this.tracker != null; ++ } ++ ++ @Override ++ public void clearLodestone() { ++ this.tracker = null; + } ++ // Paper end - Add more lodestone compass methods + + @Override + int applyHash() { + final int original; + int hash = original = super.applyHash(); +- if (this.hasLodestone()) { +- hash = 73 * hash + this.lodestoneWorld.hashCode(); +- hash = 73 * hash + this.lodestoneX; +- hash = 73 * hash + this.lodestoneY; +- hash = 73 * hash + this.lodestoneZ; +- } +- if (this.hasLodestoneTracked()) { +- hash = 73 * hash + (this.isLodestoneTracked() ? 1231 : 1237); ++ if (this.isLodestoneCompass()) { ++ hash = 73 * hash + this.tracker.hashCode(); // Paper - use LodestoneTracker type + } + + return original != hash ? CraftMetaCompass.class.hashCode() ^ hash : hash; +@@ -178,10 +178,7 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + if (meta instanceof CraftMetaCompass) { + CraftMetaCompass that = (CraftMetaCompass) meta; + +- return (this.hasLodestone() ? that.hasLodestone() && this.lodestoneWorld.equals(that.lodestoneWorld) +- && this.lodestoneX == that.lodestoneX && this.lodestoneY == that.lodestoneY +- && this.lodestoneZ == that.lodestoneZ : !that.hasLodestone()) +- && this.tracked == that.tracked; ++ return java.util.Objects.equals(this.tracker, that.tracker); // Paper - use LodestoneTracker type + } + return true; + } +@@ -195,14 +192,16 @@ public class CraftMetaCompass extends CraftMetaItem implements CompassMeta { + Builder serialize(Builder builder) { + super.serialize(builder); + +- if (this.hasLodestone()) { +- builder.put(CraftMetaCompass.LODESTONE_POS_WORLD.BUKKIT, this.lodestoneWorld.location().toString()); +- builder.put(CraftMetaCompass.LODESTONE_POS_X.BUKKIT, this.lodestoneX); +- builder.put(CraftMetaCompass.LODESTONE_POS_Y.BUKKIT, this.lodestoneY); +- builder.put(CraftMetaCompass.LODESTONE_POS_Z.BUKKIT, this.lodestoneZ); +- } +- if (this.hasLodestoneTracked()) { +- builder.put(CraftMetaCompass.LODESTONE_TRACKED.BUKKIT, this.tracked); ++ if (this.isLodestoneCompass()) { // Paper - use LodestoneTracker type ++ // Paper start - use LodestoneTracker type ++ if (this.tracker.target().isPresent()) { ++ builder.put(CraftMetaCompass.LODESTONE_POS_WORLD.BUKKIT, this.tracker.target().get().dimension().location().toString()); ++ builder.put(CraftMetaCompass.LODESTONE_POS_X.BUKKIT, this.tracker.target().get().pos().getX()); ++ builder.put(CraftMetaCompass.LODESTONE_POS_Y.BUKKIT, this.tracker.target().get().pos().getY()); ++ builder.put(CraftMetaCompass.LODESTONE_POS_Z.BUKKIT, this.tracker.target().get().pos().getZ()); ++ } ++ builder.put(CraftMetaCompass.LODESTONE_TRACKED.BUKKIT, this.tracker.tracked()); ++ // Paper end - use LodestoneTracker type + } + + return builder; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCrossbow.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCrossbow.java index 0807c2172c5a4bee675cef265a45a9350e98b880..88ea260fb84a5f8eaab3a23a9a65d0411215a6a1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCrossbow.java @@ -659,10 +854,10 @@ index 3f6c5cbbf63631e4b72dc43558651ea94f31ca78..da474a5b963d8e6769d120e9091e60ed return true; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88aea2e3fb 100644 +index e9a9882d5030040fb3759c623e99d74f8e5292b2..b4dd2bd0fac4dbc010190188ea27c5f1d630cd02 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaFirework.java -@@ -54,7 +54,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -55,7 +55,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { this.power = that.power; @@ -671,7 +866,16 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 this.effects = new ArrayList<>(that.effects); } } -@@ -85,19 +85,14 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -88,7 +88,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { + } + + Iterable effects = SerializableMeta.getObject(Iterable.class, map, CraftMetaFirework.EXPLOSIONS.BUKKIT, true); +- this.safelyAddEffects(effects); ++ this.safelyAddEffects(effects, false); // Paper - limit firework effects + } + + static FireworkEffect getEffect(FireworkExplosion explosion) { +@@ -98,19 +98,14 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { .with(CraftMetaFirework.getEffectType(explosion.shape())); IntList colors = explosion.colors(); @@ -694,16 +898,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 } return effect.build(); -@@ -153,7 +148,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { - } - - Iterable effects = SerializableMeta.getObject(Iterable.class, map, CraftMetaFirework.EXPLOSIONS.BUKKIT, true); -- this.safelyAddEffects(effects); -+ this.safelyAddEffects(effects, false); // Paper - limit firework effects - } - - @Override -@@ -161,7 +156,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -162,7 +157,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { return !(this.effects == null || this.effects.isEmpty()); } @@ -712,7 +907,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 if (collection == null || (collection instanceof Collection && ((Collection) collection).isEmpty())) { return; } -@@ -173,6 +168,15 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -174,6 +169,15 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { for (Object obj : collection) { Preconditions.checkArgument(obj instanceof FireworkEffect, "%s in %s is not a FireworkEffect", obj, collection); @@ -728,7 +923,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 effects.add((FireworkEffect) obj); } } -@@ -214,7 +218,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -215,10 +219,10 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { } boolean isFireworkEmpty() { @@ -736,17 +931,21 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 + return !(this.effects != null || this.hasPower()); // Paper - empty effects list should stay on the item } - boolean hasPower() { -@@ -230,7 +234,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +- boolean hasPower() { ++ public boolean hasPower() { // Paper - add hasPower to API + return this.power != null; + } + +@@ -231,7 +235,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { if (meta instanceof CraftMetaFirework that) { - return (this.hasPower() ? that.hasPower() && this.power == that.power : !that.hasPower()) + return (Objects.equals(this.power, that.power)) - && (this.hasEffects() ? that.hasEffects() && this.effects.equals(that.effects) : !that.hasEffects()); + && (this.effects != null ? that.effects != null && this.effects.equals(that.effects) : that.effects == null); // Paper } return true; -@@ -248,7 +252,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -249,7 +253,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { if (this.hasPower()) { hash = 61 * hash + this.power; } @@ -755,7 +954,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 hash = 61 * hash + 13 * this.effects.hashCode(); } return hash != original ? CraftMetaFirework.class.hashCode() ^ hash : hash; -@@ -258,7 +262,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -259,7 +263,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { Builder serialize(Builder builder) { super.serialize(builder); @@ -764,7 +963,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 builder.put(CraftMetaFirework.EXPLOSIONS.BUKKIT, ImmutableList.copyOf(this.effects)); } -@@ -283,6 +287,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -284,6 +288,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { @Override public void addEffect(FireworkEffect effect) { Preconditions.checkArgument(effect != null, "FireworkEffect cannot be null"); @@ -772,7 +971,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 if (this.effects == null) { this.effects = new ArrayList(); } -@@ -292,6 +297,10 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -293,6 +298,10 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { @Override public void addEffects(FireworkEffect... effects) { Preconditions.checkArgument(effects != null, "effects cannot be null"); @@ -783,7 +982,7 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 if (effects.length == 0) { return; } -@@ -310,7 +319,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -311,7 +320,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { @Override public void addEffects(Iterable effects) { Preconditions.checkArgument(effects != null, "effects cannot be null"); @@ -792,15 +991,15 @@ index 9600b23666668d7d581e2920a4e03e59cc2339fb..0eceacbb096481d3bd31f5f99e964c88 } @Override -@@ -345,7 +354,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { +@@ -340,7 +349,7 @@ class CraftMetaFirework extends CraftMetaItem implements FireworkMeta { + @Override - public void setPower(int power) { - Preconditions.checkArgument(power >= 0, "power cannot be less than zero: %s", power); -- Preconditions.checkArgument(power < 0x80, "power cannot be more than 127: %s", power); -+ Preconditions.checkArgument(power <= 0xFF, "power cannot be more than 255: %s", power); // Paper - set correct limit - this.power = power; + public int getPower() { +- return this.hasPower() ? this.power : 1; ++ return this.hasPower() ? this.power : 0; // Paper - 0 is correct } - } + + @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java index bee2f2f5675b8aaeb2a04ada1f6dba9aa9a14ed3..67181b215312f1f572d6ac5afd289c6540b12829 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1857,19 +2056,6 @@ index 6bed0a5c8d9f1ca72678cdf4699128e441a24541..8e03e14d0e65bfdf2196a08220d1408b itemMeta.applyToItem(compound); assertEquals(itemMeta, new CraftMetaItem(compound.build(), null)); // Paper -diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index b6da1c2902139d4c7b01ac7b3407d4f6ac3990e2..1a582ee78334835df79f93cc9fd3669c347d8b3a 100644 ---- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -+++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -@@ -66,7 +66,7 @@ import org.junit.jupiter.api.Test; - - public class ItemMetaTest extends AbstractTestingBase { - -- static final int MAX_FIREWORK_POWER = 127; // Please update ItemStackFireworkTest if/when this gets changed. -+ static final int MAX_FIREWORK_POWER = 255; // Please update ItemStackFireworkTest if/when this gets changed. // Paper - it changed - - @Test - public void testPowerLimitExact() { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java index 6f94c7a19f2f598a836ec7db30332dd95f8675a6..54ffbfd91a03efa2d0d271ed10db4209a2309638 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/PersistentDataContainerTest.java diff --git a/patches/server/0971-Brigadier-based-command-API.patch b/patches/server/0971-Brigadier-based-command-API.patch index ad3eff5ecd..4267ee72c5 100644 --- a/patches/server/0971-Brigadier-based-command-API.patch +++ b/patches/server/0971-Brigadier-based-command-API.patch @@ -2356,10 +2356,10 @@ index b4af03c4bdd1ce0861f36c3b75fc7e89d701c46a..0761d5bc5f2813bb4a9f664ac7a05b97 this.setPvpAllowed(dedicatedserverproperties.pvp); this.setFlightAllowed(dedicatedserverproperties.allowFlight); diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index ef646b717323933f4b84e963ab8139dd241843bc..4f9a17e7cd5aca2e8bd55b4892a20dce181289cd 100644 +index ef5832259de0a78292b52829dca8e2e3d3836595..94b4375f303b6376fa2a59b075146db5bbdd19c8 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2403,33 +2403,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2407,33 +2407,20 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } diff --git a/patches/server/0975-Prevent-sending-oversized-item-data-in-equipment-and.patch b/patches/server/0975-Prevent-sending-oversized-item-data-in-equipment-and.patch index c9d47f41f8..97aaa27e78 100644 --- a/patches/server/0975-Prevent-sending-oversized-item-data-in-equipment-and.patch +++ b/patches/server/0975-Prevent-sending-oversized-item-data-in-equipment-and.patch @@ -7,23 +7,25 @@ Co-authored-by: Jake Potrebic diff --git a/src/main/java/io/papermc/paper/util/DataSanitizationUtil.java b/src/main/java/io/papermc/paper/util/DataSanitizationUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..e9436f8a73ee0a02096d66e14d73edaae28d5a41 +index 0000000000000000000000000000000000000000..72483dedd3b1864fca3463d3ba3f6fad22680b97 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/DataSanitizationUtil.java -@@ -0,0 +1,100 @@ +@@ -0,0 +1,108 @@ +package io.papermc.paper.util; + -+import java.util.ArrayList; +import java.util.List; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.UnaryOperator; ++import it.unimi.dsi.fastutil.objects.ObjectArrayList; +import net.minecraft.network.RegistryFriendlyByteBuf; +import net.minecraft.network.codec.StreamCodec; ++import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.component.BundleContents; +import net.minecraft.world.item.component.ChargedProjectiles; +import net.minecraft.world.item.component.ItemContainerContents; ++import org.apache.commons.lang3.math.Fraction; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.framework.qual.DefaultQualifier; + @@ -48,26 +50,33 @@ index 0000000000000000000000000000000000000000..e9436f8a73ee0a02096d66e14d73edaa + if (projectiles.isEmpty()) { + return projectiles; + } -+ final List items = projectiles.getItems(); -+ final List sanitized = new ArrayList<>(); -+ for (int i = 0; i < Math.min(items.size(), 3); i++) { -+ // we want to preserve item type as vanilla client can change visuals based on type -+ sanitized.add(new ItemStack(items.get(i).getItemHolder())); -+ } -+ return ChargedProjectiles.of(sanitized); ++ ++ return ChargedProjectiles.of(List.of( ++ new ItemStack(projectiles.contains(Items.FIREWORK_ROCKET) ? Items.FIREWORK_ROCKET : Items.ARROW) ++ )); + } + + private static BundleContents sanitizeBundleContents(final BundleContents contents) { ++ if (contents.isEmpty()) { ++ return contents; ++ } ++ + // Bundles change their texture based on their fullness. -+ int sizeUsed = 0; -+ for (final ItemStack item : contents.items()) { -+ final int scale = 64 / item.getMaxStackSize(); -+ sizeUsed += scale * item.getCount(); ++ // A bundles content weight may be anywhere from 0 to, basically, infinity. ++ // A weight of 1 is the usual maximum case ++ int sizeUsed = Mth.mulAndTruncate(contents.weight(), 64); ++ // Early out, *most* bundles should not be overfilled above a weight of one. ++ if (sizeUsed <= 64) return new BundleContents(List.of(new ItemStack(Items.PAPER, Math.max(1, sizeUsed)))); ++ ++ final List sanitizedRepresentation = new ObjectArrayList<>(sizeUsed / 64 + 1); ++ while (sizeUsed > 0) { ++ final int stackCount = Math.min(64, sizeUsed); ++ sanitizedRepresentation.add(new ItemStack(Items.PAPER, stackCount)); ++ sizeUsed -= stackCount; + } + // Now we add a single fake item that uses the same amount of slots as all other items. -+ final List items = new ArrayList<>(); -+ items.add(new ItemStack(Items.PAPER, sizeUsed)); -+ return new BundleContents(items); ++ // Ensure that potentially overstacked bundles are not represented by empty (count=0) itemstacks. ++ return new BundleContents(sanitizedRepresentation); + } + + private static StreamCodec codec(final StreamCodec delegate, final UnaryOperator sanitizer) { @@ -109,7 +118,6 @@ index 0000000000000000000000000000000000000000..e9436f8a73ee0a02096d66e14d73edaa + + private DataSanitizationUtil() { + } -+ +} diff --git a/src/main/java/net/minecraft/core/component/DataComponents.java b/src/main/java/net/minecraft/core/component/DataComponents.java index c9aef759c1485da753e820f9b509117ca50a31e4..60757f8df706cba92350d73503b73913cff3bcfc 100644 @@ -201,10 +209,10 @@ index 0e7ace92522fbd4cef7b2c2b8a0f8b86c2cce192..1d849ce4e2c85f149af25318b8ffb6dc ((LivingEntity) this.entity).detectEquipmentUpdatesPublic(); // CraftBukkit - SPIGOT-3789: sync again immediately after sending } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 4f9a17e7cd5aca2e8bd55b4892a20dce181289cd..a04fdcecf00f128f0afba1a33fad1d9e7694ef63 100644 +index 94b4375f303b6376fa2a59b075146db5bbdd19c8..b9286e0784c8d1f99cf6ab58297a382fa3b8585e 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2727,7 +2727,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2731,7 +2731,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl entity.refreshEntityData(ServerGamePacketListenerImpl.this.player); // SPIGOT-7136 - Allays if (entity instanceof Allay) { diff --git a/patches/server/0979-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch b/patches/server/0979-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch index 2edb9f6db4..0632142ae0 100644 --- a/patches/server/0979-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch +++ b/patches/server/0979-Deprecate-InvAction-HOTBAR_MOVE_AND_READD.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Deprecate InvAction#HOTBAR_MOVE_AND_READD diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index a04fdcecf00f128f0afba1a33fad1d9e7694ef63..566bbc8f2976bc492049fcddca5976a0ae48d14d 100644 +index b9286e0784c8d1f99cf6ab58297a382fa3b8585e..50a8ea1af21c374215cbce85e16bbdebc346d49c 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2993,14 +2993,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2997,14 +2997,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl Slot clickedSlot = this.player.containerMenu.getSlot(packet.getSlotNum()); if (clickedSlot.mayPickup(this.player)) { ItemStack hotbar = this.player.getInventory().getItem(packet.getButtonNum()); diff --git a/patches/server/0987-Moonrise-optimisation-patches.patch b/patches/server/0987-Moonrise-optimisation-patches.patch index 468f55d499..8e119c8548 100644 --- a/patches/server/0987-Moonrise-optimisation-patches.patch +++ b/patches/server/0987-Moonrise-optimisation-patches.patch @@ -22216,10 +22216,10 @@ index 0000000000000000000000000000000000000000..85950a1aa732ab8c01ad28bec9e0de14 + } +} diff --git a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -index 9db431ddb43e94d5e8dc3875d8d9c6fa5a05bbea..214ea75502d4abf9ebbc99a3811e4d2f8465227e 100644 +index f19b4a17a7e22969f7b51d3bea4056b41ab25484..690086adcb1f87adc0b3ab664fde735ad3e1093a 100644 --- a/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java +++ b/src/main/java/io/papermc/paper/configuration/GlobalConfiguration.java -@@ -30,6 +30,45 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -31,6 +31,45 @@ public class GlobalConfiguration extends ConfigurationPart { public static GlobalConfiguration get() { return instance; } @@ -22265,7 +22265,7 @@ index 9db431ddb43e94d5e8dc3875d8d9c6fa5a05bbea..214ea75502d4abf9ebbc99a3811e4d2f static void set(GlobalConfiguration instance) { GlobalConfiguration.instance = instance; } -@@ -138,21 +177,6 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -139,21 +178,6 @@ public class GlobalConfiguration extends ConfigurationPart { public int incomingPacketThreshold = 300; } @@ -22287,7 +22287,7 @@ index 9db431ddb43e94d5e8dc3875d8d9c6fa5a05bbea..214ea75502d4abf9ebbc99a3811e4d2f public UnsupportedSettings unsupportedSettings; public class UnsupportedSettings extends ConfigurationPart { -@@ -211,7 +235,7 @@ public class GlobalConfiguration extends ConfigurationPart { +@@ -212,7 +236,7 @@ public class GlobalConfiguration extends ConfigurationPart { @PostProcess private void postProcess() { @@ -26236,7 +26236,7 @@ index c97292f22a3402dbd59cef4af554954dc1d4f91a..b2c5ead035f583585b79f7eba51d66da return crashreportsystemdetails; } diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index 5b68fa9758d410ebe7b9bf7fd4221835fbce3d0b..45839cca7dd2e0ec3b6f146df4938da3e4b2c275 100644 +index 62ec627e80b87a92a2a51ba9fc3626a67636855f..30f53916a9e49165bcfef2bea2c0b50a26f5a8a3 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -200,7 +200,7 @@ import org.bukkit.event.player.PlayerToggleSneakEvent; @@ -28968,10 +28968,10 @@ index 15f82c9a1ce1fef2e951d1b3c7a65e64b82061ea..90c165c890a2d998e3b0af9b4310e399 public boolean shouldFreeze(LevelReader world, BlockPos blockPos) { diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java -index d775ab8b0d37797f29e650842191d40691fb7afc..a7108b2be0746aa1f0e574d8c6f5ffad6d369835 100644 +index 3b06c080afebde1d649f05eca0af938ba32931c1..29947de9eb6887f2e61516523ff08d8b581b0f53 100644 --- a/src/main/java/net/minecraft/world/level/block/Block.java +++ b/src/main/java/net/minecraft/world/level/block/Block.java -@@ -280,7 +280,7 @@ public class Block extends BlockBehaviour implements ItemLike { +@@ -279,7 +279,7 @@ public class Block extends BlockBehaviour implements ItemLike { } public static boolean isShapeFullBlock(VoxelShape shape) { @@ -32731,7 +32731,7 @@ index 69c7fe5bf5b914276a9f7a0e57ce668e569d91f9..33322b57b4c6922f4daad0f584733f0f @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 43a94a67b337f40522c25cc2252a6a5e1294ca0b..40c6ce263c025d26190f21adceaf899723da5a19 100644 +index d8b842bfd1507ace84943ff1f9ddc6ea153e54db..266b720ffe2a684dcf54456e3a198f90baf96ba3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1428,7 +1428,7 @@ public final class CraftServer implements Server { @@ -32762,10 +32762,10 @@ index 43a94a67b337f40522c25cc2252a6a5e1294ca0b..40c6ce263c025d26190f21adceaf8997 // Paper start - Adventure diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463c681152c 100644 +index 1beb22285857778f7b0f33daa265046f657be854..f8d9446acd34d8f1d2e58288d742dbb4da2691ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -456,10 +456,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -451,10 +451,14 @@ public class CraftWorld extends CraftRegionAccessor implements World { ChunkHolder playerChunk = this.world.getChunkSource().chunkMap.getVisibleChunkIfPresent(ChunkPos.asLong(x, z)); if (playerChunk == null) return false; @@ -32783,7 +32783,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463 ClientboundLevelChunkWithLightPacket refreshPacket = new ClientboundLevelChunkWithLightPacket(chunk, this.world.getLightEngine(), null, null); for (ServerPlayer player : playersInRange) { -@@ -467,8 +471,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -462,8 +466,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { player.connection.send(refreshPacket); } @@ -32793,7 +32793,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463 return true; } -@@ -572,20 +575,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -567,20 +570,8 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public Collection getPluginChunkTickets(int x, int z) { DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; @@ -32815,7 +32815,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463 } @Override -@@ -593,7 +584,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -588,7 +579,7 @@ public class CraftWorld extends CraftRegionAccessor implements World { Map> ret = new HashMap<>(); DistanceManager chunkDistanceManager = this.world.getChunkSource().chunkMap.distanceManager; @@ -32824,7 +32824,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463 long chunkKey = chunkTickets.getLongKey(); SortedArraySet> tickets = chunkTickets.getValue(); -@@ -1290,12 +1281,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -1285,12 +1276,12 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public int getViewDistance() { @@ -32839,7 +32839,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463 } public BlockMetadataStore getBlockMetadata() { -@@ -2433,17 +2424,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -2428,17 +2419,20 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public void setSimulationDistance(final int simulationDistance) { @@ -32864,7 +32864,7 @@ index 94640aa827c9b2e1d0174eb012fdb37c0851f501..5ad2ceb1274648631689215702a12463 // Paper start - implement pointers diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 12010a078542b7e89f0f4c0e7983eb15e75c4f1f..2f56cbcc1d1af98f58c310ff8b4ce33cc950e977 100644 +index 63b8e0e95e960d3a5e2f321896346b9c69f1bcc4..1def2a09427de70646802fd876a5805489a3d129 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -3497,7 +3497,9 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0996-Entity-Activation-Range-2.0.patch b/patches/server/0996-Entity-Activation-Range-2.0.patch index ef299ab7d1..3c4ab1ac7c 100644 --- a/patches/server/0996-Entity-Activation-Range-2.0.patch +++ b/patches/server/0996-Entity-Activation-Range-2.0.patch @@ -147,7 +147,7 @@ index 9928c5f0814aa2206dfe7540a3fe2465b4446359..32502664a82dda6220f8d9fa55410574 movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 8b6eed30f84dc98878deaa805e7446ae4b168400..bd7c6ce15698aed70376c109ba36f52d6794a2f8 100644 +index fc929c2d306a18e52e41fa4d1ee0badd1ed0bb91..ebd8e5ff9f80157dd6029456f165265d04932422 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab diff --git a/patches/server/0998-Anti-Xray.patch b/patches/server/0998-Anti-Xray.patch index 87839cda7a..49087886e3 100644 --- a/patches/server/0998-Anti-Xray.patch +++ b/patches/server/0998-Anti-Xray.patch @@ -1155,7 +1155,7 @@ index 32634e45ac8433648e49e47e20081e15ad41ff15..dafa2cf7d3c49fc5bdcd68d2a9528127 if (io.papermc.paper.event.packet.PlayerChunkLoadEvent.getHandlerList().getRegisteredListeners().length > 0) { new io.papermc.paper.event.packet.PlayerChunkLoadEvent(new org.bukkit.craftbukkit.CraftChunk(chunk), handler.getPlayer().getBukkitEntity()).callEvent(); diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index eec536d493575f593dd71c63944b047566f3822d..0a97d45f96b3b3cd12fa99373fcb5999c3fba96b 100644 +index 4b597ed9a71908ecec3b6da5b6a4a735cf22498b..96eea87534b6e28a56c9eea0f30bfb41793440e7 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -414,7 +414,7 @@ public abstract class PlayerList { @@ -1231,7 +1231,7 @@ index a7fc4b027cee8e1ed2678be7060040494a65682a..75c8125e20b70433fe9d143a3193d821 } 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 3fa7bfa09b9d529b5cb9cad923f21343159cfa35..8c865cd4e50ad55679a8bd89835caa40cc101f35 100644 +index d94e24cfc56c195a47665c212f8fcc901648a4a1..b1a6dc25b04ab6a43e8d62378e14d88d1c60bbbe 100644 --- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java +++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java @@ -91,7 +91,7 @@ public class LevelChunk extends ChunkAccess implements ca.spottedleaf.moonrise.p @@ -1574,7 +1574,7 @@ index 33322b57b4c6922f4daad0f584733f0f24083911..45e262308aebafa377a2353661acdd12 private static final byte[] EMPTY_LIGHT = new byte[2048]; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index cc1f3c7fec4fa794da0b19f44ced9fd482dfdfc7..3a91faeb6957e4e783b1de3e1145e7d1d164a857 100644 +index 266b720ffe2a684dcf54456e3a198f90baf96ba3..05001bb637d55aaf36359b37a42ef33e4557b9f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2686,7 +2686,7 @@ public final class CraftServer implements Server { @@ -1587,10 +1587,10 @@ index cc1f3c7fec4fa794da0b19f44ced9fd482dfdfc7..3a91faeb6957e4e783b1de3e1145e7d1 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 5ad2ceb1274648631689215702a12463c681152c..86ed89a2eae5f36d902cd8dc4bd0389e066b4bba 100644 +index f8d9446acd34d8f1d2e58288d742dbb4da2691ce..0b9e4f68df87e89bda458ce715982c6db780ebc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -465,11 +465,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -460,11 +460,16 @@ public class CraftWorld extends CraftRegionAccessor implements World { List playersInRange = playerChunk.playerProvider.getPlayers(playerChunk.getPos(), false); if (playersInRange.isEmpty()) return true; // Paper - chunk system diff --git a/patches/server/1003-Optimize-Collision-to-not-load-chunks.patch b/patches/server/1003-Optimize-Collision-to-not-load-chunks.patch index 857d525339..d67ae80a4b 100644 --- a/patches/server/1003-Optimize-Collision-to-not-load-chunks.patch +++ b/patches/server/1003-Optimize-Collision-to-not-load-chunks.patch @@ -14,10 +14,10 @@ movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 0a97d45f96b3b3cd12fa99373fcb5999c3fba96b..e597a7ef6e702c7e3703e1ba29a7b919d1c20877 100644 +index 96eea87534b6e28a56c9eea0f30bfb41793440e7..24ff10c4ed69deed2ce9ba25835575419165e2af 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -865,6 +865,7 @@ public abstract class PlayerList { +@@ -868,6 +868,7 @@ public abstract class PlayerList { Vec3 vec3d = dimensiontransition.pos(); entityplayer1.forceSetPositionRotation(vec3d.x, vec3d.y, vec3d.z, dimensiontransition.yRot(), dimensiontransition.xRot()); diff --git a/patches/server/1006-Entity-load-save-limit-per-chunk.patch b/patches/server/1006-Entity-load-save-limit-per-chunk.patch index 380beda077..9a5959e34f 100644 --- a/patches/server/1006-Entity-load-save-limit-per-chunk.patch +++ b/patches/server/1006-Entity-load-save-limit-per-chunk.patch @@ -9,7 +9,7 @@ defaults are only included for certain entites, this allows setting limits for any entity type. diff --git a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java -index 997b05167c19472acb98edac32d4548cc65efa8e..87d2b3ec165e2e9e4bdbedd7adddaa2130ed507b 100644 +index 997b05167c19472acb98edac32d4548cc65efa8e..5c7f2471a0b15ac2e714527296ad2aa7291999eb 100644 --- a/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java +++ b/src/main/java/ca/spottedleaf/moonrise/patches/chunk_system/level/entity/ChunkEntitySlices.java @@ -100,7 +100,18 @@ public final class ChunkEntitySlices { @@ -23,7 +23,7 @@ index 997b05167c19472acb98edac32d4548cc65efa8e..87d2b3ec165e2e9e4bdbedd7adddaa21 + final int saveLimit = world.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1); + if (saveLimit > -1) { + if (savedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) { -+ break; ++ continue; + } + savedEntityCounts.merge(entityType, 1, Integer::sum); + } diff --git a/patches/server/1012-Fix-entity-type-tags-suggestions-in-selectors.patch b/patches/server/1012-Fix-entity-type-tags-suggestions-in-selectors.patch index 7153240a70..7892753fc2 100644 --- a/patches/server/1012-Fix-entity-type-tags-suggestions-in-selectors.patch +++ b/patches/server/1012-Fix-entity-type-tags-suggestions-in-selectors.patch @@ -60,7 +60,7 @@ index e8dcbe7c6d6ed20ad19d2ba1893ad16d917b9993..3e454515360c22a26c9329e4032d5255 } diff --git a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java -index a8487c18d7ef28143a7750bf096d00bcf1e67113..208b56fff4925cad8d4e0bc843c07372fad034c8 100644 +index 3281ea4dca20d2bb22b2b1c6b9abb1329bc829c1..716d37ea7c398c4f15f362c7759daca9d3fe32cb 100644 --- a/src/main/java/net/minecraft/commands/arguments/EntityArgument.java +++ b/src/main/java/net/minecraft/commands/arguments/EntityArgument.java @@ -139,7 +139,7 @@ public class EntityArgument implements ArgumentType { @@ -69,7 +69,7 @@ index a8487c18d7ef28143a7750bf096d00bcf1e67113..208b56fff4925cad8d4e0bc843c07372 : icompletionprovider.hasPermission(2); - EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission); + EntitySelectorParser argumentparserselector = new EntitySelectorParser(stringreader, permission, true); // Paper - tell clients to ask server for suggestions for EntityArguments - // Paper end - Fix EntityArgument suggestion permissions + // Paper end - Fix EntityArgument permissions try { @@ -149,7 +149,19 @@ public class EntityArgument implements ArgumentType { @@ -94,7 +94,7 @@ index a8487c18d7ef28143a7750bf096d00bcf1e67113..208b56fff4925cad8d4e0bc843c07372 SharedSuggestionProvider.suggest((Iterable) iterable, suggestionsbuilder1); diff --git a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java -index dd50a530439576f56f245ff0b7eb090f9f0c9180..1f05594d5f00b6d57ec189273edbd25f2d679d61 100644 +index 9d31e29ec62f437e642ed60da69c4b106bd9e770..ce200e673b54c66cfdf34657db28d3eee28dc4e0 100644 --- a/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java +++ b/src/main/java/net/minecraft/commands/arguments/selector/EntitySelectorParser.java @@ -116,8 +116,15 @@ public class EntitySelectorParser { diff --git a/patches/server/1019-Properly-resend-entities.patch b/patches/server/1019-Properly-resend-entities.patch index ffba1508ba..5758909403 100644 --- a/patches/server/1019-Properly-resend-entities.patch +++ b/patches/server/1019-Properly-resend-entities.patch @@ -81,10 +81,10 @@ index e9dcdb1e09e84a9b451034ff4bdfa6eae2dd1c04..24b1715397ba8e6f5e9841a030d0e3d9 } } diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 566bbc8f2976bc492049fcddca5976a0ae48d14d..f1ca57b98fe04df2722114743c2d746c0a679c1f 100644 +index 50a8ea1af21c374215cbce85e16bbdebc346d49c..1e17d05bb6b7254e4d55b1f33cea24e1c4ef42ae 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -1944,6 +1944,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1948,6 +1948,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } if (cancelled) { @@ -92,7 +92,7 @@ index 566bbc8f2976bc492049fcddca5976a0ae48d14d..f1ca57b98fe04df2722114743c2d746c this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; } -@@ -2713,7 +2714,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2717,7 +2718,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl // Entity in bucket - SPIGOT-4048 and SPIGOT-6859a if ((entity instanceof Bucketable && entity instanceof LivingEntity && origItem != null && origItem.asItem() == Items.WATER_BUCKET) && (event.isCancelled() || ServerGamePacketListenerImpl.this.player.getInventory().getSelected() == null || ServerGamePacketListenerImpl.this.player.getInventory().getSelected().getItem() != origItem)) { @@ -102,7 +102,7 @@ index 566bbc8f2976bc492049fcddca5976a0ae48d14d..f1ca57b98fe04df2722114743c2d746c } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index e597a7ef6e702c7e3703e1ba29a7b919d1c20877..ca9b909a783733f2af1e36f4ac2fd463362b9685 100644 +index 24ff10c4ed69deed2ce9ba25835575419165e2af..83759ce35c66e45d04eaa494bd8bc95e51e9836a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -393,7 +393,7 @@ public abstract class PlayerList { @@ -167,7 +167,7 @@ index 6b4a7930efabd29f00690a79e8080faaa9767190..935f88542a10360ec21dfced9272313f public boolean equals(Object object) { return object instanceof Entity ? ((Entity) object).id == this.id : false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index 8a876b2d964b70b9ddd2d90bf8fbb983566ef747..aff6cd6b717b8fdff373be1db32d26f1305e2be9 100644 +index 0eea726a703e7d5b128f39b31929963aa27d82cc..53e4ce13f0ce1a7609fdc82f0ae3f3dabef38c54 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java @@ -3879,6 +3879,11 @@ public abstract class LivingEntity extends Entity implements Attackable { diff --git a/patches/server/1028-Fix-CraftWorld-isChunkGenerated.patch b/patches/server/1028-Fix-CraftWorld-isChunkGenerated.patch index 48ae6e61ad..6811b4bfce 100644 --- a/patches/server/1028-Fix-CraftWorld-isChunkGenerated.patch +++ b/patches/server/1028-Fix-CraftWorld-isChunkGenerated.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix CraftWorld#isChunkGenerated The upstream implementation is returning true for non-full chunks. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 86ed89a2eae5f36d902cd8dc4bd0389e066b4bba..362ca138a5cd5ad19f1300015c2571794adc3649 100644 +index 0b9e4f68df87e89bda458ce715982c6db780ebc4..7f523399774ba395a6bc99d92553c6e4def80eab 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -367,11 +367,28 @@ public class CraftWorld extends CraftRegionAccessor implements World { +@@ -362,11 +362,28 @@ public class CraftWorld extends CraftRegionAccessor implements World { @Override public boolean isChunkGenerated(int x, int z) { diff --git a/patches/server/1029-fix-horse-inventories.patch b/patches/server/1029-fix-horse-inventories.patch index ca5b9c08cd..9737a4fa71 100644 --- a/patches/server/1029-fix-horse-inventories.patch +++ b/patches/server/1029-fix-horse-inventories.patch @@ -23,10 +23,10 @@ index 9bcc0931510607b8fbd01233e2b3c346369b214d..467693a60786688b753cebac3b0a8889 // Paper start - Horse API diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java -index 4946da593713f4d11d88ac1bb68a089f2f6d5ae0..abef7f23361e6c5d18243dd18439ffd13ac787ae 100644 +index 4946da593713f4d11d88ac1bb68a089f2f6d5ae0..54e81472259dc13dfc7b2af6b211628c39435890 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryAbstractHorse.java -@@ -6,17 +6,73 @@ import org.bukkit.inventory.ItemStack; +@@ -6,17 +6,106 @@ import org.bukkit.inventory.ItemStack; public class CraftInventoryAbstractHorse extends CraftInventory implements AbstractHorseInventory { @@ -74,6 +74,39 @@ index 4946da593713f4d11d88ac1bb68a089f2f6d5ae0..abef7f23361e6c5d18243dd18439ffd1 + } + + @Override ++ public boolean isEmpty() { ++ return this.getMainInventory().isEmpty() && this.getArmorInventory().isEmpty(); ++ } ++ ++ @Override ++ public ItemStack[] getContents() { ++ ItemStack[] items = new ItemStack[this.getSize()]; ++ ++ items[net.minecraft.world.entity.animal.horse.AbstractHorse.INV_SLOT_SADDLE] = this.getSaddle(); ++ items[net.minecraft.world.inventory.HorseInventoryMenu.SLOT_BODY_ARMOR] = this.getArmor(); ++ ++ for (int i = net.minecraft.world.inventory.HorseInventoryMenu.SLOT_BODY_ARMOR + 1; i < items.length; i++) { ++ net.minecraft.world.item.ItemStack item = this.getMainInventory().getItem(i - 1); ++ items[i] = item.isEmpty() ? null : CraftItemStack.asCraftMirror(item); ++ } ++ ++ return items; ++ } ++ ++ @Override ++ public void setContents(ItemStack[] items) { ++ com.google.common.base.Preconditions.checkArgument(items.length <= this.getSize(), "Invalid inventory size (%s); expected %s or less", items.length, this.getSize()); ++ ++ this.setSaddle(org.apache.commons.lang3.ArrayUtils.get(items, net.minecraft.world.entity.animal.horse.AbstractHorse.INV_SLOT_SADDLE)); ++ this.setArmor(org.apache.commons.lang3.ArrayUtils.get(items, net.minecraft.world.inventory.HorseInventoryMenu.SLOT_BODY_ARMOR)); ++ ++ for (int i = net.minecraft.world.inventory.HorseInventoryMenu.SLOT_BODY_ARMOR + 1; i < this.getSize(); i++) { ++ net.minecraft.world.item.ItemStack item = i >= items.length ? net.minecraft.world.item.ItemStack.EMPTY : CraftItemStack.asNMSCopy(items[i]); ++ this.getMainInventory().setItem(i - 1, item); ++ } ++ } ++ ++ @Override + public ItemStack getItem(final int index) { + if (index == net.minecraft.world.inventory.HorseInventoryMenu.SLOT_BODY_ARMOR) { + final net.minecraft.world.item.ItemStack item = this.getArmorInventory().getItem(0); diff --git a/patches/server/1037-Incremental-chunk-and-player-saving.patch b/patches/server/1037-Incremental-chunk-and-player-saving.patch index a19a5893eb..9506b40544 100644 --- a/patches/server/1037-Incremental-chunk-and-player-saving.patch +++ b/patches/server/1037-Incremental-chunk-and-player-saving.patch @@ -96,7 +96,7 @@ index e50df5a1f3b89b3d0687d6584bdd977f8b71a3f6..2fe9d9b38c01d04416843fdd48d3e338 // Paper start - add close param this.save(progressListener, flush, savingDisabled, false); diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java -index dddd4fcdcd08e0221693071894818c7d3bae531b..5980b70e2d7273239245237189b2debcbccfbac3 100644 +index 8dc3ba983fd4c61e463867be8d224aa90424215a..6c280abdef5f80b668d6090f9d35283a33e21e0c 100644 --- a/src/main/java/net/minecraft/server/level/ServerPlayer.java +++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java @@ -203,6 +203,7 @@ import org.bukkit.inventory.MainHand; @@ -108,7 +108,7 @@ index dddd4fcdcd08e0221693071894818c7d3bae531b..5980b70e2d7273239245237189b2debc private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index c38c688417f769a6022dd40d6652b00e14c4df94..43eeb8ce4bc350c2b524ade11ca25d8d4d21bea5 100644 +index eb94c0a962de4dc389eb309d264b6e1c6c7229aa..0368d6ba9cc9fe557d3c7172a87a7a5b15445e47 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -569,6 +569,7 @@ public abstract class PlayerList { @@ -119,7 +119,7 @@ index c38c688417f769a6022dd40d6652b00e14c4df94..43eeb8ce4bc350c2b524ade11ca25d8d this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1183,10 +1184,22 @@ public abstract class PlayerList { +@@ -1186,10 +1187,22 @@ public abstract class PlayerList { } public void saveAll() { diff --git a/patches/server/1038-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch b/patches/server/1038-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch index 3b391d165a..114443675b 100644 --- a/patches/server/1038-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch +++ b/patches/server/1038-Attempt-to-recalculate-regionfile-header-if-it-is-co.patch @@ -74,7 +74,7 @@ index a23dc2f8f4475de1ee35bf18a7a8a53233ccac12..226af44fd469053451a0403a95ffb446 this.used.set(start, start + size); } 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 e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..eb0389ad86300665b6e057bcfa1d7c068dc6c6ab 100644 +index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..1e0439cf3f4008fa430acb90b45f5bc4cdd6d7f2 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 @@ -51,6 +51,354 @@ public class RegionFile implements AutoCloseable { @@ -411,7 +411,7 @@ index e761b63eebc1e76b2bb1cb887d83d0b63ad6ec90..eb0389ad86300665b6e057bcfa1d7c06 + // simply destroy the timestamp header, it's not used + + for (int i = 0; i < 32 * 32; ++i) { -+ this.timestamps.put(i, calculatedOffsets[i] != 0 ? (int)System.currentTimeMillis() : 0); // write a valid timestamp for valid chunks, I do not want to find out whatever dumb program actually checks this ++ this.timestamps.put(i, calculatedOffsets[i] != 0 ? RegionFile.getTimestamp() : 0); // write a valid timestamp for valid chunks, I do not want to find out whatever dumb program actually checks this + } + + // write new header diff --git a/patches/server/1039-Bundle-spark.patch b/patches/server/1039-Bundle-spark.patch index 5f68e17337..2fe8f1d8e3 100644 --- a/patches/server/1039-Bundle-spark.patch +++ b/patches/server/1039-Bundle-spark.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Bundle spark diff --git a/build.gradle.kts b/build.gradle.kts -index 1a734293c9416f13324bb0edf8f950c9029f8bc4..421f6b3dc8890d63d2e7aa774d0bf8f7e15890ab 100644 +index 1a734293c9416f13324bb0edf8f950c9029f8bc4..3588770a9ea6ee0a9508b218758650f43d994715 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -61,6 +61,10 @@ dependencies { @@ -14,7 +14,7 @@ index 1a734293c9416f13324bb0edf8f950c9029f8bc4..421f6b3dc8890d63d2e7aa774d0bf8f7 // Paper end - Remap reflection + // Paper start - spark + implementation("me.lucko:spark-api:0.1-20240720.200737-2") -+ implementation("me.lucko:spark-paper:1.10.84-20240720.204128-1") ++ implementation("me.lucko:spark-paper:1.10.99-SNAPSHOT") + // Paper end - spark } @@ -333,7 +333,7 @@ index d43b98bdfcb00603737a309c0fb7793d42289b8c..dd56c8e041116ef3602a9f89c998c820 com.destroystokyo.paper.VersionHistoryManager.INSTANCE.getClass(); // Paper - load version history now diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 3a91faeb6957e4e783b1de3e1145e7d1d164a857..c8b82bc41f2042bb4b067f06265a3a22e51f7629 100644 +index 05001bb637d55aaf36359b37a42ef33e4557b9f2..1b36e94617d4e777c419660936460d5cf8a4b3e8 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -309,6 +309,7 @@ public final class CraftServer implements Server { diff --git a/patches/server/1041-Make-interaction-leniency-distance-configurable.patch b/patches/server/1041-Make-interaction-leniency-distance-configurable.patch index c5462f81e2..92cf570915 100644 --- a/patches/server/1041-Make-interaction-leniency-distance-configurable.patch +++ b/patches/server/1041-Make-interaction-leniency-distance-configurable.patch @@ -12,10 +12,10 @@ This value however may be too low in high latency environments. The patch exposes a new configuration option to configure said value. diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index f1ca57b98fe04df2722114743c2d746c0a679c1f..4d697cd7aa5a74c2016644385f59e461f660c8bd 100644 +index 1e17d05bb6b7254e4d55b1f33cea24e1c4ef42ae..16690c9f3c720139f552473da1bde2509b1aa094 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -@@ -2698,7 +2698,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -2702,7 +2702,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl AABB axisalignedbb = entity.getBoundingBox(); diff --git a/patches/unapplied/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch b/patches/server/1046-Optimise-collision-checking-in-player-move-packet-ha.patch similarity index 91% rename from patches/unapplied/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch rename to patches/server/1046-Optimise-collision-checking-in-player-move-packet-ha.patch index 1e3006e3e6..317053f409 100644 --- a/patches/unapplied/server/1027-Optimise-collision-checking-in-player-move-packet-ha.patch +++ b/patches/server/1046-Optimise-collision-checking-in-player-move-packet-ha.patch @@ -5,10 +5,8 @@ Subject: [PATCH] Optimise collision checking in player move packet handling Move collision logic to just the hasNewCollision call instead of getCubes + hasNewCollision -CHECK ME - diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java -index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1263780b4 100644 +index 16690c9f3c720139f552473da1bde2509b1aa094..9a77b6194fb92451a5db5ca3c5984a85da9fa5e2 100644 --- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java @@ -572,7 +572,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl @@ -89,7 +87,7 @@ index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1 } @Override -@@ -1387,7 +1421,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1386,7 +1420,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -98,7 +96,7 @@ index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1 d6 = d0 - this.lastGoodX; // Paper - diff on change, used for checking large move vectors above d7 = d1 - this.lastGoodY; // Paper - diff on change, used for checking large move vectors above -@@ -1429,6 +1463,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1428,6 +1462,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl this.player.move(MoverType.PLAYER, new Vec3(d6, d7, d8)); this.player.onGround = packet.isOnGround(); // CraftBukkit - SPIGOT-5810, SPIGOT-5835, SPIGOT-6828: reset by this.player.move @@ -106,7 +104,7 @@ index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1 // Paper start - prevent position desync if (this.awaitingPositionFromClient != null) { return; // ... thanks Mojang for letting move calls teleport across dimensions. -@@ -1459,7 +1494,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1458,7 +1493,17 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } // Paper start - Add fail move event @@ -125,7 +123,7 @@ index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1 if (teleportBack) { io.papermc.paper.event.player.PlayerFailMoveEvent event = fireFailMove(io.papermc.paper.event.player.PlayerFailMoveEvent.FailReason.CLIPPED_INTO_BLOCK, toX, toY, toZ, toYaw, toPitch, false); -@@ -1570,7 +1615,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1569,7 +1614,7 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl private boolean updateAwaitingTeleport() { if (this.awaitingPositionFromClient != null) { @@ -134,7 +132,7 @@ index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1 this.awaitingTeleportTime = this.tickCount; this.teleport(this.awaitingPositionFromClient.x, this.awaitingPositionFromClient.y, this.awaitingPositionFromClient.z, this.player.getYRot(), this.player.getXRot()); } -@@ -1583,6 +1628,33 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl +@@ -1582,6 +1627,33 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl } } @@ -142,22 +140,22 @@ index 7796e191747be545e744564a2b0b65790f69114d..2b94b2dc3f29e7005b1a30c83f4a68e1 + private boolean hasNewCollision(final ServerLevel world, final Entity entity, final AABB oldBox, final AABB newBox) { + final List collisionsBB = new java.util.ArrayList<>(); + final List collisionsVoxel = new java.util.ArrayList<>(); -+ io.papermc.paper.util.CollisionUtil.getCollisions( ++ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.getCollisions( + world, entity, newBox, collisionsVoxel, collisionsBB, -+ io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS | io.papermc.paper.util.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, ++ ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_COLLIDE_WITH_UNLOADED_CHUNKS | ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.COLLISION_FLAG_CHECK_BORDER, + null, null + ); + + for (int i = 0, len = collisionsBB.size(); i < len; ++i) { + final AABB box = collisionsBB.get(i); -+ if (!io.papermc.paper.util.CollisionUtil.voxelShapeIntersect(box, oldBox)) { ++ if (!ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.voxelShapeIntersect(box, oldBox)) { + return true; + } + } + + for (int i = 0, len = collisionsVoxel.size(); i < len; ++i) { + final VoxelShape voxel = collisionsVoxel.get(i); -+ if (!io.papermc.paper.util.CollisionUtil.voxelShapeIntersectNoEmpty(voxel, oldBox)) { ++ if (!ca.spottedleaf.moonrise.patches.collisions.CollisionUtil.voxelShapeIntersectNoEmpty(voxel, oldBox)) { + return true; + } + } diff --git a/patches/server/1047-Add-skipping-world-symlink-scan.patch b/patches/server/1047-Add-skipping-world-symlink-scan.patch new file mode 100644 index 0000000000..edbbf7edf8 --- /dev/null +++ b/patches/server/1047-Add-skipping-world-symlink-scan.patch @@ -0,0 +1,21 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: mja00 +Date: Mon, 12 Aug 2024 06:27:15 -0400 +Subject: [PATCH] Add skipping world symlink scan + +In worlds that are extremely large (greater than 1TB), it can take an insanely long time to walk the entire world for symlinks. +This patch adds a system property to disable the symlink scan, which can be used to speed up world loading. + +diff --git a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +index 427ee4d6f12a7abd8da0c65e0b9081b25824df40..85ba843ce7e1f62971e736fa2cc028c47b274ce4 100644 +--- a/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java ++++ b/src/main/java/net/minecraft/world/level/storage/LevelStorageSource.java +@@ -420,7 +420,7 @@ public class LevelStorageSource { + + public LevelStorageSource.LevelStorageAccess validateAndCreateAccess(String s, ResourceKey dimensionType) throws IOException, ContentValidationException { // CraftBukkit + Path path = this.getLevelPath(s); +- List list = this.worldDirValidator.validateDirectory(path, true); ++ List list = Boolean.getBoolean("paper.disableWorldSymlinkValidation") ? List.of() : this.worldDirValidator.validateDirectory(path, true); // Paper - add skipping of symlinks scan + + if (!list.isEmpty()) { + throw new ContentValidationException(path, list); diff --git a/patches/server/1048-Add-even-more-Enchantment-API.patch b/patches/server/1048-Add-even-more-Enchantment-API.patch new file mode 100644 index 0000000000..dfc79b5b19 --- /dev/null +++ b/patches/server/1048-Add-even-more-Enchantment-API.patch @@ -0,0 +1,47 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Fri, 19 Jul 2024 08:42:45 -0700 +Subject: [PATCH] Add even more Enchantment API + +In a separate patch because RegistryKeySet is used +and the previous "more enchant api" patch is before that. + +diff --git a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +index 4221a1e9cba35c8dc58e51e162e7fcbd0e8b31af..34934f0dbe66ee200cd99c002c53645660041548 100644 +--- a/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java ++++ b/src/main/java/org/bukkit/craftbukkit/enchantments/CraftEnchantment.java +@@ -216,6 +216,34 @@ public class CraftEnchantment extends Enchantment implements Handleable getSupportedItems() { ++ return io.papermc.paper.registry.set.PaperRegistrySets.convertToApi(io.papermc.paper.registry.RegistryKey.ITEM, this.handle.value().getSupportedItems()); ++ } ++ ++ @Override ++ public io.papermc.paper.registry.set.RegistryKeySet getPrimaryItems() { ++ final java.util.Optional> primaryItems = this.handle.value().definition().primaryItems(); ++ return primaryItems.map(holders -> io.papermc.paper.registry.set.PaperRegistrySets.convertToApi(io.papermc.paper.registry.RegistryKey.ITEM, holders)).orElse(null); ++ } ++ ++ @Override ++ public int getWeight() { ++ return this.handle.value().getWeight(); ++ } ++ ++ @Override ++ public io.papermc.paper.registry.set.RegistryKeySet getExclusiveWith() { ++ return io.papermc.paper.registry.set.PaperRegistrySets.convertToApi(io.papermc.paper.registry.RegistryKey.ENCHANTMENT, this.handle.value().exclusiveSet()); ++ } ++ // Paper end - even more Enchantment API ++ + @Override + public String getTranslationKey() { + return Util.makeDescriptionId("enchantment", this.handle.unwrapKey().get().location()); diff --git a/patches/server/1049-Leashable-API.patch b/patches/server/1049-Leashable-API.patch new file mode 100644 index 0000000000..b93323b964 --- /dev/null +++ b/patches/server/1049-Leashable-API.patch @@ -0,0 +1,161 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> +Date: Sat, 22 Jun 2024 21:17:54 +0200 +Subject: [PATCH] Leashable API + + +diff --git a/src/main/java/io/papermc/paper/entity/PaperLeashable.java b/src/main/java/io/papermc/paper/entity/PaperLeashable.java +new file mode 100644 +index 0000000000000000000000000000000000000000..a9ddf9a4a07cd29833f38d7e5f42b2b14ec98f78 +--- /dev/null ++++ b/src/main/java/io/papermc/paper/entity/PaperLeashable.java +@@ -0,0 +1,50 @@ ++package io.papermc.paper.entity; ++ ++import com.google.common.base.Preconditions; ++import net.minecraft.world.entity.Leashable; ++import org.bukkit.craftbukkit.entity.CraftEntity; ++import org.bukkit.entity.Entity; ++ ++public interface PaperLeashable extends io.papermc.paper.entity.Leashable { ++ ++ Leashable getHandle(); ++ ++ @Override ++ default boolean isLeashed() { ++ return this.getHandle().getLeashHolder() != null; ++ } ++ ++ @Override ++ default Entity getLeashHolder() throws IllegalStateException { ++ Preconditions.checkState(this.isLeashed(), "Entity not leashed"); ++ return this.getHandle().getLeashHolder().getBukkitEntity(); ++ } ++ ++ private boolean unleash() { ++ if (!this.isLeashed()) { ++ return false; ++ } ++ ++ this.getHandle().dropLeash(true, false); ++ return true; ++ } ++ ++ @Override ++ default boolean setLeashHolder(Entity holder) { ++ if (this.getHandle() instanceof net.minecraft.world.entity.Entity entity && entity.generation) { ++ return false; ++ } ++ ++ if (holder == null) { ++ return this.unleash(); ++ } ++ ++ if (holder.isDead()) { ++ return false; ++ } ++ ++ this.unleash(); ++ this.getHandle().setLeashedTo(((CraftEntity) holder).getHandle(), true); ++ return true; ++ } ++} +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +index e33b1b6fd50a4eea57500cc00dba20d6edcab75d..01a9660de65688b7c1a4f9dafcb650774ce1853b 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.entity.Boat; + import org.bukkit.entity.Entity; + +-public class CraftBoat extends CraftVehicle implements Boat { ++public class CraftBoat extends CraftVehicle implements Boat, io.papermc.paper.entity.PaperLeashable { // Paper - Leashable API + + public CraftBoat(CraftServer server, net.minecraft.world.entity.vehicle.Boat entity) { + super(server, entity); +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +index d2bb0831394c03b620b2cbd8306cb82b621f34f7..beb6ad312028adb14053e3f019a4fcf6c9149373 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +@@ -753,43 +753,17 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { + + @Override + public boolean isLeashed() { +- if (!(this.getHandle() instanceof Mob)) { +- return false; +- } +- return ((Mob) this.getHandle()).getLeashHolder() != null; ++ return false; // Paper - implement in CraftMob & PaperLeashable + } + + @Override + public Entity getLeashHolder() throws IllegalStateException { +- Preconditions.checkState(this.isLeashed(), "Entity not leashed"); +- return ((Mob) this.getHandle()).getLeashHolder().getBukkitEntity(); +- } +- +- private boolean unleash() { +- if (!this.isLeashed()) { +- return false; +- } +- ((Mob) this.getHandle()).dropLeash(true, false); +- return true; ++ throw new IllegalStateException("Entity not leashed"); // Paper - implement in CraftMob & PaperLeashable + } + + @Override + public boolean setLeashHolder(Entity holder) { +- if (this.getHandle().generation || (this.getHandle() instanceof WitherBoss) || !(this.getHandle() instanceof Mob)) { +- return false; +- } +- +- if (holder == null) { +- return this.unleash(); +- } +- +- if (holder.isDead()) { +- return false; +- } +- +- this.unleash(); +- ((Mob) this.getHandle()).setLeashedTo(((CraftEntity) holder).getHandle(), true); +- return true; ++ return false; // Paper - implement in CraftMob & PaperLeashable + } + + @Override +diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +index deb66c04abefb4a88521483db1612e494bd27164..5f9f7e325e3e0276f7a475c4a4725cc0e1b54afd 100644 +--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java ++++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +@@ -11,7 +11,7 @@ import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Mob; + import org.bukkit.loot.LootTable; + +-public abstract class CraftMob extends CraftLivingEntity implements Mob { ++public abstract class CraftMob extends CraftLivingEntity implements Mob, io.papermc.paper.entity.PaperLeashable { // Paper - Leashable API + public CraftMob(CraftServer server, net.minecraft.world.entity.Mob entity) { + super(server, entity); + paperPathfinder = new com.destroystokyo.paper.entity.PaperPathfinder(entity); // Paper - Mob Pathfinding API +@@ -175,4 +175,21 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { + return getHandle().getExperienceReward((ServerLevel) this.getHandle().level(), null); + } + // Paper end ++ ++ // Paper start - Leashable API ++ @Override ++ public boolean isLeashed() { ++ return io.papermc.paper.entity.PaperLeashable.super.isLeashed(); ++ } ++ ++ @Override ++ public org.bukkit.entity.Entity getLeashHolder() throws IllegalStateException { ++ return io.papermc.paper.entity.PaperLeashable.super.getLeashHolder(); ++ } ++ ++ @Override ++ public boolean setLeashHolder(final org.bukkit.entity.Entity holder) { ++ return io.papermc.paper.entity.PaperLeashable.super.setLeashHolder(holder); ++ } ++ // Paper end - Leashable API + } diff --git a/patches/server/1050-Fix-CraftBukkit-drag-system.patch b/patches/server/1050-Fix-CraftBukkit-drag-system.patch new file mode 100644 index 0000000000..c347e07ded --- /dev/null +++ b/patches/server/1050-Fix-CraftBukkit-drag-system.patch @@ -0,0 +1,54 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Tamion <70228790+notTamion@users.noreply.github.com> +Date: Sun, 26 May 2024 22:20:21 +0200 +Subject: [PATCH] Fix CraftBukkit drag system + +== AT == +public net.minecraft.world.inventory.AbstractContainerMenu quickcraftSlots +public net.minecraft.world.inventory.AbstractContainerMenu quickcraftStatus +public net.minecraft.world.inventory.AbstractContainerMenu quickcraftType +public net.minecraft.world.inventory.AbstractContainerMenu resetQuickCraft()V + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index 9a77b6194fb92451a5db5ca3c5984a85da9fa5e2..b13057c0792067cc6b0abdf0d64a9be2cc9389a4 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -3127,6 +3127,25 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + } + break; + case QUICK_CRAFT: ++ // Paper start - Fix CraftBukkit drag system ++ AbstractContainerMenu containerMenu = this.player.containerMenu; ++ int currentStatus = this.player.containerMenu.quickcraftStatus; ++ int newStatus = AbstractContainerMenu.getQuickcraftHeader(packet.getButtonNum()); ++ if ((currentStatus != 1 || newStatus != 2 && currentStatus != newStatus)) { ++ } else if (containerMenu.getCarried().isEmpty()) { ++ } else if (newStatus == 0) { ++ } else if (newStatus == 1) { ++ } else if (newStatus == 2) { ++ if (!this.player.containerMenu.quickcraftSlots.isEmpty()) { ++ if (this.player.containerMenu.quickcraftSlots.size() == 1) { ++ int index = containerMenu.quickcraftSlots.iterator().next().index; ++ containerMenu.resetQuickCraft(); ++ this.handleContainerClick(new ServerboundContainerClickPacket(packet.getContainerId(), packet.getStateId(), index, containerMenu.quickcraftType, net.minecraft.world.inventory.ClickType.PICKUP, packet.getCarriedItem(), packet.getChangedSlots())); ++ return; ++ } ++ } ++ } ++ // Paper end - Fix CraftBukkit drag system + this.player.containerMenu.clicked(packet.getSlotNum(), packet.getButtonNum(), packet.getClickType(), this.player); + break; + case PICKUP_ALL: +diff --git a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +index 46159a127d910028c62ada90ff2d2dccc3b62fc3..dd4218e108f87f3305b76fbc8d88f488b447c609 100644 +--- a/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/AbstractContainerMenu.java +@@ -431,7 +431,7 @@ public abstract class AbstractContainerMenu { + } + } else if (this.quickcraftStatus == 2) { + if (!this.quickcraftSlots.isEmpty()) { +- if (false && this.quickcraftSlots.size() == 1) { // CraftBukkit - treat everything as a drag since we are unable to easily call InventoryClickEvent instead ++ if (this.quickcraftSlots.size() == 1) { // Paper - Fix CraftBukkit drag system + k = ((Slot) this.quickcraftSlots.iterator().next()).index; + this.resetQuickCraft(); + this.doClick(k, this.quickcraftType, ClickType.PICKUP, player); diff --git a/patches/server/1051-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch b/patches/server/1051-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch new file mode 100644 index 0000000000..052376aaeb --- /dev/null +++ b/patches/server/1051-Fix-SculkBloomEvent-firing-for-block-entity-loading.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Jake Potrebic +Date: Mon, 19 Aug 2024 13:43:06 -0700 +Subject: [PATCH] Fix SculkBloomEvent firing for block entity loading + + +diff --git a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java +index dbdd9cb76f9e2d0962001d9a1e82896c907d7aea..427e9bcb1fa9436543d7ff974eb8642ccce4a6a3 100644 +--- a/src/main/java/net/minecraft/world/level/block/SculkSpreader.java ++++ b/src/main/java/net/minecraft/world/level/block/SculkSpreader.java +@@ -125,7 +125,7 @@ public class SculkSpreader { + int i = Math.min(list.size(), 32); + + for (int j = 0; j < i; ++j) { +- this.addCursor((SculkSpreader.ChargeCursor) list.get(j)); ++ this.addCursor((SculkSpreader.ChargeCursor) list.get(j), false); // Paper - don't fire event for block entity loading + } + } + +@@ -145,16 +145,16 @@ public class SculkSpreader { + while (charge > 0) { + int j = Math.min(charge, 1000); + +- this.addCursor(new SculkSpreader.ChargeCursor(pos, j)); ++ this.addCursor(new SculkSpreader.ChargeCursor(pos, j), true); // Paper - allow firing event for other causes + charge -= j; + } + + } + +- private void addCursor(SculkSpreader.ChargeCursor cursor) { ++ private void addCursor(SculkSpreader.ChargeCursor cursor, boolean fireEvent) { // Paper - add boolean to conditionally fire SculkBloomEvent + if (this.cursors.size() < 32) { + // CraftBukkit start +- if (!this.isWorldGeneration()) { // CraftBukkit - SPIGOT-7475: Don't call event during world generation ++ if (!this.isWorldGeneration() && fireEvent) { // CraftBukkit - SPIGOT-7475: Don't call event during world generation // Paper - add boolean to conditionally fire SculkBloomEvent + CraftBlock bukkitBlock = CraftBlock.at(this.level, cursor.pos); + SculkBloomEvent event = new SculkBloomEvent(bukkitBlock, cursor.getCharge()); + Bukkit.getPluginManager().callEvent(event); diff --git a/patches/server/1052-Remove-set-damage-lootable-item-function-from-compas.patch b/patches/server/1052-Remove-set-damage-lootable-item-function-from-compas.patch new file mode 100644 index 0000000000..ac0c0e3513 --- /dev/null +++ b/patches/server/1052-Remove-set-damage-lootable-item-function-from-compas.patch @@ -0,0 +1,41 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Newwind +Date: Thu, 22 Aug 2024 22:55:37 +0200 +Subject: [PATCH] Remove set damage lootable item function from compasses + +In VanillaChestLoot, compasses accidentally have a setdamage loot +function on them, but compasses don't take durability, resulting in a warning. +This patch simply removes attempting to add damage to the compass item. + +diff --git a/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java b/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java +index 096899338640bb8a7052db06bf55e9fe33bf1cbe..cff6b265622701266349b6cf68eb874aa6fb6321 100644 +--- a/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java ++++ b/src/main/java/net/minecraft/data/loot/packs/VanillaChestLoot.java +@@ -946,7 +946,6 @@ public record VanillaChestLoot(HolderLookup.Provider registries) implements Loot + .add( + LootItem.lootTableItem(Items.COMPASS) + .apply(SetItemCountFunction.setCount(ConstantValue.exactly(1.0F))) +- .apply(SetItemDamageFunction.setDamage(UniformGenerator.between(0.15F, 0.8F))) + .setWeight(1) + ) + .add(LootItem.lootTableItem(Items.BUCKET).apply(SetItemCountFunction.setCount(UniformGenerator.between(1.0F, 2.0F))).setWeight(1)) +diff --git a/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json b/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json +index b5f5415a9f8bbb9d59926dc6c09e4a12dce2e9b9..fea6273ab4fe2383101f351a13d127e615b81d71 100644 +--- a/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json ++++ b/src/main/resources/data/minecraft/loot_table/chests/trial_chambers/intersection_barrel.json +@@ -70,15 +70,6 @@ + "add": false, + "count": 1.0, + "function": "minecraft:set_count" +- }, +- { +- "add": false, +- "damage": { +- "type": "minecraft:uniform", +- "max": 0.8, +- "min": 0.15 +- }, +- "function": "minecraft:set_damage" + } + ], + "name": "minecraft:compass" diff --git a/patches/server/1053-Properly-destroy-placed-blocks-on-the-end-platform.patch b/patches/server/1053-Properly-destroy-placed-blocks-on-the-end-platform.patch new file mode 100644 index 0000000000..9bbeddc476 --- /dev/null +++ b/patches/server/1053-Properly-destroy-placed-blocks-on-the-end-platform.patch @@ -0,0 +1,40 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: DerEchtePilz <81232921+DerEchtePilz@users.noreply.github.com> +Date: Sun, 18 Aug 2024 13:05:31 +0200 +Subject: [PATCH] Properly destroy placed blocks on the end platform + +The craftbukkit provided implementation of LevelAccessor, +BlockStateListPopulator, does not support destroyBlock calls, simply +ignoring them. + +This causes the destroyBlock calls during the generation of the end +platform to be lost. The patch moves the destroy calls and executes them +on the actual world access. + +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java +index 0bc659a8427b89b5e3211220c55b52eec6a20494..8aa5445e38622cd7cf4b3e42e9be8760827639fa 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/EndPlatformFeature.java +@@ -44,7 +44,7 @@ public class EndPlatformFeature extends Feature { + // CraftBukkit start + if (!blockList.getBlockState(blockposition_mutableblockposition1).is(block)) { + if (flag) { +- blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); ++ // blockList.destroyBlock(blockposition_mutableblockposition1, true, (Entity) null); // Paper - moved down - cb implementation of LevelAccessor does not support destroyBlock + } + + blockList.setBlock(blockposition_mutableblockposition1, block.defaultBlockState(), 3); +@@ -65,6 +65,13 @@ public class EndPlatformFeature extends Feature { + + worldaccess.getLevel().getCraftServer().getPluginManager().callEvent(portalEvent); + if (!portalEvent.isCancelled()) { ++ // Paper start - Properly destroy placed blocks on the end platform ++ if (flag) { ++ for (org.bukkit.craftbukkit.block.CraftBlockState state : blockList.getList()) { ++ worldaccess.destroyBlock(state.getPosition(), true); ++ } ++ } ++ // Paper end - Properly destroy placed blocks on the end platform + blockList.updateList(); + } + // CraftBukkit end diff --git a/patches/server/1054-Add-enchantment-seed-update-API.patch b/patches/server/1054-Add-enchantment-seed-update-API.patch new file mode 100644 index 0000000000..f66f062401 --- /dev/null +++ b/patches/server/1054-Add-enchantment-seed-update-API.patch @@ -0,0 +1,39 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: okx-code +Date: Sat, 17 Aug 2024 13:02:45 +0100 +Subject: [PATCH] Add enchantment seed update API + + +diff --git a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +index 1ef014b29645ed09ccffb898f1819428c3dc6259..9bc9b4218ffd966f43097c9e009b2926af58c810 100644 +--- a/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java ++++ b/src/main/java/net/minecraft/world/inventory/EnchantmentMenu.java +@@ -411,4 +411,10 @@ public class EnchantmentMenu extends AbstractContainerMenu { + return this.bukkitEntity; + } + // CraftBukkit end ++ ++ // Paper start - add enchantment seed update API ++ public void setEnchantmentSeed(int seed) { ++ this.enchantmentSeed.set(seed); ++ } ++ // Paper end - add enchantment seed update API + } +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java +index 259a21ff618b791f1225535a416b90386b2df3ad..fd4e87464dc76fb46d554fb8b497c19134d4273e 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/view/CraftEnchantmentView.java +@@ -26,6 +26,13 @@ public class CraftEnchantmentView extends CraftInventoryView im + return this.container.getEnchantmentSeed(); + } + ++ // Paper start - add enchantment seed update API ++ @Override ++ public void setEnchantmentSeed(int seed) { ++ this.container.setEnchantmentSeed(seed); ++ } ++ // Paper end - add enchantment seed update API ++ + @NotNull + @Override + public EnchantmentOffer[] getOffers() { diff --git a/patches/server/1055-Fix-synchronise-sending-chat-to-client-with-updating.patch b/patches/server/1055-Fix-synchronise-sending-chat-to-client-with-updating.patch new file mode 100644 index 0000000000..3ed1a7f75a --- /dev/null +++ b/patches/server/1055-Fix-synchronise-sending-chat-to-client-with-updating.patch @@ -0,0 +1,27 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Gegy +Date: Mon, 26 Aug 2024 19:45:07 +0200 +Subject: [PATCH] Fix: synchronise sending chat to client with updating message + signature cache + +In the case where multiple messages from different players are being processed in parallel, there was a potential race condition where the messages would be sent to the client in a different order than the message signature cache was updated. However, the cache relies on the fact that the client and server get the exact same updates in the same order. This race condition would cause the caches to become corrupted, and any future message received by the client would fail to validate. + +This also applies to the last seen state of the server, which becomes inconsistent in the same way as the message signature cache and would cause any messages sent to be rejected by the server too. + +diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +index b13057c0792067cc6b0abdf0d64a9be2cc9389a4..1eb56c606712a84a96d1d678ce9070b3d46e5c01 100644 +--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java ++++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java +@@ -2715,8 +2715,12 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl + return; + } + // CraftBukkit end ++ // Paper start - Ensure that client receives chat packets in the same order that we add into the message signature cache ++ synchronized (this.messageSignatureCache) { + this.send(new ClientboundPlayerChatPacket(message.link().sender(), message.link().index(), message.signature(), message.signedBody().pack(this.messageSignatureCache), message.unsignedContent(), message.filterMask(), params)); + this.addPendingMessage(message); ++ } ++ // Paper end - Ensure that client receives chat packets in the same order that we add into the message signature cache + } + + public void sendDisguisedChatMessage(Component message, ChatType.Bound params) { diff --git a/patches/server/1046-SW-WallBlock-Cache-Improvements.patch b/patches/server/1056-SW-WallBlock-Cache-Improvements.patch similarity index 100% rename from patches/server/1046-SW-WallBlock-Cache-Improvements.patch rename to patches/server/1056-SW-WallBlock-Cache-Improvements.patch diff --git a/patches/server/1047-SW-Remove-Debug-Messages.patch b/patches/server/1057-SW-Remove-Debug-Messages.patch similarity index 100% rename from patches/server/1047-SW-Remove-Debug-Messages.patch rename to patches/server/1057-SW-Remove-Debug-Messages.patch diff --git a/patches/server/1048-SW-Use-optimized-NeighbourTable.patch b/patches/server/1058-SW-Use-optimized-NeighbourTable.patch similarity index 100% rename from patches/server/1048-SW-Use-optimized-NeighbourTable.patch rename to patches/server/1058-SW-Use-optimized-NeighbourTable.patch diff --git a/patches/server/1049-SW-optimized-Blocks-cache.patch b/patches/server/1059-SW-optimized-Blocks-cache.patch similarity index 100% rename from patches/server/1049-SW-optimized-Blocks-cache.patch rename to patches/server/1059-SW-optimized-Blocks-cache.patch diff --git a/patches/server/1050-SW-Remove-or-Optimize-Caches.patch b/patches/server/1060-SW-Remove-or-Optimize-Caches.patch similarity index 100% rename from patches/server/1050-SW-Remove-or-Optimize-Caches.patch rename to patches/server/1060-SW-Remove-or-Optimize-Caches.patch diff --git a/patches/server/1051-SW-Disable-Commands.patch b/patches/server/1061-SW-Disable-Commands.patch similarity index 100% rename from patches/server/1051-SW-Disable-Commands.patch rename to patches/server/1061-SW-Disable-Commands.patch diff --git a/patches/server/1052-SW-Remove-World-Lock.patch b/patches/server/1062-SW-Remove-World-Lock.patch similarity index 100% rename from patches/server/1052-SW-Remove-World-Lock.patch rename to patches/server/1062-SW-Remove-World-Lock.patch diff --git a/work/Bukkit b/work/Bukkit index facd52d216..4068c6aa92 160000 --- a/work/Bukkit +++ b/work/Bukkit @@ -1 +1 @@ -Subproject commit facd52d216243e2b7f90a9f4d5cc54a8f4bbcbf7 +Subproject commit 4068c6aa92024936b8d21a56d83048784d700864 diff --git a/work/CraftBukkit b/work/CraftBukkit index b95736b13f..7548afcf24 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit b95736b13f776ba47322313f482c0520630c3533 +Subproject commit 7548afcf2470885065171982aa1c813196e98b09 diff --git a/work/Spigot b/work/Spigot index 5a6439b9ec..ca581228b6 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit 5a6439b9eca2e28522873a0488e142cfc089c0fe +Subproject commit ca581228b6f5c2b4ee8236f604d5ea288f970c24