Posted September 11, 20178 yr I am making a GUI in which the player can click various buttons to disable/hide them (similar to the knapping interface in Terrafirmacraft). The problem is that whenever the Minecraft window is resized, the GUI refreshes and redraws all the buttons as enabled. The buttons are all drawn in #initGui which I realize is called every time the screen is resized. But I don't know how else to do it. Is there a way to get the GUI to remember which buttons are disabled when resizing or redrawing the screen? Or should I be drawing them in a different method? Edited September 12, 20178 yr by Daeruin Marking solved
September 12, 20178 yr Author Thank you. It's obvious, now that you say it. I created a List of Boolean and initialize it in the constructor to an empty ArrayList. I populate it alongside the standard buttonList as I create the buttons in initGui. When a button gets disabled, I update the List so the corresponding boolean there is set to false. When running initGui, as I create each button, I first check to see if that button's boolean in the List is already set to false; if so, the button already exists and needs to be disabled when redrawing the screen. It's working great.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.