mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-20 03:35:51 +00:00
fix: Unable to limit enchantment level
optimize: set default and max level to Short.MAX_VALUE
This commit is contained in:
parent
ffb063e2d8
commit
f308c60bd1
@ -39,7 +39,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class AutoDisenchanter extends AContainer {
|
||||
|
||||
private final IntRangeSetting enchantLevelLimit = new IntRangeSetting("enchant-level-limit", 0, 5, 12);
|
||||
private final IntRangeSetting enchantLevelLimit = new IntRangeSetting("enchant-level-limit", 0, Short.MAX_VALUE, Short.MAX_VALUE);
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public AutoDisenchanter(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
@ -78,7 +78,7 @@ public class AutoDisenchanter extends AContainer {
|
||||
int amount = 0;
|
||||
|
||||
for (Map.Entry<Enchantment, Integer> entry : item.getEnchantments().entrySet()) {
|
||||
if (enchantLevelLimit.validateInput(entry.getValue())) {
|
||||
if (enchantLevelLimit.getValue() >= entry.getValue()) {
|
||||
enchantments.put(entry.getKey(), entry.getValue());
|
||||
amount++;
|
||||
} else if (!menu.toInventory().getViewers().isEmpty()) {
|
||||
|
@ -22,7 +22,7 @@ import java.util.Map;
|
||||
|
||||
public class AutoEnchanter extends AContainer {
|
||||
|
||||
private final IntRangeSetting enchantLevelLimit = new IntRangeSetting("enchant-level-limit", 0, 5, 12);
|
||||
private final IntRangeSetting enchantLevelLimit = new IntRangeSetting("enchant-level-limit", 0, Short.MAX_VALUE, Short.MAX_VALUE);
|
||||
|
||||
@ParametersAreNonnullByDefault
|
||||
public AutoEnchanter(Category category, SlimefunItemStack item, RecipeType recipeType, ItemStack[] recipe) {
|
||||
@ -55,7 +55,7 @@ public class AutoEnchanter extends AContainer {
|
||||
|
||||
for (Map.Entry<Enchantment, Integer> e : meta.getStoredEnchants().entrySet()) {
|
||||
if (e.getKey().canEnchantItem(target)) {
|
||||
if (enchantLevelLimit.validateInput(e.getValue())) {
|
||||
if (enchantLevelLimit.getValue() >= e.getValue()) {
|
||||
amount++;
|
||||
enchantments.put(e.getKey(), e.getValue());
|
||||
} else if (!menu.toInventory().getViewers().isEmpty()) {
|
||||
|
Loading…
Reference in New Issue
Block a user