diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java index 7b817ad890..e93bbe4d38 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/runes/EnchantmentRune.java @@ -12,8 +12,11 @@ import javax.annotation.Nonnull; import javax.annotation.ParametersAreNonnullByDefault; +import io.papermc.paper.registry.RegistryAccess; +import io.papermc.paper.registry.RegistryKey; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Registry; import org.bukkit.SoundCategory; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; @@ -57,7 +60,7 @@ public EnchantmentRune(ItemGroup itemGroup, SlimefunItemStack item, RecipeType r List enchantments = new ArrayList<>(); - for (Enchantment enchantment : Enchantment.values()) { + for (Enchantment enchantment : RegistryAccess.registryAccess().getRegistry(RegistryKey.ENCHANTMENT)) { if (enchantment.equals(Enchantment.BINDING_CURSE) || enchantment.equals(Enchantment.VANISHING_CURSE)) { continue; } diff --git a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java index 6c5ad0ffb7..c72dc3a644 100644 --- a/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java +++ b/src/main/java/io/github/thebusybiscuit/slimefun4/implementation/items/magical/talismans/MagicianTalisman.java @@ -11,6 +11,8 @@ import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import io.papermc.paper.registry.RegistryAccess; +import io.papermc.paper.registry.RegistryKey; import org.apache.commons.lang.Validate; import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; @@ -25,7 +27,7 @@ /** * The {@link MagicianTalisman} is a special kind of {@link Talisman} which awards a {@link Player} * with an extra {@link Enchantment} when they enchant their {@link ItemStack}. - * + * * @author TheBusyBiscuit * */ @@ -40,7 +42,7 @@ public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) { addItemSetting(allowEnchantmentBooks); - for (Enchantment enchantment : Enchantment.values()) { + for (Enchantment enchantment : RegistryAccess.registryAccess().getRegistry(RegistryKey.ENCHANTMENT)) { try { for (int i = 1; i <= enchantment.getMaxLevel(); i++) { enchantments.add(new TalismanEnchantment(this, enchantment, i)); @@ -63,13 +65,13 @@ public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) { /** * This method picks a random {@link TalismanEnchantment} for the provided {@link ItemStack}. * The method will return null, if null was provided or no applicable {@link Enchantment} was found. - * + * * @param item * The {@link ItemStack} to find an {@link Enchantment} for * @param existingEnchantments * A {@link Set} containing the {@link Enchantment Enchantments} that currently exist on the * {@link ItemStack} - * + * * @return An applicable {@link TalismanEnchantment} or null */ @Nullable