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.
*
@@ -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.
*

View File

@@ -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");
+
+