11
11
import javax .annotation .Nullable ;
12
12
import javax .annotation .ParametersAreNonnullByDefault ;
13
13
14
+ import io .papermc .paper .registry .RegistryAccess ;
15
+ import io .papermc .paper .registry .RegistryKey ;
14
16
import org .apache .commons .lang .Validate ;
15
17
import org .bukkit .Material ;
16
18
import org .bukkit .enchantments .Enchantment ;
25
27
/**
26
28
* The {@link MagicianTalisman} is a special kind of {@link Talisman} which awards a {@link Player}
27
29
* with an extra {@link Enchantment} when they enchant their {@link ItemStack}.
28
- *
30
+ *
29
31
* @author TheBusyBiscuit
30
32
*
31
33
*/
@@ -40,7 +42,7 @@ public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) {
40
42
41
43
addItemSetting (allowEnchantmentBooks );
42
44
43
- for (Enchantment enchantment : Enchantment . values ( )) {
45
+ for (Enchantment enchantment : RegistryAccess . registryAccess (). getRegistry ( RegistryKey . ENCHANTMENT )) {
44
46
try {
45
47
for (int i = 1 ; i <= enchantment .getMaxLevel (); i ++) {
46
48
enchantments .add (new TalismanEnchantment (this , enchantment , i ));
@@ -63,13 +65,13 @@ public MagicianTalisman(SlimefunItemStack item, ItemStack[] recipe) {
63
65
/**
64
66
* This method picks a random {@link TalismanEnchantment} for the provided {@link ItemStack}.
65
67
* The method will return null, if null was provided or no applicable {@link Enchantment} was found.
66
- *
68
+ *
67
69
* @param item
68
70
* The {@link ItemStack} to find an {@link Enchantment} for
69
71
* @param existingEnchantments
70
72
* A {@link Set} containing the {@link Enchantment Enchantments} that currently exist on the
71
73
* {@link ItemStack}
72
- *
74
+ *
73
75
* @return An applicable {@link TalismanEnchantment} or null
74
76
*/
75
77
@ Nullable
0 commit comments