Jump to content

$ober

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by $ober

  1. oh thanks
  2. aight, so I created a GUI, with sliders. works all fine and all, sliders work and such but, when I close out of the gui, and then go back in, all the slider values reset like if they were never changed. Can anyone help me? Here's my code import java.awt.Color; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.client.config.GuiSlider; import us.loki.legit.config.Configuration; import us.loki.legit.config.Property; import us.loki.legit.cosmetics.GuiCosmetics; public class GuiWings extends GuiScreen { public static boolean wings = true; public static boolean winter = true; private GuiScreen parentScreen; int var3 = this.height / 4 + 48; private GuiButton Wings; private GuiButton Winter; public static GuiSlider slider; public static GuiSlider red; public static GuiSlider green; public static GuiSlider blue; private static int test; public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, "Wings", this.width / 2, 10, 16777215); //this.drawCenteredString(this.fontRendererObj, "Settings won't save in GUI", this.width / 2, 40, 16777215); super.drawScreen(mouseX, mouseY, partialTicks); } public void initGui() { this.refreshButtons(); super.initGui(); } private void refreshButtons(){ this.buttonList.clear(); this.Wings = (new GuiButton(2, this.width / 2 - 100, var3 + 110, I18n.format("Wings: "))); this.buttonList.add(this.Wings); this.Winter = (new GuiButton(3, this.width / 2 - 100, var3 + 140, I18n.format("Winter Wings: "))); this.buttonList.add(this.Winter); this.buttonList.add(slider = new GuiSlider(21, width/2-100, 25, 200, 20, "Size: ", " %", 0, 100, 50, true, true)); this.buttonList.add(red = new GuiSlider(22, width/2-100, 60, 200, 20, "Red: ", " %", 0, 100, 50, true, true)); this.buttonList.add(green = new GuiSlider(23, width/2-100, 95, 200, 20, "Green: ", " %", 0, 100, 50, true, true)); this.buttonList.add(blue = new GuiSlider(24, width/2-100, 130, 200, 20, "Blue: ", " %", 0, 100, 50, true, true)); this.buttonList.add(new GuiButton(5, width / 2 - 100, var3 + 170, I18n.format("Done", new Object[0]))); } protected void actionPerformed(GuiButton button) throws IOException { if (button.id == 2) { if (wings==true){ wings=false; }else if (wings==false){ wings=true; } } if (button.id == 3) { if (winter==true){ winter=false; }else if (winter==false){ winter=true; } } if(button.id == 21) { slider.setValue(slider.sliderValue); } if (button.id == 5) { this.mc.displayGuiScreen(new GuiCosmetics()); } this.updateButtons(); } private void updateButtons() { this.Wings.displayString = wings ? "Wings: Disabled" : (wings ? "Wings:" : "Wings: Enabled"); this.Winter.displayString = winter ? "Winter Wings: Disabled" : (winter ? " Winter Wings:" : "Winter Wings: Enabled"); } } import java.awt.Color; import java.io.IOException; import java.net.URI; import java.util.HashMap; import java.util.Map; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.resources.I18n; import net.minecraftforge.fml.client.config.GuiSlider; import us.loki.legit.config.Configuration; import us.loki.legit.config.Property; import us.loki.legit.cosmetics.GuiCosmetics; public class GuiWings extends GuiScreen { public static boolean wings = true; public static boolean winter = true; private GuiScreen parentScreen; int var3 = this.height / 4 + 48; private GuiButton Wings; private GuiButton Winter; public static GuiSlider slider; public static GuiSlider red; public static GuiSlider green; public static GuiSlider blue; private static int test; public void drawScreen(int mouseX, int mouseY, float partialTicks) { this.drawDefaultBackground(); this.drawCenteredString(this.fontRendererObj, "Wings", this.width / 2, 10, 16777215); //this.drawCenteredString(this.fontRendererObj, "Settings won't save in GUI", this.width / 2, 40, 16777215); super.drawScreen(mouseX, mouseY, partialTicks); } public void initGui() { this.refreshButtons(); super.initGui(); } private void refreshButtons(){ this.buttonList.clear(); this.Wings = (new GuiButton(2, this.width / 2 - 100, var3 + 110, I18n.format("Wings: "))); this.buttonList.add(this.Wings); this.Winter = (new GuiButton(3, this.width / 2 - 100, var3 + 140, I18n.format("Winter Wings: "))); this.buttonList.add(this.Winter); this.buttonList.add(slider = new GuiSlider(21, width/2-100, 25, 200, 20, "Size: ", " %", 0, 100, 50, true, true)); this.buttonList.add(red = new GuiSlider(22, width/2-100, 60, 200, 20, "Red: ", " %", 0, 100, 50, true, true)); this.buttonList.add(green = new GuiSlider(23, width/2-100, 95, 200, 20, "Green: ", " %", 0, 100, 50, true, true)); this.buttonList.add(blue = new GuiSlider(24, width/2-100, 130, 200, 20, "Blue: ", " %", 0, 100, 50, true, true)); this.buttonList.add(new GuiButton(5, width / 2 - 100, var3 + 170, I18n.format("Done", new Object[0]))); } protected void actionPerformed(GuiButton button) throws IOException { if (button.id == 2) { if (wings==true){ wings=false; }else if (wings==false){ wings=true; } } if (button.id == 3) { if (winter==true){ winter=false; }else if (winter==false){ winter=true; } } if(button.id == 21) { slider.updateSlider(); } if (button.id == 5) { this.mc.displayGuiScreen(new GuiCosmetics()); } this.updateButtons(); } private void updateButtons() { this.Wings.displayString = wings ? "Wings: Disabled" : (wings ? "Wings:" : "Wings: Enabled"); this.Winter.displayString = winter ? "Winter Wings: Disabled" : (winter ? " Winter Wings:" : "Winter Wings: Enabled"); } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.