Adds a new enchantmentBlocklist option

The enchantmentBlocklist allows specifying a list of enchantments blacksmiths should be blocked from adding to items. Especially curse of binding and curse of vanishing are problematic as the effect is quite bad. Mending is possibly undesirable as it's supposed to be quite rare.
This commit is contained in:
2022-11-05 04:21:47 +01:00
parent 012d1df099
commit 89c1c4a56c
10 changed files with 118 additions and 9 deletions

View File

@ -145,6 +145,13 @@ public class ReforgeSession implements Runnable {
usableEnchantments.add(enchantment);
}
}
//Remove any enchantments in the block list
usableEnchantments.removeAll(blacksmithTrait.getSettings().getEnchantmentBlocklist());
//In case all usable enchantments have been blocked, abort
if (usableEnchantments.isEmpty()) {
return;
}
//Choose a random enchantment
Enchantment randomEnchantment = usableEnchantments.get(random.nextInt(usableEnchantments.size()));