diff --git a/patches/api/Add-RegistryAccess-for-managing-registries.patch b/patches/api/Add-RegistryAccess-for-managing-registries.patch index b5e6673bd0..3785686035 100644 --- a/patches/api/Add-RegistryAccess-for-managing-registries.patch +++ b/patches/api/Add-RegistryAccess-for-managing-registries.patch @@ -219,11 +219,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * Custom boss bars. * @@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> { + * Server enchantments. * * @see Enchantment ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#ENCHANTMENT} */ - Registry<Enchantment> ENCHANTMENT = Objects.requireNonNull(Bukkit.getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); -+ Registry<Enchantment> ENCHANTMENT = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.ENCHANTMENT); // Paper ++ @Deprecated(since = "1.21") ++ Registry<Enchantment> ENCHANTMENT = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(Enchantment.class), "No registry present for Enchantment. This is a bug."); // Paper /** * Server entity types. * @@ -305,10 +308,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 * Jukebox songs. * * @see JukeboxSong ++ * @deprecated use {@link io.papermc.paper.registry.RegistryAccess#getRegistry(io.papermc.paper.registry.RegistryKey)} with {@link io.papermc.paper.registry.RegistryKey#JUKEBOX_SONG} */ @ApiStatus.Experimental - Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(Bukkit.getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug."); -+ Registry<JukeboxSong> JUKEBOX_SONG = io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(io.papermc.paper.registry.RegistryKey.JUKEBOX_SONG); // Paper ++ @Deprecated(since = "1.21") ++ Registry<JukeboxSong> JUKEBOX_SONG = Objects.requireNonNull(io.papermc.paper.registry.RegistryAccess.registryAccess().getRegistry(JukeboxSong.class), "No registry present for JukeboxSong. This is a bug."); // Paper /** * Villager profession. * diff --git a/patches/api/Code-Generation.patch b/patches/api/Code-Generation.patch index 0224bd180b..70e7343c63 100644 --- a/patches/api/Code-Generation.patch +++ b/patches/api/Code-Generation.patch @@ -157,11 +157,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + RegistryKey<MusicInstrument> INSTRUMENT = create("instrument"); + /** -+ * Built-in registry for enchantments. -+ * @see io.papermc.paper.registry.keys.EnchantmentKeys -+ */ -+ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment"); -+ /** + * Built-in registry for potion effect types (mob effects). + * @see io.papermc.paper.registry.keys.MobEffectKeys + */ @@ -212,8 +207,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant"); + /** ++ * Data-driven registry for enchantments. ++ * @see io.papermc.paper.registry.keys.EnchantmentKeys ++ */ ++ RegistryKey<Enchantment> ENCHANTMENT = create("enchantment"); ++ /** + * Data-driven registry for jukebox songs. + */ ++ @ApiStatus.Experimental + RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song"); + + diff --git a/patches/server/Add-RegistryAccess-for-managing-Registries.patch b/patches/server/Add-RegistryAccess-for-managing-Registries.patch index 4792b357d4..c8b6010176 100644 --- a/patches/server/Add-RegistryAccess-for-managing-Registries.patch +++ b/patches/server/Add-RegistryAccess-for-managing-Registries.patch @@ -72,7 +72,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + static { + REGISTRY_ENTRIES = List.of( + // built-ins -+ entry(Registries.ENCHANTMENT, RegistryKey.ENCHANTMENT, Enchantment.class, CraftEnchantment::new).withSerializationUpdater(FieldRename.ENCHANTMENT_RENAME), + entry(Registries.GAME_EVENT, RegistryKey.GAME_EVENT, GameEvent.class, CraftGameEvent::new), + entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new), + entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::new), @@ -86,6 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + 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(), ++ 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(), + + // api-only