diff --git a/src/main/java/net/earthcomputer/clientcommands/Configs.java b/src/main/java/net/earthcomputer/clientcommands/Configs.java index aa3ffcab6..6bafeb6bf 100644 --- a/src/main/java/net/earthcomputer/clientcommands/Configs.java +++ b/src/main/java/net/earthcomputer/clientcommands/Configs.java @@ -79,6 +79,46 @@ public static void setMaxEnchantItemThrows(int maxEnchantItemThrows) { Configs.maxEnchantItemThrows = Mth.clamp(maxEnchantItemThrows, 0, 1000000); } + @Config(setter = @Config.Setter("setMinEnchantBookshelves")) + private static int minEnchantBookshelves = 0; + public static int getMinEnchantBookshelves() { + return minEnchantBookshelves; + } + public static void setMinEnchantBookshelves(int minEnchantBookshelves) { + Configs.minEnchantBookshelves = Mth.clamp(minEnchantBookshelves, 0, 15); + Configs.maxEnchantBookshelves = Math.max(Configs.maxEnchantBookshelves, Configs.minEnchantBookshelves); + } + + @Config(setter = @Config.Setter("setMaxEnchantBookshelves")) + private static int maxEnchantBookshelves = 15; + public static int getMaxEnchantBookshelves() { + return maxEnchantBookshelves; + } + public static void setMaxEnchantBookshelves(int maxEnchantBookshelves) { + Configs.maxEnchantBookshelves = Mth.clamp(maxEnchantBookshelves, 0, 15); + Configs.minEnchantBookshelves = Math.min(Configs.minEnchantBookshelves, Configs.maxEnchantBookshelves); + } + + @Config(setter = @Config.Setter("setMinEnchantLevels")) + private static int minEnchantLevels = 1; + public static int getMinEnchantLevels() { + return minEnchantLevels; + } + public static void setMinEnchantLevels(int minEnchantLevels) { + Configs.minEnchantLevels = Mth.clamp(minEnchantLevels, 1, 30); + Configs.maxEnchantLevels = Math.max(Configs.maxEnchantLevels, Configs.minEnchantLevels); + } + + @Config(setter = @Config.Setter("setMaxEnchantLevels")) + private static int maxEnchantLevels = 30; + public static int getMaxEnchantLevels() { + return maxEnchantLevels; + } + public static void setMaxEnchantLevels(int maxEnchantLevels) { + Configs.maxEnchantLevels = Mth.clamp(maxEnchantLevels, 1, 30); + Configs.minEnchantLevels = Math.min(Configs.minEnchantLevels, Configs.maxEnchantLevels); + } + @Config(setter = @Config.Setter("setChorusManipulation"), temporary = true) private static boolean chorusManipulation = false; public static boolean getChorusManipulation() { diff --git a/src/main/java/net/earthcomputer/clientcommands/features/EnchantmentCracker.java b/src/main/java/net/earthcomputer/clientcommands/features/EnchantmentCracker.java index 058942195..2e7398ed9 100644 --- a/src/main/java/net/earthcomputer/clientcommands/features/EnchantmentCracker.java +++ b/src/main/java/net/earthcomputer/clientcommands/features/EnchantmentCracker.java @@ -350,7 +350,7 @@ public static String manipulateEnchantments(Item item, Predicate enchantments = getEnchantmentList(rand, xpSeed, stack, slot, enchantLevels[slot]); - if (enchantmentsPredicate.test(enchantments)) { + if (enchantmentsPredicate.test(enchantments) + && enchantLevels[slot] >= Configs.getMinEnchantLevels() + && enchantLevels[slot] <= Configs.getMaxEnchantLevels() + ) { return new ManipulateResult(times, bookshelvesNeeded, slot, enchantments); } }