correctly change enchantment registry to a 'delayed' version

This commit is contained in:
Jake Potrebic
2024-06-15 12:04:06 -07:00
parent 3a74801788
commit 80cb0a621b
3 changed files with 14 additions and 8 deletions

View File

@@ -219,11 +219,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* Custom boss bars. * Custom boss bars.
* *
@@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> { @@ -0,0 +0,0 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
* Server enchantments.
* *
* @see Enchantment * @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 = 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. * Server entity types.
* *
@@ -305,10 +308,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
* Jukebox songs. * Jukebox songs.
* *
* @see JukeboxSong * @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 @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 = 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. * Villager profession.
* *

View File

@@ -157,11 +157,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ RegistryKey<MusicInstrument> INSTRUMENT = create("instrument"); + 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). + * Built-in registry for potion effect types (mob effects).
+ * @see io.papermc.paper.registry.keys.MobEffectKeys + * @see io.papermc.paper.registry.keys.MobEffectKeys
+ */ + */
@@ -212,8 +207,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ */ + */
+ RegistryKey<Wolf.Variant> WOLF_VARIANT = create("wolf_variant"); + 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. + * Data-driven registry for jukebox songs.
+ */ + */
+ @ApiStatus.Experimental
+ RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song"); + RegistryKey<JukeboxSong> JUKEBOX_SONG = create("jukebox_song");
+ +
+ +

View File

@@ -72,7 +72,6 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ static { + static {
+ REGISTRY_ENTRIES = List.of( + REGISTRY_ENTRIES = List.of(
+ // built-ins + // 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.GAME_EVENT, RegistryKey.GAME_EVENT, GameEvent.class, CraftGameEvent::new),
+ entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new), + entry(Registries.INSTRUMENT, RegistryKey.INSTRUMENT, MusicInstrument.class, CraftMusicInstrument::new),
+ entry(Registries.MOB_EFFECT, RegistryKey.MOB_EFFECT, PotionEffectType.class, CraftPotionEffectType::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.TRIM_PATTERN, RegistryKey.TRIM_PATTERN, TrimPattern.class, CraftTrimPattern::new).delayed(),
+ entry(Registries.DAMAGE_TYPE, RegistryKey.DAMAGE_TYPE, DamageType.class, CraftDamageType::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.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(), + entry(Registries.JUKEBOX_SONG, RegistryKey.JUKEBOX_SONG, JukeboxSong.class, CraftJukeboxSong::new).delayed(),
+ +
+ // api-only + // api-only