Skip to content

Commit

Permalink
fix spectrum indestructible appearing in matrix enchanting
Browse files Browse the repository at this point in the history
  • Loading branch information
yrsegal committed Aug 15, 2024
1 parent d345604 commit 871df1d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,16 @@ private EnchantmentDataWrapper generateRandomEnchantment(Map<Enchantment, Intege

List<EnchantmentDataWrapper> 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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> treasureWhitelist = Lists.newArrayList();

@Config(description = "Any undiscoverable enchantment IDs here will be able to appear in matrix enchanting")
public static List<String> undiscoverableWhitelist = Lists.newArrayList();

@Config(description = "Set to false to disable the tooltip for items with pending enchantments")
public static boolean showTooltip = true;

Expand Down

0 comments on commit 871df1d

Please sign in to comment.