From 16d7d73bd590d4c0e99124feae8a46225222a541 Mon Sep 17 00:00:00 2001 From: Jake Potrebic Date: Thu, 31 Oct 2024 20:35:06 -0700 Subject: [PATCH] bunch more general fixes --- .../paper/registry/keys/AttributeKeys.java | 259 ++++++++++++++++++ .../paper/registry/keys/FluidKeys.java | 70 +++++ .../paper/registry/keys/GameEventKeys.java | 9 +- .../java/io/papermc/generator/Generators.java | 6 +- patches/api/0004-Code-Generation.patch | 17 +- .../api/0465-Fix-issues-with-recipe-API.patch | 15 + patches/api/0468-General-ItemMeta-fixes.patch | 11 +- ...-removal-all-OldEnum-related-methods.patch | 75 +++++ ...gistryAccess-for-managing-Registries.patch | 4 +- .../server/0953-General-ItemMeta-fixes.patch | 62 +++-- ...958-Fix-equipment-slot-and-group-API.patch | 6 +- ...0994-Add-registry-entry-and-builders.patch | 6 +- ...CanPlaceOn-and-CanDestroy-NBT-values.patch | 4 +- 13 files changed, 504 insertions(+), 40 deletions(-) create mode 100644 paper-api-generator/generated/io/papermc/paper/registry/keys/AttributeKeys.java create mode 100644 paper-api-generator/generated/io/papermc/paper/registry/keys/FluidKeys.java diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/AttributeKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/AttributeKeys.java new file mode 100644 index 0000000000..563ddf0af4 --- /dev/null +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/AttributeKeys.java @@ -0,0 +1,259 @@ +package io.papermc.paper.registry.keys; + +import static net.kyori.adventure.key.Key.key; + +import io.papermc.paper.generated.GeneratedFrom; +import io.papermc.paper.registry.RegistryKey; +import io.papermc.paper.registry.TypedKey; +import net.kyori.adventure.key.Key; +import org.bukkit.attribute.Attribute; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus; + +/** + * Vanilla keys for {@link RegistryKey#ATTRIBUTE}. + * + * @apiNote The fields provided here are a direct representation of + * what is available from the vanilla game source. They may be + * changed (including removals) on any Minecraft version + * bump, so cross-version compatibility is not provided on the + * same level as it is on most of the other API. + */ +@SuppressWarnings({ + "unused", + "SpellCheckingInspection" +}) +@GeneratedFrom("1.21.3") +@ApiStatus.Experimental +public final class AttributeKeys { + /** + * {@code minecraft:armor} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey ARMOR = create(key("armor")); + + /** + * {@code minecraft:armor_toughness} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey ARMOR_TOUGHNESS = create(key("armor_toughness")); + + /** + * {@code minecraft:attack_damage} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey ATTACK_DAMAGE = create(key("attack_damage")); + + /** + * {@code minecraft:attack_knockback} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey ATTACK_KNOCKBACK = create(key("attack_knockback")); + + /** + * {@code minecraft:attack_speed} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey ATTACK_SPEED = create(key("attack_speed")); + + /** + * {@code minecraft:block_break_speed} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey BLOCK_BREAK_SPEED = create(key("block_break_speed")); + + /** + * {@code minecraft:block_interaction_range} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey BLOCK_INTERACTION_RANGE = create(key("block_interaction_range")); + + /** + * {@code minecraft:burning_time} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey BURNING_TIME = create(key("burning_time")); + + /** + * {@code minecraft:entity_interaction_range} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey ENTITY_INTERACTION_RANGE = create(key("entity_interaction_range")); + + /** + * {@code minecraft:explosion_knockback_resistance} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey EXPLOSION_KNOCKBACK_RESISTANCE = create(key("explosion_knockback_resistance")); + + /** + * {@code minecraft:fall_damage_multiplier} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey FALL_DAMAGE_MULTIPLIER = create(key("fall_damage_multiplier")); + + /** + * {@code minecraft:flying_speed} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey FLYING_SPEED = create(key("flying_speed")); + + /** + * {@code minecraft:follow_range} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey FOLLOW_RANGE = create(key("follow_range")); + + /** + * {@code minecraft:gravity} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey GRAVITY = create(key("gravity")); + + /** + * {@code minecraft:jump_strength} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey JUMP_STRENGTH = create(key("jump_strength")); + + /** + * {@code minecraft:knockback_resistance} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey KNOCKBACK_RESISTANCE = create(key("knockback_resistance")); + + /** + * {@code minecraft:luck} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey LUCK = create(key("luck")); + + /** + * {@code minecraft:max_absorption} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey MAX_ABSORPTION = create(key("max_absorption")); + + /** + * {@code minecraft:max_health} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey MAX_HEALTH = create(key("max_health")); + + /** + * {@code minecraft:mining_efficiency} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey MINING_EFFICIENCY = create(key("mining_efficiency")); + + /** + * {@code minecraft:movement_efficiency} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey MOVEMENT_EFFICIENCY = create(key("movement_efficiency")); + + /** + * {@code minecraft:movement_speed} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey MOVEMENT_SPEED = create(key("movement_speed")); + + /** + * {@code minecraft:oxygen_bonus} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey OXYGEN_BONUS = create(key("oxygen_bonus")); + + /** + * {@code minecraft:safe_fall_distance} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey SAFE_FALL_DISTANCE = create(key("safe_fall_distance")); + + /** + * {@code minecraft:scale} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey SCALE = create(key("scale")); + + /** + * {@code minecraft:sneaking_speed} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey SNEAKING_SPEED = create(key("sneaking_speed")); + + /** + * {@code minecraft:spawn_reinforcements} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey SPAWN_REINFORCEMENTS = create(key("spawn_reinforcements")); + + /** + * {@code minecraft:step_height} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey STEP_HEIGHT = create(key("step_height")); + + /** + * {@code minecraft:submerged_mining_speed} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey SUBMERGED_MINING_SPEED = create(key("submerged_mining_speed")); + + /** + * {@code minecraft:sweeping_damage_ratio} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey SWEEPING_DAMAGE_RATIO = create(key("sweeping_damage_ratio")); + + /** + * {@code minecraft:tempt_range} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey TEMPT_RANGE = create(key("tempt_range")); + + /** + * {@code minecraft:water_movement_efficiency} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey WATER_MOVEMENT_EFFICIENCY = create(key("water_movement_efficiency")); + + private AttributeKeys() { + } + + private static @NonNull TypedKey create(final @NonNull Key key) { + return TypedKey.create(RegistryKey.ATTRIBUTE, key); + } +} diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/FluidKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/FluidKeys.java new file mode 100644 index 0000000000..673b816854 --- /dev/null +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/FluidKeys.java @@ -0,0 +1,70 @@ +package io.papermc.paper.registry.keys; + +import static net.kyori.adventure.key.Key.key; + +import io.papermc.paper.generated.GeneratedFrom; +import io.papermc.paper.registry.RegistryKey; +import io.papermc.paper.registry.TypedKey; +import net.kyori.adventure.key.Key; +import org.bukkit.Fluid; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.jetbrains.annotations.ApiStatus; + +/** + * Vanilla keys for {@link RegistryKey#FLUID}. + * + * @apiNote The fields provided here are a direct representation of + * what is available from the vanilla game source. They may be + * changed (including removals) on any Minecraft version + * bump, so cross-version compatibility is not provided on the + * same level as it is on most of the other API. + */ +@SuppressWarnings({ + "unused", + "SpellCheckingInspection" +}) +@GeneratedFrom("1.21.3") +@ApiStatus.Experimental +public final class FluidKeys { + /** + * {@code minecraft:empty} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey EMPTY = create(key("empty")); + + /** + * {@code minecraft:flowing_lava} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey FLOWING_LAVA = create(key("flowing_lava")); + + /** + * {@code minecraft:flowing_water} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey FLOWING_WATER = create(key("flowing_water")); + + /** + * {@code minecraft:lava} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey LAVA = create(key("lava")); + + /** + * {@code minecraft:water} + * + * @apiNote This field is version-dependant and may be removed in future Minecraft versions + */ + public static final TypedKey WATER = create(key("water")); + + private FluidKeys() { + } + + private static @NonNull TypedKey create(final @NonNull Key key) { + return TypedKey.create(RegistryKey.FLUID, key); + } +} diff --git a/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java b/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java index d3751e33e2..80beed3ca2 100644 --- a/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java +++ b/paper-api-generator/generated/io/papermc/paper/registry/keys/GameEventKeys.java @@ -449,7 +449,14 @@ public final class GameEventKeys { private GameEventKeys() { } - private static @NonNull TypedKey create(final @NonNull Key key) { + /** + * Creates a key for {@link GameEvent} in the registry {@code minecraft:game_event}. + * + * @param key the value's key in the registry + * @return a new typed key + */ + @ApiStatus.Experimental + public static @NonNull TypedKey create(final @NonNull Key key) { return TypedKey.create(RegistryKey.GAME_EVENT, key); } } diff --git a/paper-api-generator/src/main/java/io/papermc/generator/Generators.java b/paper-api-generator/src/main/java/io/papermc/generator/Generators.java index c46e0b2b61..0ff8225f51 100644 --- a/paper-api-generator/src/main/java/io/papermc/generator/Generators.java +++ b/paper-api-generator/src/main/java/io/papermc/generator/Generators.java @@ -8,9 +8,11 @@ import io.papermc.paper.registry.RegistryKey; import net.minecraft.core.Registry; import net.minecraft.core.registries.Registries; import net.minecraft.resources.ResourceKey; +import org.bukkit.Fluid; import org.bukkit.GameEvent; import org.bukkit.JukeboxSong; import org.bukkit.MusicInstrument; +import org.bukkit.attribute.Attribute; import org.bukkit.block.Biome; import org.bukkit.block.BlockType; import org.bukkit.block.banner.PatternType; @@ -33,7 +35,7 @@ public interface Generators { SourceGenerator[] API = { // built-ins - simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, false), + simpleKey("GameEventKeys", GameEvent.class, Registries.GAME_EVENT, RegistryKey.GAME_EVENT, true), simpleKey("StructureTypeKeys", StructureType.class, Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, false), simpleKey("InstrumentKeys", MusicInstrument.class, Registries.INSTRUMENT, RegistryKey.INSTRUMENT, false), simpleKey("MobEffectKeys", PotionEffectType.class, Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, false), @@ -45,6 +47,8 @@ public interface Generators { simpleKey("VillagerTypeKeys", Villager.Type.class, Registries.VILLAGER_TYPE, RegistryKey.VILLAGER_TYPE, false), simpleKey("MapDecorationTypeKeys", MapCursor.Type.class, Registries.MAP_DECORATION_TYPE, RegistryKey.MAP_DECORATION_TYPE, false), simpleKey("MenuTypeKeys", MenuType.class, Registries.MENU, RegistryKey.MENU, false), + simpleKey("AttributeKeys", Attribute.class, Registries.ATTRIBUTE, RegistryKey.ATTRIBUTE, false), + simpleKey("FluidKeys", Fluid.class, Registries.FLUID, RegistryKey.FLUID, false), // data-driven simpleKey("BiomeKeys", Biome.class, Registries.BIOME, RegistryKey.BIOME, true), diff --git a/patches/api/0004-Code-Generation.patch b/patches/api/0004-Code-Generation.patch index cc7000b9c6..e265943f63 100644 --- a/patches/api/0004-Code-Generation.patch +++ b/patches/api/0004-Code-Generation.patch @@ -85,10 +85,10 @@ index 0000000000000000000000000000000000000000..2512dba27edfdccbc4430815b6cba048 +} diff --git a/src/main/java/io/papermc/paper/registry/RegistryKey.java b/src/main/java/io/papermc/paper/registry/RegistryKey.java new file mode 100644 -index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96f150c49a +index 0000000000000000000000000000000000000000..fdef87eec3765523b00c987d4c1ccc289882e95d --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/RegistryKey.java -@@ -0,0 +1,179 @@ +@@ -0,0 +1,188 @@ +package io.papermc.paper.registry; + +import net.kyori.adventure.key.Keyed; @@ -204,6 +204,17 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96 + * @see io.papermc.paper.registry.keys.MenuTypeKeys + */ + RegistryKey MENU = create("menu"); ++ /** ++ * Built-in registry for attributes. ++ * @see io.papermc.paper.registry.keys.AttributeKeys ++ */ ++ RegistryKey ATTRIBUTE = create("attribute"); ++ /** ++ * Built-in registry for fluids. ++ * @see io.papermc.paper.registry.keys.FluidKeys ++ */ ++ RegistryKey FLUID = create("fluid"); ++ + + + /* ********************** * @@ -260,13 +271,11 @@ index 0000000000000000000000000000000000000000..8410d7213370f01cbedbf7fac29bac96 + * API-only Registries * + * ******************* */ + RegistryKey PAINTING_VARIANT = create("painting_variant"); -+ RegistryKey ATTRIBUTE = create("attribute"); + RegistryKey ENTITY_TYPE = create("entity_type"); + RegistryKey PARTICLE_TYPE = create("particle_type"); + RegistryKey POTION = create("potion"); + RegistryKey SOUND_EVENT = create("sound_event"); + RegistryKey> MEMORY_MODULE_TYPE = create("memory_module_type"); -+ RegistryKey FLUID = create("fluid"); +} diff --git a/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java b/src/main/java/io/papermc/paper/registry/RegistryKeyImpl.java new file mode 100644 diff --git a/patches/api/0465-Fix-issues-with-recipe-API.patch b/patches/api/0465-Fix-issues-with-recipe-API.patch index 646143b638..f8c42742cb 100644 --- a/patches/api/0465-Fix-issues-with-recipe-API.patch +++ b/patches/api/0465-Fix-issues-with-recipe-API.patch @@ -441,3 +441,18 @@ index bc3440eb72127824b3961fbdae583bb61385f65e..17b33f8e6e3dc6a22686a498fa944382 return (StonecuttingRecipe) this; } +diff --git a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java +index 5a8616792ade898c702daf471a2511c0f467df5c..8484b045ce4bf5292cda7d512c5ee3a86480049b 100644 +--- a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java ++++ b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java +@@ -26,8 +26,8 @@ public class TransmuteRecipe extends CraftingRecipe implements ComplexRecipe { + */ + public TransmuteRecipe(@NotNull NamespacedKey key, @NotNull Material result, @NotNull RecipeChoice input, @NotNull RecipeChoice material) { + super(key, checkResult(new ItemStack(result))); +- this.input = input; +- this.material = material; ++ this.input = input.validate(false).clone(); // Paper ++ this.material = material.validate(false).clone(); // Paper + } + + /** diff --git a/patches/api/0468-General-ItemMeta-fixes.patch b/patches/api/0468-General-ItemMeta-fixes.patch index 953fd2e49c..c6e38d89da 100644 --- a/patches/api/0468-General-ItemMeta-fixes.patch +++ b/patches/api/0468-General-ItemMeta-fixes.patch @@ -112,9 +112,18 @@ 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/ItemMeta.java b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java -index afdcc2d67d55f2f07c913816e1f5b290d1415357..fc089b796f5a0f2e1ab081cc710e4bb5c3f5ee7b 100644 +index afdcc2d67d55f2f07c913816e1f5b290d1415357..3fdba38fd5e75ddcbfca9cee70a606bfa4a539bf 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +@@ -328,7 +328,7 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste + /** + * Sets the enchantable. Higher values allow higher enchantments. + * +- * @param enchantable enchantable value ++ * @param enchantable enchantable value, must be positive + */ + void setEnchantable(@Nullable Integer enchantable); + @@ -877,8 +877,9 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste /** diff --git a/patches/api/0483-Deprecate-for-removal-all-OldEnum-related-methods.patch b/patches/api/0483-Deprecate-for-removal-all-OldEnum-related-methods.patch index bac872611c..abb2e9d9f4 100644 --- a/patches/api/0483-Deprecate-for-removal-all-OldEnum-related-methods.patch +++ b/patches/api/0483-Deprecate-for-removal-all-OldEnum-related-methods.patch @@ -4,6 +4,81 @@ Date: Sat, 7 Sep 2024 11:14:31 -0700 Subject: [PATCH] Deprecate for removal all OldEnum-related methods +diff --git a/src/main/java/org/bukkit/Fluid.java b/src/main/java/org/bukkit/Fluid.java +index dff295a4ca877b172f04c60de734c1551afdb5a7..a3ff4fefaf50f3e99a69ba68cbe8e30c95dac5df 100644 +--- a/src/main/java/org/bukkit/Fluid.java ++++ b/src/main/java/org/bukkit/Fluid.java +@@ -43,7 +43,7 @@ public interface Fluid extends OldEnum, Keyed { + * @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead. + */ + @NotNull +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + static Fluid valueOf(@NotNull String name) { + Fluid fluid = Bukkit.getUnsafe().get(Registry.FLUID, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT))); + Preconditions.checkArgument(fluid != null, "No fluid found with the name %s", name); +@@ -55,7 +55,7 @@ public interface Fluid extends OldEnum, Keyed { + * @deprecated use {@link Registry#iterator()}. + */ + @NotNull +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + static Fluid[] values() { + return Lists.newArrayList(Registry.FLUID).toArray(new Fluid[0]); + } +diff --git a/src/main/java/org/bukkit/attribute/Attribute.java b/src/main/java/org/bukkit/attribute/Attribute.java +index 21f9998b472dc18eb308554f5cdf467f6675f2f0..521f035409ee61a9ad73d39bec938f2938892570 100644 +--- a/src/main/java/org/bukkit/attribute/Attribute.java ++++ b/src/main/java/org/bukkit/attribute/Attribute.java +@@ -156,7 +156,7 @@ public interface Attribute extends OldEnum, Keyed, Translatable, net. + * @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead. + */ + @NotNull +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + static Attribute valueOf(@NotNull String name) { + Attribute attribute = Bukkit.getUnsafe().get(Registry.ATTRIBUTE, NamespacedKey.fromString(name.toLowerCase(Locale.ROOT))); + Preconditions.checkArgument(attribute != null, "No attribute found with the name %s", name); +@@ -168,7 +168,7 @@ public interface Attribute extends OldEnum, Keyed, Translatable, net. + * @deprecated use {@link Registry#iterator()}. + */ + @NotNull +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + static Attribute[] values() { + return Lists.newArrayList(Registry.ATTRIBUTE).toArray(new Attribute[0]); + } +diff --git a/src/main/java/org/bukkit/block/Biome.java b/src/main/java/org/bukkit/block/Biome.java +index b352886e697a1c9869226b583da5240592575064..464f8f81ba907a61588e4ab869e4f8269830195a 100644 +--- a/src/main/java/org/bukkit/block/Biome.java ++++ b/src/main/java/org/bukkit/block/Biome.java +@@ -97,7 +97,7 @@ public interface Biome extends OldEnum, Keyed, net.kyori.adventure.transl + * + * @deprecated Biome is no longer an enum, custom biomes will have their own biome instance. + */ +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + Biome CUSTOM = Bukkit.getUnsafe().getCustomBiome(); + + @NotNull +@@ -111,7 +111,7 @@ public interface Biome extends OldEnum, Keyed, net.kyori.adventure.transl + * @deprecated only for backwards compatibility, use {@link Registry#get(NamespacedKey)} instead. + */ + @NotNull +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + static Biome valueOf(@NotNull String name) { + if ("CUSTOM".equals(name)) { + return Biome.CUSTOM; +@@ -127,7 +127,7 @@ public interface Biome extends OldEnum, Keyed, net.kyori.adventure.transl + * @deprecated use {@link Registry#iterator()}. + */ + @NotNull +- @Deprecated(since = "1.21.3") ++ @Deprecated(since = "1.21.3", forRemoval = true) @org.jetbrains.annotations.ApiStatus.ScheduledForRemoval(inVersion = "1.22") // Paper - will be removed via asm-utils + static Biome[] values() { + return Lists.newArrayList(Registry.BIOME).toArray(new Biome[0]); + } diff --git a/src/main/java/org/bukkit/block/banner/PatternType.java b/src/main/java/org/bukkit/block/banner/PatternType.java index eb192030832e1741850871bec9bf999f014b6fc1..70904d6c43b93cb7b9d74d20666fac93a6b4996c 100644 --- a/src/main/java/org/bukkit/block/banner/PatternType.java diff --git a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch index fbb76f2784..81d859b6fb 100644 --- a/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/0467-Add-RegistryAccess-for-managing-Registries.patch @@ -12,7 +12,7 @@ public net.minecraft.server.RegistryLayer STATIC_ACCESS diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java new file mode 100644 -index 0000000000000000000000000000000000000000..b5df90b500a64ee3ba1026fa3449ca6441293367 +index 0000000000000000000000000000000000000000..9657c35ffbcc12061b394b97c97224e699c99b4f --- /dev/null +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -0,0 +1,152 @@ @@ -108,6 +108,7 @@ index 0000000000000000000000000000000000000000..b5df90b500a64ee3ba1026fa3449ca64 + entry(Registries.FLUID, RegistryKey.FLUID, Fluid.class, CraftFluid::new), + + // data-drivens ++ entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), + entry(Registries.STRUCTURE, RegistryKey.STRUCTURE, Structure.class, CraftStructure::new).delayed(), + entry(Registries.TRIM_MATERIAL, RegistryKey.TRIM_MATERIAL, TrimMaterial.class, CraftTrimMaterial::new).delayed(), + entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(), @@ -116,7 +117,6 @@ index 0000000000000000000000000000000000000000..b5df90b500a64ee3ba1026fa3449ca64 + entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(), + entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(), + entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(), -+ entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), + + // api-only + apiOnly(Registries.PAINTING_VARIANT, RegistryKey.PAINTING_VARIANT, () -> org.bukkit.Registry.ART), diff --git a/patches/server/0953-General-ItemMeta-fixes.patch b/patches/server/0953-General-ItemMeta-fixes.patch index 54c99087b9..2d0ebcfcf9 100644 --- a/patches/server/0953-General-ItemMeta-fixes.patch +++ b/patches/server/0953-General-ItemMeta-fixes.patch @@ -1049,7 +1049,7 @@ index 566d893a413fd04b99e83dc2da8fe958a48492a8..a944803771d514572f94b4e98a6d4435 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec532cc0d9ba 100644 +index 14aab3a2adfde7a236610be2b928651bc01067f5..71d0ade48d450b76be9cb396ac613fa4c783679e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -199,9 +199,10 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -1177,7 +1177,15 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 if (lore == null) { this.lore = null; } else { -@@ -1596,6 +1603,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1420,6 +1427,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + + @Override + public void setEnchantable(Integer data) { ++ Preconditions.checkArgument(data > 0, "Enchantability must be > 0"); + this.enchantableValue = data; + } + +@@ -1596,6 +1604,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public void setUseRemainder(ItemStack useRemainder) { @@ -1185,7 +1193,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 this.useRemainder = useRemainder; } -@@ -1606,7 +1614,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1606,7 +1615,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public UseCooldownComponent getUseCooldown() { @@ -1194,7 +1202,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 } @Override -@@ -1692,7 +1700,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1692,7 +1701,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public Multimap getAttributeModifiers(@Nullable EquipmentSlot slot) { @@ -1203,7 +1211,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 SetMultimap result = LinkedHashMultimap.create(); for (Map.Entry entry : this.attributeModifiers.entries()) { if (entry.getValue().getSlot() == null || entry.getValue().getSlot() == slot) { -@@ -1705,6 +1713,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1705,6 +1714,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public Collection getAttributeModifiers(@Nonnull Attribute attribute) { Preconditions.checkNotNull(attribute, "Attribute cannot be null"); @@ -1211,7 +1219,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 return this.attributeModifiers.containsKey(attribute) ? ImmutableList.copyOf(this.attributeModifiers.get(attribute)) : null; } -@@ -1712,22 +1721,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1712,22 +1722,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { public boolean addAttributeModifier(@Nonnull Attribute attribute, @Nonnull AttributeModifier modifier) { Preconditions.checkNotNull(attribute, "Attribute cannot be null"); Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); @@ -1249,7 +1257,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 Iterator> iterator = attributeModifiers.entries().iterator(); while (iterator.hasNext()) { -@@ -1737,6 +1757,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1737,6 +1758,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { iterator.remove(); continue; } @@ -1257,7 +1265,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 this.attributeModifiers.put(next.getKey(), next.getValue()); } } -@@ -1744,13 +1765,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1744,13 +1766,13 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public boolean removeAttributeModifier(@Nonnull Attribute attribute) { Preconditions.checkNotNull(attribute, "Attribute cannot be null"); @@ -1273,7 +1281,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 int removed = 0; Iterator> iter = this.attributeModifiers.entries().iterator(); -@@ -1770,7 +1791,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1770,7 +1792,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { public boolean removeAttributeModifier(@Nonnull Attribute attribute, @Nonnull AttributeModifier modifier) { Preconditions.checkNotNull(attribute, "Attribute cannot be null"); Preconditions.checkNotNull(modifier, "AttributeModifier cannot be null"); @@ -1282,7 +1290,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 int removed = 0; Iterator> iter = this.attributeModifiers.entries().iterator(); -@@ -1792,7 +1813,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1792,7 +1814,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public String getAsString() { @@ -1291,7 +1299,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 this.applyToItem(tag); DataComponentPatch patch = tag.build(); net.minecraft.nbt.Tag nbt = DataComponentPatch.CODEC.encodeStart(MinecraftServer.getDefaultRegistryAccess().createSerializationContext(NbtOps.INSTANCE), patch).getOrThrow(); -@@ -1801,7 +1822,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1801,7 +1823,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public String getAsComponentString() { @@ -1300,7 +1308,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 this.applyToItem(tag); DataComponentPatch patch = tag.build(); -@@ -1841,6 +1862,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1841,6 +1863,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { if (first == null || second == null) { return false; } @@ -1308,7 +1316,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 for (Map.Entry entry : first.entries()) { if (!second.containsEntry(entry.getKey(), entry.getValue())) { return false; -@@ -1856,19 +1878,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1856,19 +1879,33 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public boolean hasDamage() { @@ -1344,7 +1352,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 @Override public boolean hasMaxDamage() { return this.maxDamage != null; -@@ -1882,6 +1918,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1882,6 +1919,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override public void setMaxDamage(Integer maxDamage) { @@ -1352,7 +1360,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 this.maxDamage = maxDamage; } -@@ -1914,7 +1951,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1914,7 +1952,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { && (this.hasEnchantable() ? that.hasEnchantable() && this.enchantableValue.equals(that.enchantableValue) : !that.hasEnchantable()) && (this.hasBlockData() ? that.hasBlockData() && this.blockData.equals(that.blockData) : !that.hasBlockData()) && (this.hasRepairCost() ? that.hasRepairCost() && this.repairCost == that.repairCost : !that.hasRepairCost()) @@ -1361,7 +1369,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 && (this.unhandledTags.equals(that.unhandledTags)) && (this.removedTags.equals(that.removedTags)) && (Objects.equals(this.customTag, that.customTag)) -@@ -1935,7 +1972,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1935,7 +1973,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { && (this.hasTool() ? that.hasTool() && this.tool.equals(that.tool) : !that.hasTool()) && (this.hasEquippable() ? that.hasEquippable() && this.equippable.equals(that.equippable) : !that.hasEquippable()) && (this.hasJukeboxPlayable() ? that.hasJukeboxPlayable() && this.jukebox.equals(that.jukebox) : !that.hasJukeboxPlayable()) @@ -1370,7 +1378,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 && (this.hasMaxDamage() ? that.hasMaxDamage() && this.maxDamage.equals(that.maxDamage) : !that.hasMaxDamage()) && (this.canPlaceOnPredicates != null ? that.canPlaceOnPredicates != null && this.canPlaceOnPredicates.equals(that.canPlaceOnPredicates) : that.canPlaceOnPredicates == null) // Paper && (this.canBreakPredicates != null ? that.canBreakPredicates != null && this.canBreakPredicates.equals(that.canBreakPredicates) : that.canBreakPredicates == null) // Paper -@@ -1988,9 +2025,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1988,9 +2026,9 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { hash = 61 * hash + (this.hasTool() ? this.tool.hashCode() : 0); hash = 61 * hash + (this.hasJukeboxPlayable() ? this.jukebox.hashCode() : 0); hash = 61 * hash + (this.hasEquippable() ? this.equippable.hashCode() : 0); @@ -1383,7 +1391,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 hash = 61 * hash + (this.canPlaceOnPredicates != null ? this.canPlaceOnPredicates.hashCode() : 0); // Paper hash = 61 * hash + (this.canBreakPredicates != null ? this.canBreakPredicates.hashCode() : 0); // Paper hash = 61 * hash + this.version; -@@ -2011,7 +2048,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -2011,7 +2049,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { if (this.enchantments != null) { clone.enchantments = new EnchantmentMap(this.enchantments); // Paper } @@ -1392,7 +1400,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 clone.attributeModifiers = LinkedHashMultimap.create(this.attributeModifiers); } if (this.customTag != null) { -@@ -2178,7 +2215,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -2178,7 +2216,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { builder.put(CraftMetaItem.JUKEBOX_PLAYABLE.BUKKIT, this.jukebox); } @@ -1401,7 +1409,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 builder.put(CraftMetaItem.DAMAGE.BUKKIT, this.damage); } -@@ -2279,7 +2316,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -2279,7 +2317,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } static void serializeModifiers(Multimap modifiers, ImmutableMap.Builder builder, ItemMetaKey key) { @@ -1410,7 +1418,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 return; } -@@ -2361,7 +2398,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -2361,7 +2399,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { // Paper start - improve checking handled tags @org.jetbrains.annotations.VisibleForTesting public static final Map, Set>> HANDLED_DCTS_PER_TYPE = new HashMap<>(); @@ -1419,7 +1427,7 @@ index 14aab3a2adfde7a236610be2b928651bc01067f5..5eb1f0126c3d3bca9bf3e769bec4ec53 CraftMetaItem.NAME.TYPE, CraftMetaItem.ITEM_NAME.TYPE, CraftMetaItem.LORE.TYPE, -@@ -2437,7 +2474,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -2437,7 +2475,12 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { // Paper end - improve checking handled data component types protected static Optional getOrEmpty(DataComponentPatch tag, ItemMetaKeyType type) { @@ -1606,7 +1614,7 @@ index b118d8ecb505d187c02bb158f14df333f487a87f..fa1d1a7f37aadf2750f03a0e215fb25f } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java -index 6f0eebcaffa20337cf5a7f8485f891c690d948ae..18dc2e83dab0821e5129bd68361de189363823b3 100644 +index 6f0eebcaffa20337cf5a7f8485f891c690d948ae..49690dab508b07f9f56b2fb21eeb5f20172b5bd3 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaPotion.java @@ -38,7 +38,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { @@ -1651,6 +1659,14 @@ index 6f0eebcaffa20337cf5a7f8485f891c690d948ae..18dc2e83dab0821e5129bd68361de189 } @Override +@@ -317,6 +317,7 @@ class CraftMetaPotion extends CraftMetaItem implements PotionMeta { + + @Override + public void setCustomName(String customName) { ++ Preconditions.checkArgument(customName == null || customName.length() <= 32767, "Custom name is longer than 32767 characters"); + this.customName = customName; + } + diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java index 967d8940aec0065bce496d5d7a8c73de5733bd2c..e229ca6acb6dbc3185f326f6653b3d66d835a9e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java diff --git a/patches/server/0958-Fix-equipment-slot-and-group-API.patch b/patches/server/0958-Fix-equipment-slot-and-group-API.patch index 3248a82d09..8c113014bb 100644 --- a/patches/server/0958-Fix-equipment-slot-and-group-API.patch +++ b/patches/server/0958-Fix-equipment-slot-and-group-API.patch @@ -52,10 +52,10 @@ index e62baea16df017f1e394e3c706157e158066eb93..656c9a6d8cd42891141ee29ec91ab5d1 throw new IllegalArgumentException("Could not get slot " + slot + " - not a valid slot for PlayerInventory"); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index a6e2281bfac94f1e19836d9c8415d8270387b16d..a4d6c95e55722c9a0e381d7b84916787240cea8e 100644 +index 71d0ade48d450b76be9cb396ac613fa4c783679e..b24857e34d87ea4fa9aa0db0ba684014c2625cc1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -1703,7 +1703,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1704,7 +1704,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { if (this.attributeModifiers == null) return LinkedHashMultimap.create(); // Paper - don't change the components SetMultimap result = LinkedHashMultimap.create(); for (Map.Entry entry : this.attributeModifiers.entries()) { @@ -64,7 +64,7 @@ index a6e2281bfac94f1e19836d9c8415d8270387b16d..a4d6c95e55722c9a0e381d7b84916787 result.put(entry.getKey(), entry.getValue()); } } -@@ -1777,9 +1777,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -1778,9 +1778,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { while (iter.hasNext()) { Map.Entry entry = iter.next(); diff --git a/patches/server/0994-Add-registry-entry-and-builders.patch b/patches/server/0994-Add-registry-entry-and-builders.patch index 61941d6748..1b4049eaa9 100644 --- a/patches/server/0994-Add-registry-entry-and-builders.patch +++ b/patches/server/0994-Add-registry-entry-and-builders.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add registry entry and builders diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index 36bc8d005de14622eb8a0bf4736d964276c95344..3ad1ba8c14fe3745cedcbbd9bb28dad36eb6c7bb 100644 +index 3c48848a2628d07c470425d1c70d10b45db346a1..97fceb4de04d6756bd9b18b650e3325f21854f40 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -1,6 +1,8 @@ @@ -26,7 +26,7 @@ index 36bc8d005de14622eb8a0bf4736d964276c95344..3ad1ba8c14fe3745cedcbbd9bb28dad3 entry(Registries.STRUCTURE_TYPE, RegistryKey.STRUCTURE_TYPE, StructureType.class, CraftStructureType::new), entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new), entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new), -@@ -97,7 +99,7 @@ public final class PaperRegistries { +@@ -98,7 +100,7 @@ public final class PaperRegistries { entry(Registries.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(), entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::new).delayed(), entry(Registries.WOLF_VARIANT, RegistryKey.WOLF_VARIANT, Wolf.Variant.class, CraftWolf.CraftVariant::new).delayed(), @@ -34,7 +34,7 @@ index 36bc8d005de14622eb8a0bf4736d964276c95344..3ad1ba8c14fe3745cedcbbd9bb28dad3 + writable(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new, PaperEnchantmentRegistryEntry.PaperBuilder::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME).delayed(), entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(), entry(Registries.BANNER_PATTERN, RegistryKey.BANNER_PATTERN, PatternType.class, CraftPatternType::new).delayed(), - entry(Registries.BIOME, RegistryKey.BIOME, Biome.class, CraftBiome::new).delayed(), + diff --git a/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java b/src/main/java/io/papermc/paper/registry/data/PaperEnchantmentRegistryEntry.java new file mode 100644 index 0000000000000000000000000000000000000000..481f5f0cfae1fada3bc3f873fb7e04c3086ea9bf diff --git a/patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch b/patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch index 282bdd1de1..4dfddc64f0 100644 --- a/patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch +++ b/patches/server/1007-Add-API-for-CanPlaceOn-and-CanDestroy-NBT-values.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add API for CanPlaceOn and CanDestroy NBT values diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index a4d6c95e55722c9a0e381d7b84916787240cea8e..188684a480c8ae2b761ed12ca0b1d256cef67538 100644 +index b24857e34d87ea4fa9aa0db0ba684014c2625cc1..5bb37a77363d91222dae833d018da753e3549f93 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -@@ -2499,4 +2499,119 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { +@@ -2500,4 +2500,119 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { } // Paper end