From 4e96c08e76dd4b3efccbfd2bf6a958c583f75b06 Mon Sep 17 00:00:00 2001 From: DoKM Date: Mon, 19 Jul 2021 14:13:26 +0200 Subject: Restructure EnchantingSolvers Config into Enchanting Config Also first config option for enchanting gui --- .../miscfeatures/EnchantingSolvers.java | 27 ++--- .../notenoughupdates/miscgui/GuiCustomEnchant.java | 2 +- .../notenoughupdates/options/NEUConfig.java | 6 +- .../options/seperateSections/EnchSolvers.java | 106 ----------------- .../options/seperateSections/Enchanting.java | 130 +++++++++++++++++++++ 5 files changed, 146 insertions(+), 125 deletions(-) delete mode 100644 src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/EnchSolvers.java create mode 100644 src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java (limited to 'src/main') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java index 01d81460..0a5de509 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/EnchantingSolvers.java @@ -3,13 +3,10 @@ package io.github.moulberry.notenoughupdates.miscfeatures; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.inventory.GuiChest; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; -import net.minecraft.inventory.Container; import net.minecraft.inventory.ContainerChest; import net.minecraft.inventory.IInventory; import net.minecraft.item.Item; @@ -96,7 +93,7 @@ public class EnchantingSolvers { } public static ItemStack overrideStack(IInventory inventory, int slotIndex, ItemStack stack) { - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return null; } @@ -199,7 +196,7 @@ public class EnchantingSolvers { } public static boolean onStackRender(ItemStack stack, IInventory inventory, int slotIndex, int x, int y) { - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return false; } @@ -231,14 +228,14 @@ public class EnchantingSolvers { if(item.containerIndex == slotIndex) { int meta = 0; if(solveIndex == ultrasequencerReplayIndex) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNext; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.seqNext; } else if(solveIndex == ultrasequencerReplayIndex+1) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqUpcoming; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.seqUpcoming; } if(meta > 0) { Utils.drawItemStack(new ItemStack(Item.getItemFromBlock(Blocks.stained_glass_pane), 1, meta-1), x, y); } - if(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.seqNumbers && + if(NotEnoughUpdates.INSTANCE.config.enchanting.seqNumbers && solveIndex >= ultrasequencerReplayIndex) { int w = Minecraft.getMinecraft().fontRendererObj.getStringWidth((solveIndex+1)+""); GlStateManager.disableDepth(); @@ -257,15 +254,15 @@ public class EnchantingSolvers { if(stack.getItem() == Item.getItemFromBlock(Blocks.stained_glass) && superpairStacks.containsKey(slotIndex)) { if(possibleMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPossible; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supPossible; } else { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supUnmatched; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supUnmatched; } } else { if(powerupMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supPower; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supPower; } else if(successfulMatches.contains(slotIndex)) { - meta = NotEnoughUpdates.INSTANCE.config.enchantingSolvers.supMatched; + meta = NotEnoughUpdates.INSTANCE.config.enchanting.supMatched; } } if(meta > 0) { @@ -278,7 +275,7 @@ public class EnchantingSolvers { } public static boolean onStackClick(ItemStack stack, int windowId, int slotId, int mouseButtonClicked, int mode) { - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return false; } @@ -371,7 +368,7 @@ public class EnchantingSolvers { public static void processInventoryContents(boolean fromTick) { if(currentSolver != SolverType.CHRONOMATRON && !fromTick) return; - if(!NotEnoughUpdates.INSTANCE.config.enchantingSolvers.enableEnchantingSolvers) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableEnchantingSolvers) { return; } @@ -533,7 +530,7 @@ public class EnchantingSolvers { @SubscribeEvent public void onItemTooltip(ItemTooltipEvent event) { - if(NotEnoughUpdates.INSTANCE.config.enchantingSolvers.hideTooltips && + if(NotEnoughUpdates.INSTANCE.config.enchanting.hideTooltips && (currentSolver == SolverType.CHRONOMATRON || currentSolver == SolverType.ULTRASEQUENCER)) { String internal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(event.itemStack); if(internal == null && event.toolTip.size() > 0 && !event.toolTip.get(0).trim().replaceAll("\\(#.+\\)$", "").trim().contains(" ")) { diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java index 8f30908b..d07a6898 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/miscgui/GuiCustomEnchant.java @@ -37,7 +37,6 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.util.glu.Project; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; -import java.io.PrintStream; import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -199,6 +198,7 @@ public class GuiCustomEnchant extends Gui { } public boolean shouldOverride(String containerName) { + if(!NotEnoughUpdates.INSTANCE.config.enchanting.enableGui) return false; // shouldOverrideFast = false; // if(true) return shouldOverrideFast; diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java index 67db8723..fcbed1af 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/NEUConfig.java @@ -174,10 +174,10 @@ public class NEUConfig extends Config { @Expose @Category( - name = "Enchanting Solvers", - desc = "Enchanting Solvers" + name = "Enchanting", + desc = "Enchanting" ) - public EnchSolvers enchantingSolvers = new EnchSolvers(); + public Enchanting enchanting = new Enchanting(); @Expose @Category( diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/EnchSolvers.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/EnchSolvers.java deleted file mode 100644 index c7707973..00000000 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/EnchSolvers.java +++ /dev/null @@ -1,106 +0,0 @@ -package io.github.moulberry.notenoughupdates.options.seperateSections; - -import com.google.gson.annotations.Expose; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption; - -public class EnchSolvers { - @Expose - @ConfigOption( - name = "Enable Solvers", - desc = "Turn on solvers for the experimentation table" - ) - @ConfigEditorBoolean - public boolean enableEnchantingSolvers = true; - - /*@Expose - @ConfigOption( - name = "Prevent Misclicks", - desc = "Prevent accidentally failing the Chronomatron and Ultrasequencer experiments" - ) - @ConfigEditorBoolean - public boolean preventMisclicks = true;*/ - - @Expose - @ConfigOption( - name = "Hide Tooltips", - desc = "Hide the tooltip of items in the Chronomatron and Ultrasequencer experiments" - ) - @ConfigEditorBoolean - public boolean hideTooltips = true; - - @Expose - @ConfigOption( - name = "Ultrasequencer Numbers", - desc = "Replace the items in the supersequencer with only numbers" - ) - @ConfigEditorBoolean - public boolean seqNumbers = false; - - @Expose - @ConfigOption( - name = "Ultrasequencer Next", - desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is next" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - public int seqNext = 6; - - @Expose - @ConfigOption( - name = "Ultrasequencer Upcoming", - desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is coming after \"next\"" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - public int seqUpcoming = 5; - - @Expose - @ConfigOption( - name = "Superpairs Matched", - desc = "Set the colour of the glass pane shown behind successfully matched pairs" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - public int supMatched = 6; - - @Expose - @ConfigOption( - name = "Superpairs Possible", - desc = "Set the colour of the glass pane shown behind pairs which can be matched, but have not yet" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - public int supPossible = 2; - - @Expose - @ConfigOption( - name = "Superpairs Unmatched", - desc = "Set the colour of the glass pane shown behind pairs which have been previously uncovered" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - public int supUnmatched = 5; - - @Expose - @ConfigOption( - name = "Superpairs Powerups", - desc = "Set the colour of the glass pane shown behind powerups" - ) - @ConfigEditorDropdown( - values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", - "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} - ) - public int supPower = 11; -} diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java new file mode 100644 index 00000000..1833df51 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Enchanting.java @@ -0,0 +1,130 @@ +package io.github.moulberry.notenoughupdates.options.seperateSections; + +import com.google.gson.annotations.Expose; +import io.github.moulberry.notenoughupdates.core.config.annotations.*; + +public class Enchanting { + @Expose + @ConfigOption( + name = "Enable Custom Enchanting Gui", + desc = "Adds a BETA enchanting gui" + ) + @ConfigEditorBoolean + public boolean enableGui = false; + + @ConfigOption( + name = "Enchanting Solvers", + desc = "" + ) + @ConfigEditorAccordion(id = 0) + public boolean enchantingSolversAccordion = false; + + + @Expose + @ConfigOption( + name = "Enable Solvers", + desc = "Turn on solvers for the experimentation table" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableEnchantingSolvers = true; + + /*@Expose + @ConfigOption( + name = "Prevent Misclicks", + desc = "Prevent accidentally failing the Chronomatron and Ultrasequencer experiments" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean preventMisclicks = true;*/ + + @Expose + @ConfigOption( + name = "Hide Tooltips", + desc = "Hide the tooltip of items in the Chronomatron and Ultrasequencer experiments" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean hideTooltips = true; + + @Expose + @ConfigOption( + name = "Ultrasequencer Numbers", + desc = "Replace the items in the supersequencer with only numbers" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean seqNumbers = false; + + @Expose + @ConfigOption( + name = "Ultrasequencer Next", + desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is next" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int seqNext = 6; + + @Expose + @ConfigOption( + name = "Ultrasequencer Upcoming", + desc = "Set the colour of the glass pane shown behind the element in the ultrasequencer which is coming after \"next\"" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int seqUpcoming = 5; + + @Expose + @ConfigOption( + name = "Superpairs Matched", + desc = "Set the colour of the glass pane shown behind successfully matched pairs" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supMatched = 6; + + @Expose + @ConfigOption( + name = "Superpairs Possible", + desc = "Set the colour of the glass pane shown behind pairs which can be matched, but have not yet" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supPossible = 2; + + @Expose + @ConfigOption( + name = "Superpairs Unmatched", + desc = "Set the colour of the glass pane shown behind pairs which have been previously uncovered" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supUnmatched = 5; + + @Expose + @ConfigOption( + name = "Superpairs Powerups", + desc = "Set the colour of the glass pane shown behind powerups" + ) + @ConfigEditorDropdown( + values = {"None", "White", "Orange", "Light Purple", "Light Blue", "Yellow", "Light Green", "Pink", + "Gray", "Light Gray", "Cyan", "Dark Purple", "Dark Blue", "Brown", "Dark Green", "Red", "Black"} + ) + @ConfigAccordionId(id = 0) + public int supPower = 11; +} -- cgit