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/Code-Generation.patch b/patches/api/Code-Generation.patch index 00835095b5..77ad476508 100644 --- a/patches/api/Code-Generation.patch +++ b/patches/api/Code-Generation.patch @@ -204,6 +204,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * @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..00000000000000000000000000000000 + * 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/Deprecate-for-removal-all-OldEnum-related-methods.patch b/patches/api/Deprecate-for-removal-all-OldEnum-related-methods.patch index 7dfc7019b7..0608437a67 100644 --- a/patches/api/Deprecate-for-removal-all-OldEnum-related-methods.patch +++ b/patches/api/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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/Fluid.java ++++ b/src/main/java/org/bukkit/Fluid.java +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/attribute/Attribute.java ++++ b/src/main/java/org/bukkit/attribute/Attribute.java +@@ -0,0 +0,0 @@ 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); +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/block/Biome.java ++++ b/src/main/java/org/bukkit/block/Biome.java +@@ -0,0 +0,0 @@ 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 +@@ -0,0 +0,0 @@ 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; +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/block/banner/PatternType.java diff --git a/patches/api/Fix-issues-with-recipe-API.patch b/patches/api/Fix-issues-with-recipe-API.patch index f41bd02ba7..5e1ff43618 100644 --- a/patches/api/Fix-issues-with-recipe-API.patch +++ b/patches/api/Fix-issues-with-recipe-API.patch @@ -441,3 +441,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 return (StonecuttingRecipe) this; } +diff --git a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/org/bukkit/inventory/TransmuteRecipe.java ++++ b/src/main/java/org/bukkit/inventory/TransmuteRecipe.java +@@ -0,0 +0,0 @@ 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/General-ItemMeta-fixes.patch b/patches/api/General-ItemMeta-fixes.patch index a7cef958ea..034cffb394 100644 --- a/patches/api/General-ItemMeta-fixes.patch +++ b/patches/api/General-ItemMeta-fixes.patch @@ -115,6 +115,15 @@ diff --git a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java b/src/main/ja index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +++ b/src/main/java/org/bukkit/inventory/meta/ItemMeta.java +@@ -0,0 +0,0 @@ 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); + @@ -0,0 +0,0 @@ public interface ItemMeta extends Cloneable, ConfigurationSerializable, Persiste /** diff --git a/patches/server/Add-RegistryAccess-for-managing-Registries.patch b/patches/server/Add-RegistryAccess-for-managing-Registries.patch index 6f2900e648..0b5642fd47 100644 --- a/patches/server/Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/Add-RegistryAccess-for-managing-Registries.patch @@ -108,6 +108,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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..00000000000000000000000000000000 + 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/Add-registry-entry-and-builders.patch b/patches/server/Add-registry-entry-and-builders.patch index 59295a1587..4b0dd38c84 100644 --- a/patches/server/Add-registry-entry-and-builders.patch +++ b/patches/server/Add-registry-entry-and-builders.patch @@ -34,7 +34,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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..0000000000000000000000000000000000000000 diff --git a/patches/server/General-ItemMeta-fixes.patch b/patches/server/General-ItemMeta-fixes.patch index 97ecb492f3..8b46d9d274 100644 --- a/patches/server/General-ItemMeta-fixes.patch +++ b/patches/server/General-ItemMeta-fixes.patch @@ -1177,6 +1177,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 if (lore == null) { this.lore = null; } else { +@@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { + + @Override + public void setEnchantable(Integer data) { ++ Preconditions.checkArgument(data > 0, "Enchantability must be > 0"); + this.enchantableValue = data; + } + @@ -0,0 +0,0 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @Override @@ -1651,6 +1659,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 } @Override +@@ -0,0 +0,0 @@ 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaShield.java