Posted June 22, 20178 yr I have a GUI with some buttons in it, and when i click those buttons i want the gui to change appearance (basically some buttons will be replaced with others). How can i do so that the gui automatically refresh without closing it and reopening it to see the changes? Also i've noticed that the gui repaint itself when i resize the window, doing something like this How can i made so the gui doesn't do this every time i resize? This is my gui code, thanks in advance to everyone who will help me understand these problems package com.cf.gui; import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import org.lwjgl.opengl.GL11; import com.cf.CoreFaction; import com.cf.network.GuiCoreAddExpansionServerMessage; import com.cf.network.GuiCoreRemoveServerMessage; import com.cf.network.GuiCoreSaveServerMessage; import com.cf.utils.Settings; import com.cf.utils.Utils; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.init.MobEffects; import net.minecraft.potion.Potion; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class GuiCore extends GuiScreen { private static final ResourceLocation BG = new ResourceLocation(CoreFaction.MODID, "textures/gui/core.png"); private String territory; private String faction; private int coreLevel; private int expansions; private int primaryEffect; private int secondaryEffect; private int primaryLevel; private int secondaryLevel; private GuiCore.UpgradeButton upgradeCoreButton; private GuiCore.ExpansionButton expansionButton; private GuiCore.RemoveButton removeButton; private int guiLeft; private int guiTop; private int xSize = 256; private int ySize = 181; private ArrayList<AllyEffectButton> allyButtons = new ArrayList<AllyEffectButton>(); private ArrayList<EnemyEffectButton> enemyButtons = new ArrayList<EnemyEffectButton>(); private ArrayList<AllyActiveEffectButton> allyActiveButtons = new ArrayList<AllyActiveEffectButton>(); private ArrayList<EnemyActiveEffectButton> enemyActiveButtons = new ArrayList<EnemyActiveEffectButton>(); private ArrayList<Potion> allyEffects = new ArrayList<Potion>(); private ArrayList<Potion> enemyEffects = new ArrayList<Potion>(); private int maxCoreLevel = 10; public GuiCore(String t, String f, int l, int e, int e1, int e2, int l1, int l2) { this.territory = t; this.faction = f; this.coreLevel = l; this.expansions = e; this.primaryEffect = e1; this.secondaryEffect = e2; this.primaryLevel = l1; this.secondaryLevel = l2; } @Override public void initGui() { this.guiLeft = (this.width - xSize) / 2; this.guiTop = (this.height - ySize) / 2; this.upgradeCoreButton = new GuiCore.UpgradeButton(-1, this.guiLeft + 19, this.guiTop + 144); this.expansionButton = new GuiCore.ExpansionButton(-2, this.guiLeft + 116, this.guiTop + 144); this.removeButton = new GuiCore.RemoveButton(-3, this.guiLeft + 213, this.guiTop + 144); this.buttonList.add(upgradeCoreButton); this.buttonList.add(expansionButton); this.buttonList.add(removeButton); this.allyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.JUMP_BOOST))); this.allyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.SPEED))); this.allyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.RESISTANCE))); this.allyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.HASTE))); this.allyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.ABSORPTION))); this.enemyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.HUNGER))); this.enemyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.WEAKNESS))); this.enemyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.SLOWNESS))); this.enemyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.BLINDNESS))); this.enemyEffects.add(Potion.getPotionById(Potion.getIdFromPotion(MobEffects.MINING_FATIGUE))); for (int i = 0; i < 5; i++) { this.allyButtons.add( new AllyEffectButton(i, this.guiLeft + 11 + 5, this.guiTop + 20 + (24 * i), allyEffects.get(i), 0)); this.allyActiveButtons.add(new AllyActiveEffectButton(i, this.guiLeft + 11 + 5, this.guiTop + 20 + (24 * i), allyEffects.get(i), 0)); this.enemyButtons.add(new EnemyEffectButton(i + 5, this.guiLeft + (this.xSize - 106 - 11 - 5), this.guiTop + 20 + (24 * i), enemyEffects.get(i), 0)); this.enemyActiveButtons.add(new EnemyActiveEffectButton(i + 5, this.guiLeft + (this.xSize - 106 - 11 - 5), this.guiTop + 20 + (24 * i), enemyEffects.get(i), 0)); } this.buttonList.addAll(allyButtons); this.buttonList.addAll(enemyButtons); } @Override public void updateScreen() { if (this.primaryLevel != -999) { for (int i = 0; i < allyEffects.size(); i++) { if (Potion.getIdFromPotion(allyEffects.get(i)) == this.primaryEffect) { this.buttonList.remove(allyButtons.get(i)); this.buttonList.add(allyActiveButtons.get(i)); } } for (int i = 0; i < enemyEffects.size(); i++) { if (Potion.getIdFromPotion(enemyEffects.get(i)) == this.primaryEffect) { this.buttonList.remove(enemyEffects.get(i)); this.buttonList.add(enemyActiveButtons.get(i)); } } } if (this.secondaryLevel != -999) { for (int i = 0; i < enemyEffects.size(); i++) { if (Potion.getIdFromPotion(enemyEffects.get(i)) == this.secondaryEffect) { this.buttonList.remove(enemyButtons.get(i)); this.buttonList.add(enemyActiveButtons.get(i)); } } for (int i = 0; i < enemyEffects.size(); i++) { if (Potion.getIdFromPotion(enemyEffects.get(i)) == this.secondaryEffect) { this.buttonList.remove(enemyEffects.get(i)); this.buttonList.add(enemyActiveButtons.get(i)); } } } super.updateScreen(); } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); GL11.glDisable(GL11.GL_LIGHTING); this.mc.getTextureManager().bindTexture(getBg()); this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, 256, 181); String terr = Utils.getTranslation("gui.core.territory", TextFormatting.GREEN); terr += ": " + territory; if (terr.length() >= 38) { if (coreLevel == maxCoreLevel) { this.fontRendererObj.drawString(terr.substring(0, 37) + "...", this.guiLeft + 19, this.guiTop + 10, 4210752); this.fontRendererObj.drawString(" | " + Utils.getTranslation("gui.core.level", TextFormatting.GOLD) + ": " + String.valueOf(coreLevel), this.guiLeft + this.xSize - 64, this.guiTop + 10, 4210752); } else { this.fontRendererObj.drawString(terr.substring(0, 38) + "...", this.guiLeft + 19, this.guiTop + 10, 4210752); this.fontRendererObj.drawString(" | " + Utils.getTranslation("gui.core.level", TextFormatting.GOLD) + ": " + String.valueOf(coreLevel), this.guiLeft + this.xSize - 58, this.guiTop + 10, 4210752); } } else { this.fontRendererObj.drawString(terr, this.guiLeft + 19, this.guiTop + 10, 4210752); this.fontRendererObj.drawString( " | " + Utils.getTranslation("gui.core.level", TextFormatting.GOLD) + ": " + String.valueOf(coreLevel), coreLevel == maxCoreLevel ? this.guiLeft + this.xSize - 64 : this.guiLeft + this.xSize - 58, this.guiTop + 10, 4210752); } for (int i = 0; i < this.buttonList.size(); ++i) { ((GuiButton) this.buttonList.get(i)).drawButton(this.mc, mouseX, mouseY); } for (int i = 0; i < this.buttonList.size(); ++i) { if (this.buttonList.get(i) instanceof AllyActiveEffectButton || this.buttonList.get(i) instanceof AllyEffectButton) this.drawString(Minecraft.getMinecraft().fontRendererObj, Utils.getTranslation(((HoverEffectButton) this.buttonList.get(i)).getEffect()) + " " + (((HoverEffectButton) this.buttonList.get(i)).getTier() == 0 ? "" : (((HoverEffectButton) this.buttonList.get(i)).getTier() + 1)), ((HoverEffectButton) this.buttonList.get(i)).xPosition + 25, ((HoverEffectButton) this.buttonList.get(i)).yPosition + 7, 0xFFFFFF); else if (this.buttonList.get(i) instanceof EnemyActiveEffectButton || this.buttonList.get(i) instanceof EnemyEffectButton) this.drawString(Minecraft.getMinecraft().fontRendererObj, Utils.getTranslation(((HoverEffectButton) this.buttonList.get(i)).getEffect()) + " " + (((HoverEffectButton) this.buttonList.get(i)).getTier() == 0 ? "" : (((HoverEffectButton) this.buttonList.get(i)).getTier() + 1)), ((HoverEffectButton) this.buttonList.get(i)).xPosition + 5, ((HoverEffectButton) this.buttonList.get(i)).yPosition + 7, 0xFFFFFF); } this.mc.getTextureManager().bindTexture(getBg()); if (coreLevel < Settings.expansionLevel || expansions >= Settings.maxPurchasableExpansions) this.expansionButton.setEnabled(false); if (coreLevel == maxCoreLevel) this.upgradeCoreButton.setEnabled(false); if (this.coreLevel < 2) { this.drawTexturedModalRect(this.allyButtons.get(0).xPosition + 3, this.allyButtons.get(0).yPosition + 2, 0, 192, 18, 18); this.drawTexturedModalRect(this.enemyButtons.get(0).xPosition + 84, this.enemyButtons.get(0).yPosition + 2, 0, 192, 18, 18); this.allyButtons.get(0).setEnabled(false); this.enemyButtons.get(0).setEnabled(false); } if (this.coreLevel < 4) { this.drawTexturedModalRect(this.allyButtons.get(1).xPosition + 3, this.allyButtons.get(1).yPosition + 2, 0, 192, 16, 18); this.drawTexturedModalRect(this.enemyButtons.get(1).xPosition + 84, this.enemyButtons.get(1).yPosition + 2, 0, 192, 16, 18); this.allyButtons.get(1).setEnabled(false); this.enemyButtons.get(1).setEnabled(false); } if (this.coreLevel < 6) { this.drawTexturedModalRect(this.allyButtons.get(2).xPosition + 3, this.allyButtons.get(2).yPosition + 2, 0, 192, 16, 18); this.drawTexturedModalRect(this.enemyButtons.get(2).xPosition + 84, this.enemyButtons.get(2).yPosition + 2, 0, 192, 16, 18); this.allyButtons.get(2).setEnabled(false); this.enemyButtons.get(2).setEnabled(false); } if (this.coreLevel < { this.drawTexturedModalRect(this.allyButtons.get(3).xPosition + 3, this.allyButtons.get(3).yPosition + 2, 0, 192, 16, 18); this.drawTexturedModalRect(this.enemyButtons.get(3).xPosition + 84, this.enemyButtons.get(3).yPosition + 2, 0, 192, 16, 18); this.allyButtons.get(3).setEnabled(false); this.enemyButtons.get(3).setEnabled(false); } if (this.coreLevel < 10) { this.drawTexturedModalRect(this.allyButtons.get(4).xPosition + 3, this.allyButtons.get(4).yPosition + 2, 0, 192, 16, 18); this.drawTexturedModalRect(this.enemyButtons.get(4).xPosition + 84, this.enemyButtons.get(4).yPosition + 2, 0, 192, 16, 18); this.allyButtons.get(4).setEnabled(false); this.enemyButtons.get(4).setEnabled(false); } for (GuiButton button : this.buttonList) { if (button.isMouseOver()) { if (button instanceof HoverEffectButton) { this.zLevel = 100; if (button.enabled) { this.drawCreativeTabHoveringText(((HoverEffectButton) button).getHoverText(), mouseX, mouseY); } else { if (button.id == 0 || button.id == 5) this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.unlock.2"), mouseX, mouseY); else if (button.id == 1 || button.id == 6) this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.unlock.4"), mouseX, mouseY); else if (button.id == 2 || button.id == 7) this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.unlock.6"), mouseX, mouseY); else if (button.id == 3 || button.id == this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.unlock.8"), mouseX, mouseY); else if (button.id == 4 || button.id == 9) this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.unlock.10"), mouseX, mouseY); } this.zLevel = 0; } else { if (button.id == -1) { if (coreLevel < maxCoreLevel) { int g = Settings.baseUpgradeCost * coreLevel; String up = Utils.getTranslation("gui.core.upgrade", TextFormatting.GOLD) + " " + String.valueOf(coreLevel + 1); String down = (g != 0 ? String.valueOf(g) + Utils.getTranslation("gui.core.gemstones", TextFormatting.LIGHT_PURPLE) : ""); this.drawHoveringText(Arrays.<String>asList(up, down), mouseX, mouseY); } else this.drawCreativeTabHoveringText( Utils.getTranslation("gui.core.upgrade.max", TextFormatting.RED), mouseX, mouseY); } else if (button.id == -2) { if (coreLevel >= Settings.expansionLevel) { if (this.expansions < Settings.maxPurchasableExpansions) { int g = Settings.expansionBaseCost.getGold() * (expansions + 1); int s = Settings.expansionBaseCost.getSilver() * (expansions + 1); int c = Settings.expansionBaseCost.getCopper() * (expansions + 1); String up = Utils.getTranslation("gui.core.expansion", TextFormatting.GREEN) + " (" + Utils.getTranslation("gui.core.purchased") + ": " + String.valueOf(expansions) + "/" + String.valueOf(Settings.maxPurchasableExpansions) + ")"; String down = (g != 0 ? String.valueOf(g) + Utils.getTranslation("gui.core.golds", TextFormatting.YELLOW) : "") + (s != 0 ? String.valueOf(s) + Utils.getTranslation("gui.core.silvers", TextFormatting.GRAY) : "") + (c != 0 ? String.valueOf(c) + Utils.getTranslation("gui.core.coppers", TextFormatting.DARK_RED) : ""); this.drawHoveringText(Arrays.<String>asList(up, down), mouseX, mouseY); } else this.drawCreativeTabHoveringText( Utils.getTranslation("gui.core.expansion.max", TextFormatting.RED), mouseX, mouseY); } else this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.expansion.locked") + " " + String.valueOf(Settings.expansionLevel), mouseX, mouseY); } else if (button.id == -3) { String up = Utils.getTranslation("gui.core.remove", TextFormatting.RED); String down = Utils.getTranslation("gui.core.remove.back"); this.drawHoveringText(Arrays.<String>asList(up, down), mouseX, mouseY); } } } } } @Override protected void actionPerformed(GuiButton button) throws IOException { if (button.enabled) { int id = button.id; if (id == -1) { int g = Settings.baseUpgradeCost * coreLevel; if (Utils.canPayGemstones(this.mc.thePlayer, g) && coreLevel < 10) { Utils.payGemstones(this.mc.thePlayer, g); coreLevel++; if (coreLevel >= maxCoreLevel / 2 && coreLevel < maxCoreLevel) { primaryLevel = 2; secondaryLevel = 2; } else if (coreLevel == maxCoreLevel) { primaryLevel = 3; secondaryLevel = 3; } Utils.sendMessage(this.mc.thePlayer, Utils.getTranslation("gui.core.upgrade.success", TextFormatting.GREEN)); CoreFaction.NETWORK.sendToServer(new GuiCoreSaveServerMessage(this.territory, String.valueOf(this.coreLevel), String.valueOf(this.expansions), String.valueOf(this.primaryEffect), String.valueOf(this.secondaryEffect), String.valueOf(this.primaryLevel), String.valueOf(this.secondaryLevel))); } else Utils.sendMessage(this.mc.thePlayer, Utils.getTranslation("gui.core.upgrade.fail", TextFormatting.RED)); this.mc.displayGuiScreen((GuiScreen)null); } else if (id == -2) { int g = Settings.expansionBaseCost.getGold() * expansions; int s = Settings.expansionBaseCost.getSilver() * expansions; int c = Settings.expansionBaseCost.getCopper() * expansions; if (Utils.canPay(this.mc.thePlayer, g, s, c) && coreLevel >= Settings.expansionLevel && this.expansions < Settings.maxPurchasableExpansions) { Utils.pay(this.mc.thePlayer, g, s, c); CoreFaction.NETWORK.sendToServer(new GuiCoreAddExpansionServerMessage(territory)); expansions++; Utils.sendMessage(this.mc.thePlayer, Utils.getTranslation("gui.core.expansion.success", TextFormatting.GREEN)); } else { this.mc.displayGuiScreen((GuiScreen)null); Utils.sendMessage(this.mc.thePlayer, Utils.getTranslation("gui.core.expansion.fail", TextFormatting.RED)); } } else if (id == -3) { CoreFaction.NETWORK.sendToServer(new GuiCoreRemoveServerMessage(territory, faction)); Utils.sendMessage(this.mc.thePlayer, Utils.getTranslation("gui.core.remove.success", TextFormatting.RED)); this.mc.displayGuiScreen((GuiScreen) null); return; } else if (id == 0) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(allyEffects.get(0)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(allyEffects.get(0)) ? -999 : Potion.getIdFromPotion(allyEffects.get(0)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(allyEffects.get(0)) ? -999 : Potion.getIdFromPotion(allyEffects.get(0)); } } else if (id == 1) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(allyEffects.get(1)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(allyEffects.get(1)) ? -999 : Potion.getIdFromPotion(allyEffects.get(1)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(allyEffects.get(1)) ? -999 : Potion.getIdFromPotion(allyEffects.get(1)); } } else if (id == 2) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(allyEffects.get(2)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(allyEffects.get(2)) ? -999 : Potion.getIdFromPotion(allyEffects.get(2)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(allyEffects.get(2)) ? -999 : Potion.getIdFromPotion(allyEffects.get(2)); } } else if (id == 3) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(allyEffects.get(3)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(allyEffects.get(3)) ? -999 : Potion.getIdFromPotion(allyEffects.get(3)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(allyEffects.get(3)) ? -999 : Potion.getIdFromPotion(allyEffects.get(3)); } } else if (id == 4) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(allyEffects.get(4)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(allyEffects.get(4)) ? -999 : Potion.getIdFromPotion(allyEffects.get(4)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(allyEffects.get(4)) ? -999 : Potion.getIdFromPotion(allyEffects.get(4)); } } else if (id == 5) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(enemyEffects.get(0)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(enemyEffects.get(0)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(0)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(enemyEffects.get(0)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(0)); } } else if (id == 6) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(enemyEffects.get(1)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(enemyEffects.get(1)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(1)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(enemyEffects.get(1)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(1)); } } else if (id == 7) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(enemyEffects.get(2)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(enemyEffects.get(2)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(2)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(enemyEffects.get(2)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(2)); } } else if (id == { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(enemyEffects.get(3)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(enemyEffects.get(3)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(3)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(enemyEffects.get(3)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(3)); } } else if (id == 9) { if(this.primaryEffect != -999 && this.primaryEffect != Potion.getIdFromPotion(enemyEffects.get(4)) && coreLevel == maxCoreLevel) { this.secondaryEffect = this.secondaryEffect == Potion.getIdFromPotion(enemyEffects.get(4)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(4)); } else { this.primaryEffect = this.primaryEffect == Potion.getIdFromPotion(enemyEffects.get(4)) ? -999 : Potion.getIdFromPotion(enemyEffects.get(4)); } } CoreFaction.NETWORK.sendToServer(new GuiCoreSaveServerMessage(this.territory, String.valueOf(this.coreLevel), String.valueOf(this.expansions), String.valueOf(this.primaryEffect), String.valueOf(this.secondaryEffect), String.valueOf(this.primaryLevel), String.valueOf(this.secondaryLevel))); } super.actionPerformed(button); } @Override public boolean doesGuiPauseGame() { return false; } public static ResourceLocation getBg() { return BG; } @SideOnly(Side.CLIENT) class UpgradeButton extends ActionButton { public UpgradeButton(int buttonId, int x, int y) { super(buttonId, x, y, GuiCore.getBg(), 0, 237); } public void drawButtonForegroundLayer(int mouseX, int mouseY) { GuiCore.this.drawCreativeTabHoveringText( Utils.getTranslation("gui.core.upgrade", TextFormatting.GOLD) + "\n" + "Test", mouseX, mouseY); } } @SideOnly(Side.CLIENT) class ExpansionButton extends ActionButton { public ExpansionButton(int buttonId, int x, int y) { super(buttonId, x, y, GuiCore.getBg(), 0, 237); } public void drawButtonForegroundLayer(int mouseX, int mouseY) { GuiCore.this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.expansion", TextFormatting.GREEN), mouseX, mouseY); } } @SideOnly(Side.CLIENT) class RemoveButton extends ActionButton { public RemoveButton(int buttonId, int x, int y) { super(buttonId, x, y, GuiCore.getBg(), 23, 210); } public void drawButtonForegroundLayer(int mouseX, int mouseY) { GuiCore.this.drawCreativeTabHoveringText(Utils.getTranslation("gui.core.remove", TextFormatting.RED), mouseX, mouseY); } } } Don't blame me if i always ask for your help. I just want to learn to be better
July 8, 20178 yr Author Up Don't blame me if i always ask for your help. I just want to learn to be better
July 8, 20178 yr Clear the relevant lists in your initGui method. By default vanilla clears the button list on gui's resize. If you setup something else in that method you need to clear it beforehand too or you end up with stuff duplicating in your lists. To clarify: On 6/23/2017 at 0:49 AM, JimiIT92 said: this.buttonList.addAll(allyButtons); this.buttonList.addAll(enemyButtons); This is your culprit. The butonList is cleared before initGui is called, but your allyButtons and enemyButtons are not. Edited July 8, 20178 yr by V0idWa1k3r
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.