From 871df1d5d16e699e18fed20708a0303a407fb949 Mon Sep 17 00:00:00 2001 From: "yrsegal@gmail.com" Date: Thu, 15 Aug 2024 12:22:06 -0400 Subject: [PATCH] fix spectrum indestructible appearing in matrix enchanting --- .../addons/oddities/inventory/EnchantmentMatrix.java | 9 ++++++++- .../addons/oddities/module/MatrixEnchantingModule.java | 6 ++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java b/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java index d135ddf0f6..9e6eeac57e 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/inventory/EnchantmentMatrix.java @@ -146,9 +146,16 @@ private EnchantmentDataWrapper generateRandomEnchantment(Map validEnchants = new ArrayList<>(); BuiltInRegistries.ENCHANTMENT.forEach(enchantment -> { + String id = BuiltInRegistries.ENCHANTMENT.getKey(enchantment).toString(); boolean isValid = true; - if(enchantment.isTreasureOnly()) { + + if (!enchantment.isDiscoverable()) { + isValid = MatrixEnchantingModule.allowUndiscoverableEnchantments || + MatrixEnchantingModule.undiscoverableWhitelist.contains(id); + } + + if(isValid && enchantment.isTreasureOnly()) { isValid = MatrixEnchantingModule.allowTreasures || (isBook && MatrixEnchantingModule.treasureWhitelist.contains(id)); } diff --git a/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java b/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java index 6c3904b65d..f7eb944cab 100644 --- a/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java +++ b/src/main/java/org/violetmoon/quark/addons/oddities/module/MatrixEnchantingModule.java @@ -94,9 +94,15 @@ public class MatrixEnchantingModule extends ZetaModule { @Config(description = "Set this to true to allow treasure enchantments to be rolled as pieces") public static boolean allowTreasures = false; + @Config(description = "Set this to true to allow undiscoverable enchantments to be rolled as pieces") + public static boolean allowUndiscoverableEnchantments = false; + @Config(description = "Any treasure enchantment IDs here will be able to appear in books in matrix enchanting") public static List treasureWhitelist = Lists.newArrayList(); + @Config(description = "Any undiscoverable enchantment IDs here will be able to appear in matrix enchanting") + public static List undiscoverableWhitelist = Lists.newArrayList(); + @Config(description = "Set to false to disable the tooltip for items with pending enchantments") public static boolean showTooltip = true;