From 224edc9b020e40f5a6de5b3e055542f1302ce26d Mon Sep 17 00:00:00 2001 From: DoKM Date: Sun, 25 Jul 2021 20:45:38 +0200 Subject: Add toggle for Settings and help button Also made the search bar toggle no longer toggle off the other two buttons Might improve at a later date --- .../moulberry/notenoughupdates/NEUOverlay.java | 45 +++++++++++++--------- .../options/seperateSections/Toolbar.java | 40 ++++++++++++++++--- 2 files changed, 62 insertions(+), 23 deletions(-) (limited to 'src/main') diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java index bf85a6a6..4859e5a6 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java @@ -180,6 +180,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + return; + } if(Mouse.getEventButtonState()) { setSearchBarFocus(true); if(Mouse.getEventButton() == 1) { //Right mouse button down @@ -202,6 +205,9 @@ public class NEUOverlay extends Gui { @Override public void render(float x, float y) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { + return; + } FontRenderer fr = Minecraft.getMinecraft().fontRendererObj; int paddingUnscaled = getPaddingUnscaled(); @@ -282,6 +288,7 @@ public class NEUOverlay extends Gui { (int)x + 5 + textBeforeSelectionWidth, (int)y-4 + getHeight()/2, Color.BLACK.getRGB()); } + } @Override @@ -308,6 +315,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { + return; + } if(Mouse.getEventButtonState()) { NotEnoughUpdates.INSTANCE.openGui = new GuiScreenElementWrapper(new NEUConfigEditor(NotEnoughUpdates.INSTANCE.config)); } @@ -322,15 +332,20 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); + + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableSettingsButton) { + return; + } Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(settings); GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, + Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, searchYSize, searchYSize); + GlStateManager.bindTexture(0); } }; @@ -354,6 +369,9 @@ public class NEUOverlay extends Gui { @Override public void mouseClick(float x, float y, int mouseX, int mouseY) { + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton){ + return; + } if(Mouse.getEventButtonState()) { //displayInformationPane(HTMLInfoPane.createFromWikiUrl(overlay, manager, "Help", // "https://moulberry.github.io/files/neu_help.html")); @@ -371,16 +389,21 @@ public class NEUOverlay extends Gui { int paddingUnscaled = getPaddingUnscaled(); int searchYSize = getSearchBarYSize(); + if(!NotEnoughUpdates.INSTANCE.config.toolbar.enableHelpButton) { + return; + } + Minecraft.getMinecraft().getTextureManager().bindTexture(quickcommand_background); GlStateManager.color(1, 1, 1, 1); Utils.drawTexturedRect(x, y, - searchYSize + paddingUnscaled*2, searchYSize + paddingUnscaled*2, GL11.GL_NEAREST); + searchYSize + paddingUnscaled * 2, searchYSize + paddingUnscaled * 2, GL11.GL_NEAREST); Minecraft.getMinecraft().getTextureManager().bindTexture(help); GlStateManager.color(1f, 1f, 1f, 1f); - Utils.drawTexturedRect((int)x + paddingUnscaled, (int)y + paddingUnscaled, + Utils.drawTexturedRect((int) x + paddingUnscaled, (int) y + paddingUnscaled, getSearchBarYSize(), getSearchBarYSize()); GlStateManager.bindTexture(0); + } }; } @@ -517,20 +540,6 @@ public class NEUOverlay extends Gui { public int getPadding() { return getPaddingUnscaled()*4; } - - @Override - public void mouseClick(float x, float y, int mouseX, int mouseY) { - if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - super.mouseClick(x, y, mouseX, mouseY); - } - } - - @Override - public void render(float x, float y) { - if(NotEnoughUpdates.INSTANCE.config.toolbar.searchBar) { - super.render(x, y); - } - } }; } diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java index 3719e120..15262aeb 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/Toolbar.java @@ -12,13 +12,14 @@ public class Toolbar { @ConfigEditorButton(runnableId = 6, buttonText = "Edit") public boolean positionButton = true; - @Expose + + @ConfigOption( - name = "Show Quick Commands", - desc = "Show QuickCommands\u2122 in the NEU toolbar" + name = "Search Bar", + desc = "" ) - @ConfigEditorBoolean - public boolean quickCommands = false; + @ConfigEditorAccordion(id = 0) + public boolean todoAccordion = false; @Expose @ConfigOption( @@ -26,8 +27,27 @@ public class Toolbar { desc = "Show Itemlist search bar in the NEU toolbar" ) @ConfigEditorBoolean + @ConfigAccordionId(id = 0) public boolean searchBar = true; + @Expose + @ConfigOption( + name = "Show a quick settings button", + desc = "Show quick settings button in the NEU toolbar" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableSettingsButton = true; + + @Expose + @ConfigOption( + name = "Show a help settings button", + desc = "Show quick settings button in the NEU toolbar" + ) + @ConfigEditorBoolean + @ConfigAccordionId(id = 0) + public boolean enableHelpButton = false; + @Expose @ConfigOption( name = "Search Bar Width", @@ -38,6 +58,7 @@ public class Toolbar { maxValue = 300f, minStep = 10f ) + @ConfigAccordionId(id = 0) public int searchBarWidth = 200; @Expose @@ -50,8 +71,17 @@ public class Toolbar { maxValue = 50f, minStep = 1f ) + @ConfigAccordionId(id = 0) public int searchBarHeight = 40; + @Expose + @ConfigOption( + name = "Show Quick Commands", + desc = "Show QuickCommands\u2122 in the NEU toolbar" + ) + @ConfigEditorBoolean + public boolean quickCommands = false; + @Expose @ConfigOption( name = "Quick Commands Click Type", -- cgit