Posted September 6, 201510 yr When I click a button in my gui, the sound plays alot of times instead of just once because th e gui is being spawned multiple times. this im my gui class: public class GuiConfirm extends GuiScreen { public boolean doesGuiPauseGame() { return false; } @Override public void drawScreen(int x, int y, float ticks) { this.buttonList.add(new GuiButton(0, this.width / 2 - 90, this.height / 2, 64, 20, I18n.format("Yes", new Object[0]))); this.buttonList.add(new GuiButton(1, this.width / 2 + 20, this.height / 2, 64, 20, I18n.format("No", new Object[0]))); fontRendererObj.drawString("Teleport to the PAYDAY2 Dimension?", this.width / 2 - 90, this.height / 2 - 50, 0x000000); GL11.glColor4f(1, 1, 1, 1); drawDefaultBackground(); super.drawScreen(x, y, ticks); //I know this makes the looping.. but I tried other ways of rendering it once and nothing works.. } @Override protected void actionPerformed(GuiButton button) { if (button.id == 0){ this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); } if (button.id == 1){ this.mc.displayGuiScreen((GuiScreen) null); this.mc.setIngameFocus(); } } } How can I make the Gui spawn only once?
September 7, 201510 yr Author You're right.. I fixed the problem right before you answered this question.. but thanks alot! I used this.buttonList.Clear();
September 8, 201510 yr but thanks alot! Alot no want your thanks. Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable. If you think this is the case, JUST REPORT ME. Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice. Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked. DO NOT PM ME WITH PROBLEMS. No help will be given.
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.