diff --git a/src/main/java/net/silentclient/client/gui/elements/HSBPicker.java b/src/main/java/net/silentclient/client/gui/elements/HSBPicker.java index caa2615..1f97690 100644 --- a/src/main/java/net/silentclient/client/gui/elements/HSBPicker.java +++ b/src/main/java/net/silentclient/client/gui/elements/HSBPicker.java @@ -3,7 +3,6 @@ package net.silentclient.client.gui.elements; import net.minecraft.client.gui.Gui; import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; -import net.silentclient.client.gui.util.RenderUtil; import org.lwjgl.opengl.GL11; import java.awt.*; @@ -24,11 +23,10 @@ public class HSBPicker extends Gui { public int cursorY; public boolean alphaSlider = true; - public String text; public SimpleAnimation sx = new SimpleAnimation(0f); public SimpleAnimation sy = new SimpleAnimation(0f); - public HSBPicker(int x, int y, int width, int height, boolean alphaSlider, String text) { + public HSBPicker(int x, int y, int width, int height, boolean alphaSlider) { this.x = x; this.y = y; this.width = width; @@ -36,7 +34,6 @@ public class HSBPicker extends Gui { this.color = new float[]{0.4f, 1.0f, 1.0f, 1.0f}; this.pickingColor = false; this.alphaSlider = alphaSlider; - this.text = text; } public void init() { diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java index 1d59315..8285dce 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ClickGUI.java @@ -140,7 +140,7 @@ public class ClickGUI extends SilentScreen { RenderUtil.drawImage(new ResourceLocation(m.getIcon()), modOffsetX + ((65 / 2) - 10), y + modOffsetY - scrollAnimation.getValue() + ((70 / 2) - 10), 20, 20, false); } if(selectedCategory.equals(ModCategory.MODS)) { - Switch.render(mouseX, mouseY, switchX, switchY, m.switchAniamation, m.isEnabled(), m.isForceDisabled(), m.isForceDisabled() ? "Force disabled" : null); + Switch.render(mouseX, mouseY, switchX, switchY, m.simpleAnimation, m.isEnabled(), m.isForceDisabled(), m.isForceDisabled() ? "Force disabled" : null); } if(switchHovered || isHovered) { diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java index 80c4aa0..df021be 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/GuiColorPicker.java @@ -16,9 +16,8 @@ import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; import net.silentclient.client.gui.theme.Theme; +import net.silentclient.client.gui.util.ColorPickerAction; import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.mods.Mod; -import net.silentclient.client.mods.Setting; import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.Sounds; @@ -27,53 +26,47 @@ import org.lwjgl.opengl.GL11; import java.awt.*; import java.io.IOException; -import java.util.ArrayList; public class GuiColorPicker extends SilentScreen { - private final Mod mod; private final GuiScreen parentScreen; - - private ArrayList colors = new ArrayList(); - private final String value; private long initTime; - private HSBPicker hsb; + private final Color defaultColor; + private boolean chroma; + private final boolean allowChangeOpacity; + private int opacity; + private ColorPickerAction action; - public GuiColorPicker(Mod mod, String value, GuiScreen parentScreen) { - if (mod == null) throw new IllegalArgumentException("Mod is null"); - - this.mod = mod; + public GuiColorPicker(Color defaultColor, boolean chroma, boolean allowChangeOpacity, int opacity, ColorPickerAction action, GuiScreen parentScreen) { this.parentScreen = parentScreen; - this.value = value; - float colorY = 80; - int colorX = 3; + this.defaultColor = defaultColor; + this.allowChangeOpacity = allowChangeOpacity; + this.chroma = chroma; + this.opacity = opacity; + this.action = action; } @Override public void initGui() { defaultCursor = false; this.initTime = System.currentTimeMillis(); - colors.clear(); MenuBlurUtils.loadBlur(); int addX = 190; int addY = 110; int x = (width / 2) - addX; int y = (height / 2) - addY; int height = addY * 2; - Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); this.buttonList.add(new Button(1, x + 5, y + 25, 75, 20, "< Back")); this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD")); - hsb = new HSBPicker(x + 100, y + 40, 120, 70, false, value); - float[] vals = Color.RGBtoHSB(setting.getValColor(true).getRed(),setting.getValColor(true).getGreen(), setting.getValColor(true).getBlue(), null); - hsb.color = new float[] {vals[0],vals[1],vals[2], setting.getValColor(true).getAlpha() / 255.0f}; + hsb = new HSBPicker(x + 100, y + 40, 120, 70, false); + float[] vals = Color.RGBtoHSB(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), null); + hsb.color = new float[] {vals[0],vals[1],vals[2], defaultColor.getAlpha() / 255.0f}; hsb.init(); } @Override public void onGuiClosed() { - if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) { - mc.renderGlobal.loadRenderers(); - } + action.onClose(hsb.getSelectedColorFinal(), chroma, opacity); MenuBlurUtils.unloadBlur(); super.onGuiClosed(); } @@ -92,24 +85,18 @@ public class GuiColorPicker extends SilentScreen { int width = addX * 2; int height = addY * 2; GlStateManager.pushMatrix(); - GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue()); + GlUtils.startScale((float) ((x) + (x) + width) / 2, (float) ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue()); RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); GL11.glPushMatrix(); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); int settingY = y + 25; - - int colorIndex = 0; - int spacing = 100; - - Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); - - setting.setValColor(hsb.getSelectedColorFinal()); + action.onChange(hsb.getSelectedColorFinal(), chroma, opacity); int settingHeight = 10 + 5; - Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", setting.isChroma()); + Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", chroma); if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { cursorType = MouseCursorHandler.CursorType.POINTER; } @@ -118,14 +105,14 @@ public class GuiColorPicker extends SilentScreen { hsb.render(mouseX, mouseY); - if(setting.isCanChangeOpacity()) { + if(allowChangeOpacity) { GlStateManager.color(1, 1, 1, 1); - Slider.render(x, settingY - 1, width, "Opacity", 255, setting.getOpacity()); + Slider.render(x, settingY - 1, width, "Opacity", 255, opacity); if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) { double diff = 255; double mouse = MathHelper.clamp_double((double) (mouseX - Slider.getLeft(x, width)) / 90D, 0, 1); double newVal = 0 + mouse * diff; - setting.setOpacity((int) newVal); + opacity = (int) newVal; } } @@ -165,7 +152,6 @@ public class GuiColorPicker extends SilentScreen { @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - // TODO Auto-generated method stub super.mouseClicked(mouseX, mouseY, mouseButton); int addX = 190; @@ -174,16 +160,12 @@ public class GuiColorPicker extends SilentScreen { int x = (width / 2) - addX; int y = (height / 2) - addY; int settingY = y + 25; - int colorIndex = 0; - int spacing = 100; - - Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); hsb.mouseClicked(mouseX, mouseY, mouseButton); if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { Sounds.playButtonSound(); - setting.setChroma(!setting.isChroma()); + chroma = !chroma; } } diff --git a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java index 34a195f..7916c9d 100644 --- a/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/lite/clickgui/ModSettings.java @@ -10,6 +10,7 @@ import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.animation.normal.Direction; +import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils.Scroll; @@ -19,6 +20,7 @@ import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.modmenu.CellGrid; import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.theme.input.DefaultInputTheme; +import net.silentclient.client.gui.util.ColorPickerAction; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; @@ -32,6 +34,7 @@ import net.silentclient.client.utils.Sounds; import org.lwjgl.input.Keyboard; import org.lwjgl.opengl.GL11; +import java.awt.*; import java.io.IOException; import java.net.URI; @@ -194,10 +197,12 @@ public class ModSettings extends SilentScreen { } if (setting.isCheck()) { - Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, setting.getName(), setting.getValBoolean()); - if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { + Switch.render(mouseX, mouseY, x + 100, settingY - 1, setting.switchAnimation, setting.getValBoolean(), false); + if(Switch.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { cursorType = MouseCursorHandler.CursorType.POINTER; } + + Client.getInstance().getSilentFontRenderer().drawString(setting.getName(), x + 100 + 18, settingY + (((float) 8 / 2) - ((float) 12 / 2)) - 1, 12, SilentFontRenderer.FontType.TITLE); } if(setting.isCellGrid()) { MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, x + 100, settingY, setting); @@ -230,7 +235,7 @@ public class ModSettings extends SilentScreen { if(MouseUtils.isInside(mouseX, mouseY, x + width - (10 + 8) - 15, y + 5 + scrollAnimation.getValue(), 10, 10)) { cursorType = MouseCursorHandler.CursorType.POINTER; } - Switch.render(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue(), mod.switchAniamation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null); + Switch.render(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue(), mod.simpleAnimation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null); if(Switch.isHovered(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue())) { cursorType = MouseCursorHandler.CursorType.POINTER; } @@ -403,7 +408,7 @@ public class ModSettings extends SilentScreen { } if (setting.isCheck()) { - if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { + if(Switch.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { Sounds.playButtonSound(); setting.setValBoolean(!setting.getValBoolean()); mod.onChangeSettingValue(setting); @@ -412,7 +417,16 @@ public class ModSettings extends SilentScreen { if (setting.isColor() && ColorPicker.isHovered(mouseX, mouseY, x, settingY - 1, width)) { Sounds.playButtonSound(); - this.mc.displayGuiScreen(new GuiColorPicker(mod, setting.getName(), this)); + this.mc.displayGuiScreen(new GuiColorPicker(setting.getValColor(true), setting.isChroma(), setting.isCanChangeOpacity(), setting.getOpacity(), new ColorPickerAction() { + @Override + public void onChange(Color color, boolean chroma, int opacity) { + setting.setValColor(color); + setting.setChroma(chroma); + if(setting.isCanChangeOpacity()) { + setting.setOpacity(opacity); + } + } + }, this)); } settingY += settingHeight; diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java index 57ed80c..648f6a3 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java @@ -9,39 +9,30 @@ import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Checkbox; import net.silentclient.client.gui.elements.HSBPicker; -import net.silentclient.client.gui.theme.button.DefaultButtonTheme; -import net.silentclient.client.gui.theme.button.SelectedButtonTheme; -import net.silentclient.client.mods.Mod; -import net.silentclient.client.mods.ModCategory; -import net.silentclient.client.mods.Setting; +import net.silentclient.client.gui.util.ColorPickerAction; import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.MouseCursorHandler; import java.awt.*; import java.io.IOException; -import java.util.ArrayList; public class ColorPicker extends SilentScreen { - private long initTime; - private final Mod mod; private final GuiScreen parentScreen; - private ArrayList colors = new ArrayList(); - private final String value; + private long initTime; private HSBPicker hsb; + private final Color defaultColor; + private boolean chroma; + private final boolean allowChangeOpacity; + private int opacity; + private ColorPickerAction action; - public ColorPicker(Mod mod, String value, GuiScreen parentScreen) { - if (mod == null) throw new IllegalArgumentException("Mod is null"); - - this.mod = mod; + public ColorPicker(Color defaultColor, boolean chroma, boolean allowChangeOpacity, int opacity, ColorPickerAction action, GuiScreen parentScreen) { this.parentScreen = parentScreen; - this.value = value; - float colorY = 80; - int colorX = 3; - Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); - hsb = new HSBPicker((int)colorX, (int)colorY, 120, 70, false, value); - float[] vals = Color.RGBtoHSB(setting.getValColor(true).getRed(),setting.getValColor(true).getGreen(), setting.getValColor(true).getBlue(), null); - hsb.color = new float[] {vals[0],vals[1],vals[2], setting.getValColor(true).getAlpha() / 255.0f}; - hsb.init(); + this.defaultColor = defaultColor; + this.allowChangeOpacity = allowChangeOpacity; + this.chroma = chroma; + this.opacity = opacity; + this.action = action; } @Override @@ -51,22 +42,21 @@ public class ColorPicker extends SilentScreen { this.initTime = System.currentTimeMillis(); this.buttonList.clear(); this.silentInputs.clear(); + hsb = new HSBPicker(3, 80, 120, 70, false); + float[] vals = Color.RGBtoHSB(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), null); + hsb.color = new float[] {vals[0],vals[1],vals[2], defaultColor.getAlpha() / 255.0f}; + hsb.init(); MenuBlurUtils.loadBlur(); ModMenu.initBaseButtons(this.buttonList); this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back")); - this.buttonList.add(new Button(2, 3, this.height - 18, mod.getCategory() == ModCategory.MODS ? 70 : 144, 15, "Reset")); - if(mod.getCategory() == ModCategory.MODS) { - this.buttonList.add(new Button(3, 76, this.height - 18, 70, 15, mod.isEnabled() ? "Enabled" : "Disabled", false, mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme())); - } } @Override public void drawScreen(int mouseX, int mouseY, float partialTicks) { MenuBlurUtils.renderBackground(this); MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList); - Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); ModMenu.drawOverlayListBase(height, "Choose a color"); @@ -75,25 +65,25 @@ public class ColorPicker extends SilentScreen { ModMenu.trimContentStart(width, height); float colorY = 66; - Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", setting.isChroma()); + Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", chroma); if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { cursorType = MouseCursorHandler.CursorType.POINTER; } hsb.render(mouseX, mouseY); + action.onChange(hsb.getSelectedColorFinal(), chroma, opacity); + colorY += 100; - Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(hsb.getSelectedColorFinal()); - - if(setting.isCanChangeOpacity()) { + if(allowChangeOpacity) { GlStateManager.color(1, 1, 1, 1); - RegularSlider.render(3, colorY, 144, "Opacity", 255, setting.getOpacity()); + RegularSlider.render(3, colorY, 144, "Opacity", 255, opacity); if (RegularSlider.isDrag(mouseX, mouseY, 3, colorY, 144) && (System.currentTimeMillis() - initTime) > 500) { double diff = 255; double mouse = MathHelper.clamp_double((mouseX - 3) / 144D, 0, 1); double newVal = 0 + mouse * diff; - setting.setOpacity((int) newVal); + opacity = (int) newVal; } } @@ -107,30 +97,17 @@ public class ColorPicker extends SilentScreen { super.actionPerformed(button); ModMenu.clickBaseButtons(button, this); - switch (button.id) { - case 1: - mc.displayGuiScreen(parentScreen); - break; - case 2: - mod.reset(false); - break; - case 3: - mod.toggle(); - button.displayString = mod.isEnabled() ? "Enabled" : "Disabled"; - if(button instanceof Button) { - ((Button) button).setTheme(mod.isEnabled() ? new SelectedButtonTheme() : new DefaultButtonTheme()); - } - break; + if (button.id == 1) { + mc.displayGuiScreen(parentScreen); } } @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); - Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); float colorY = 66; if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { - setting.setChroma(!setting.isChroma()); + chroma = !chroma; } hsb.mouseClicked(mouseX, mouseY, mouseButton); @@ -145,9 +122,7 @@ public class ColorPicker extends SilentScreen { @Override public void onGuiClosed() { super.onGuiClosed(); - if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) { - mc.renderGlobal.loadRenderers(); - } + action.onClose(hsb.getSelectedColorFinal(), chroma, opacity); MenuBlurUtils.unloadBlur(); Client.getInstance().configManager.save(); } diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java b/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java index c36873d..4323a06 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModMenu.java @@ -23,6 +23,7 @@ import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.theme.button.DefaultButtonTheme; import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.gui.theme.switches.DefaultSwitchTheme; +import net.silentclient.client.gui.util.ColorPickerAction; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; @@ -171,7 +172,7 @@ public class ModMenu extends SilentScreen { } if(modCategory == ModCategory.MODS) { - Switch.render(mouseX, mouseY, 129, modY + 10 - 4, mod.switchAniamation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null); + Switch.render(mouseX, mouseY, 129, modY + 10 - 4, mod.simpleAnimation, mod.isEnabled(), mod.isForceDisabled(), mod.isForceDisabled() ? "Force disabled" : null); if(Switch.isHovered(mouseX, mouseY, 129, modY + 10 - 4)) { cursorType = MouseCursorHandler.CursorType.POINTER; } @@ -449,7 +450,24 @@ public class ModMenu extends SilentScreen { premiumY += 15; if(RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) premiumY, 144)) { // Color Picker - mc.displayGuiScreen(new PremiumColorPicker(this)); + mc.displayGuiScreen(new ColorPicker(Client.getInstance().getAccount().getBandanaColor() == 50 ? new Color(255, 255, 255) : new Color(Client.getInstance().getAccount().getBandanaColor()), Client.getInstance().getAccount().getBandanaColor() == 50, false, 255, new ColorPickerAction() { + @Override + public void onChange(Color color, boolean chroma, int opacity) { + int colorInt = 0; + colorInt = color.getRGB(); + if(chroma) { + colorInt = 50; + } + if(Client.getInstance().getAccount().getBandanaColor() != colorInt) { + Client.getInstance().getAccount().setBandanaColor(colorInt); + } + } + + @Override + public void onClose(Color color, boolean chroma, int opacity) { + Client.getInstance().getAccount().saveBandanaColor(); + } + }, this)); return; } premiumY += 15; diff --git a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java index ee20e1a..990506f 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ModSettings.java @@ -7,15 +7,14 @@ import net.minecraft.util.MathHelper; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.animation.SimpleAnimation; +import net.silentclient.client.gui.elements.*; import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.elements.Input; -import net.silentclient.client.gui.elements.StaticButton; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.theme.button.DefaultButtonTheme; import net.silentclient.client.gui.theme.button.RedButtonTheme; import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.gui.theme.input.DefaultInputTheme; +import net.silentclient.client.gui.util.ColorPickerAction; import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.Setting; @@ -26,6 +25,7 @@ import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.Sounds; import org.lwjgl.input.Mouse; +import java.awt.*; import java.io.IOException; import java.net.URI; @@ -130,10 +130,12 @@ public class ModSettings extends SilentScreen { } } if (setting.isCheck()) { - Checkbox.render(mouseX, mouseY, 3, settingY, setting.getName(), setting.getValBoolean()); - if(Checkbox.isHovered(mouseX, mouseY, 3, settingY)) { + Switch.render(mouseX, mouseY, 3, settingY, setting.switchAnimation, setting.getValBoolean(), false); + if(Switch.isHovered(mouseX, mouseY, 3, settingY)) { cursorType = MouseCursorHandler.CursorType.POINTER; } + + Client.getInstance().getSilentFontRenderer().drawString(setting.getName(), 3 + 18, settingY + (((float) 8 / 2) - ((float) 12 / 2)), 12, SilentFontRenderer.FontType.TITLE); } if(setting.isCellGrid()) { MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, 3, settingY, setting); @@ -260,10 +262,19 @@ public class ModSettings extends SilentScreen { inputIndex++; } if (setting.isColor() && RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) settingY, 144)) { - mc.displayGuiScreen(new ColorPicker(mod, setting.getName(), this)); + mc.displayGuiScreen(new ColorPicker(setting.getValColor(true), setting.isChroma(), setting.isCanChangeOpacity(), setting.getOpacity(), new ColorPickerAction() { + @Override + public void onChange(Color color, boolean chroma, int opacity) { + setting.setValColor(color); + setting.setChroma(chroma); + if(setting.isCanChangeOpacity()) { + setting.setOpacity(opacity); + } + } + }, this)); } if (setting.isCheck()) { - if(Checkbox.isHovered(mouseX, mouseY, 3, settingY)) { + if(Switch.isHovered(mouseX, mouseY, 3, settingY)) { Sounds.playButtonSound(); setting.setValBoolean(!setting.getValBoolean()); mod.onChangeSettingValue(setting); diff --git a/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java b/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java deleted file mode 100644 index 7b7016a..0000000 --- a/src/main/java/net/silentclient/client/gui/modmenu/PremiumColorPicker.java +++ /dev/null @@ -1,149 +0,0 @@ -package net.silentclient.client.gui.modmenu; - -import net.minecraft.client.gui.GuiButton; -import net.minecraft.client.gui.GuiScreen; -import net.silentclient.client.Client; -import net.silentclient.client.gui.SilentScreen; -import net.silentclient.client.gui.elements.Button; -import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; -import net.silentclient.client.gui.util.RenderUtil; -import net.silentclient.client.utils.MenuBlurUtils; -import net.silentclient.client.utils.MouseCursorHandler; - -import java.awt.*; -import java.io.IOException; -import java.util.ArrayList; - -public class PremiumColorPicker extends SilentScreen { - private long initTime; - private final GuiScreen parentScreen; - private ArrayList colors = new ArrayList(); - - public PremiumColorPicker(GuiScreen parentScreen) { - this.parentScreen = parentScreen; - } - - @Override - public void initGui() { - super.initGui(); - defaultCursor = false; - this.initTime = System.currentTimeMillis(); - this.buttonList.clear(); - this.silentInputs.clear(); - - MenuBlurUtils.loadBlur(); - - ModMenu.initBaseButtons(this.buttonList); - this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back")); - - colors.clear(); - colors.add(new Color(255, 255, 255)); - colors.add(new Color(156, 157, 151)); - colors.add(new Color(71,79,82)); - colors.add(new Color(0, 0, 0)); - colors.add(new Color(255,216,61)); - colors.add(new Color(249,128,29)); - colors.add(new Color(176,46,38)); - colors.add(new Color(130,84,50)); - colors.add(new Color(128,199,31)); - colors.add(new Color(58,179,218)); - colors.add(new Color(22,156,157)); - colors.add(new Color(60,68,169)); - colors.add(new Color(243,140,170)); - colors.add(new Color(198,79,189)); - colors.add(new Color(137,50,183)); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - MenuBlurUtils.renderBackground(this); - - MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList); - - ModMenu.drawOverlayListBase(height, "Choose a color"); - - ModMenu.trimContentStart(width, height); - float colorY = 66; - int colorX = 3; - int colorIndex = 0; - for(Color color : colors) { - RenderUtil.drawRoundedRect(colorX, colorY, 20, 20, 3, new Color(color.getRed(), color.getGreen(), color.getBlue()).getRGB()); - RenderUtil.drawRoundedOutline(colorX, colorY, 20, 20, 3, 2, new Color(0, 0, 0).getRGB()); - if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) { - cursorType = MouseCursorHandler.CursorType.POINTER; - } - colorX += 25; - colorIndex += 1; - if(colorIndex == 6) { - colorIndex = 0; - colorX = 3; - colorY += 25; - } - } - - int settingHeight = 15; - colorY += settingHeight; - colorY += settingHeight; - - Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", Client.getInstance().getAccount().getBandanaColor() == 50); - - if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { - cursorType = MouseCursorHandler.CursorType.POINTER; - } - - super.drawScreen(mouseX, mouseY, partialTicks); - - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); - - ModMenu.trimContentEnd(); - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - super.actionPerformed(button); - ModMenu.clickBaseButtons(button, this); - - switch (button.id) { - case 1: - mc.displayGuiScreen(parentScreen); - break; - } - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - super.mouseClicked(mouseX, mouseY, mouseButton); - float colorY = 66; - int colorX = 3; - int colorIndex = 0; - for(Color color : colors) { - if(MouseUtils.isInside(mouseX, mouseY, colorX, colorY, 20, 20)) { - Client.getInstance().getAccount().setBandanaColor(color.getRGB()); - mc.displayGuiScreen(parentScreen); - } - colorX += 25; - colorIndex += 1; - if(colorIndex == 6) { - colorIndex = 0; - colorX = 3; - colorY += 25; - } - } - - int settingHeight = 15; - colorY += settingHeight; - colorY += settingHeight; - - if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { - Client.getInstance().getAccount().setBandanaColor(Client.getInstance().getAccount().getBandanaColor() == 50 ? -1 : 50); - mc.displayGuiScreen(parentScreen); - } - } - - @Override - public void onGuiClosed() { - super.onGuiClosed(); - MenuBlurUtils.unloadBlur(); - } -} diff --git a/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java b/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java index ae1964c..9c13c64 100644 --- a/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java +++ b/src/main/java/net/silentclient/client/gui/multiplayer/SilentMultiplayerGui.java @@ -231,7 +231,7 @@ public class SilentMultiplayerGui extends SilentScreen { break; case 2: if(this.selectedServer != -1) { - this.savedServerList.removeServerData(this.selectedServer); + this.savedServerList.removeServerData(this.selectedServer - Client.getInstance().getFeaturedServers().size()); this.savedServerList.saveServerList(); this.selectServer(-1); this.refreshServerList(); diff --git a/src/main/java/net/silentclient/client/gui/resourcepacks/SilentResourcePacksGui.java b/src/main/java/net/silentclient/client/gui/resourcepacks/SilentResourcePacksGui.java index 608f139..ae61f6f 100644 --- a/src/main/java/net/silentclient/client/gui/resourcepacks/SilentResourcePacksGui.java +++ b/src/main/java/net/silentclient/client/gui/resourcepacks/SilentResourcePacksGui.java @@ -28,6 +28,7 @@ import java.io.IOException; import java.net.URI; import java.util.Collections; import java.util.List; +import java.util.Random; public class SilentResourcePacksGui extends SilentScreen { private final GuiScreen parentScreen; @@ -40,6 +41,7 @@ public class SilentResourcePacksGui extends SilentScreen { private int blockHeight = 0; private ScrollHelper scrollHelper = new ScrollHelper(); private ScrollHelper scrollHelper2 = new ScrollHelper(); + private Random random = new Random(); public SilentResourcePacksGui(GuiScreen parentScreenIn) { @@ -61,6 +63,7 @@ public class SilentResourcePacksGui extends SilentScreen { if(mc.thePlayer != null) { this.buttonList.add(new TooltipIconButton(2, blockX + blockWidth - 14 - 5, blockY + blockHeight - 5 - 14, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/lightoverlay.png"), "Toggle Background Panorama")); } + this.buttonList.add(new TooltipIconButton(6, blockX + 5, blockY + blockHeight - 5 - 14, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/dice.png"), "Random Resource Pack")); this.buttonList.add(new Button(3, blockX + 40, blockY + blockHeight - 5 - 14, 100, 14, "Open Pack Folder")); this.buttonList.add(new Button(4, blockX + 40 + 100 + 5, blockY + blockHeight - 5 - 14, 100, 14, "Apply")); this.buttonList.add(new Button(5, blockX + 40 + 100 + 5 + 100 + 5, blockY + blockHeight - 5 - 14, 100, 14, "Done")); @@ -410,9 +413,30 @@ public class SilentResourcePacksGui extends SilentScreen { this.apply(); mc.displayGuiScreen(parentScreen); break; + case 6: + this.randomPack(); + break; } } + private void randomPack() { + if(!this.selectedResourcePacks.isEmpty()) { + for(ResourcePackRepository.Entry entry : this.selectedResourcePacks) { + this.availableResourcePacks.add(0, entry); + } + this.selectedResourcePacks.clear(); + } + + ResourcePackRepository.Entry randomPack = this.availableResourcePacks.get(random.nextInt(this.availableResourcePacks.size())); + + if(randomPack != null) { + this.selectedResourcePacks.add(0, randomPack); + this.availableResourcePacks.remove(randomPack); + } + + this.markChanged(); + } + @Override protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { super.mouseClicked(mouseX, mouseY, mouseButton); diff --git a/src/main/java/net/silentclient/client/gui/util/ColorPickerAction.java b/src/main/java/net/silentclient/client/gui/util/ColorPickerAction.java new file mode 100644 index 0000000..5faabd8 --- /dev/null +++ b/src/main/java/net/silentclient/client/gui/util/ColorPickerAction.java @@ -0,0 +1,10 @@ +package net.silentclient.client.gui.util; + +import java.awt.*; + +public interface ColorPickerAction { + void onChange(Color color, boolean chroma, int opacity); + default void onClose(Color color, boolean chroma, int opacity) { + + } +} diff --git a/src/main/java/net/silentclient/client/mixin/mixins/RenderGlobalMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/RenderGlobalMixin.java index 65c3878..6c5b6cd 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/RenderGlobalMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/RenderGlobalMixin.java @@ -9,8 +9,10 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ResourceLocation; +import net.silentclient.client.Client; import net.silentclient.client.event.impl.RenderTickEvent; import net.silentclient.client.mods.render.BlockOverlayMod; +import net.silentclient.client.mods.settings.FPSBoostMod; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Overwrite; @@ -45,4 +47,11 @@ public abstract class RenderGlobalMixin { { BlockOverlayMod.drawSelectionBox(player, movingObjectPositionIn, p_72731_3_, partialTicks); } + + @Inject(method = "renderWorldBorder", at = @At("HEAD"), cancellable = true) + public void cancelRenderWorldBorder(Entity entityIn, float partialTicks, CallbackInfo ci) { + if(Client.getInstance().getSettingsManager().getSettingByClass(FPSBoostMod.class, "Hide World Border").getValBoolean()) { + ci.cancel(); + } + } } diff --git a/src/main/java/net/silentclient/client/mods/Mod.java b/src/main/java/net/silentclient/client/mods/Mod.java index a8c8e5a..3d3e8a5 100644 --- a/src/main/java/net/silentclient/client/mods/Mod.java +++ b/src/main/java/net/silentclient/client/mods/Mod.java @@ -31,7 +31,7 @@ public class Mod implements IMod { private boolean updated = false; private boolean newMod = false; - public SimpleAnimation switchAniamation = new SimpleAnimation(0); + public SimpleAnimation simpleAnimation = new SimpleAnimation(0); public Mod(String name, ModCategory category, String icon, boolean defaultEnabled, boolean updated, boolean newMod) { this.mc = Minecraft.getMinecraft(); diff --git a/src/main/java/net/silentclient/client/mods/Setting.java b/src/main/java/net/silentclient/client/mods/Setting.java index 568b8a9..764e31e 100644 --- a/src/main/java/net/silentclient/client/mods/Setting.java +++ b/src/main/java/net/silentclient/client/mods/Setting.java @@ -2,6 +2,7 @@ package net.silentclient.client.mods; import net.minecraft.client.Minecraft; import net.silentclient.client.Client; +import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.utils.ColorUtils; import org.lwjgl.input.Keyboard; @@ -49,6 +50,7 @@ public class Setting implements Comparable { private boolean canChangeOpacity = false; private boolean onlyPremiumPlus = false; + public SimpleAnimation switchAnimation = new SimpleAnimation(0); public Setting(String name, Mod parent, String sval, ArrayList options) { this.name = name; diff --git a/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java b/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java index 7209e04..dd25c7f 100644 --- a/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java +++ b/src/main/java/net/silentclient/client/mods/settings/FPSBoostMod.java @@ -76,6 +76,7 @@ public class FPSBoostMod extends Mod { this.addBooleanSetting("Hide Lava Particles", this, false); // ready this.addBooleanSetting("Hide Mob in Spawner", this, false); // ready this.addBooleanSetting("Hide Spawner Particles", this, false); // ready + this.addBooleanSetting("Hide World Border", this, false); // ready this.addSliderSetting("Player Render Distance", this, 64, 1, 64, true); // ready this.addSliderSetting("Passive Entity Render Distance", this, 64, 1, 64, true); // ready this.addSliderSetting("Hostile Entity Render Distance", this, 64, 1, 64, true); // ready diff --git a/src/main/java/net/silentclient/client/premium/PremiumGui.java b/src/main/java/net/silentclient/client/premium/PremiumGui.java index 2a2802e..95406a6 100644 --- a/src/main/java/net/silentclient/client/premium/PremiumGui.java +++ b/src/main/java/net/silentclient/client/premium/PremiumGui.java @@ -1,35 +1,23 @@ package net.silentclient.client.premium; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; -import net.minecraft.client.renderer.GlStateManager; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; -import net.silentclient.client.gui.SilentScreen; -import net.silentclient.client.gui.animation.normal.Direction; -import net.silentclient.client.gui.lite.clickgui.ClickGUI; -import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; -import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; -import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; -import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Checkbox; -import net.silentclient.client.gui.elements.*; +import net.silentclient.client.gui.elements.ColorPicker; +import net.silentclient.client.gui.elements.Input; +import net.silentclient.client.gui.elements.StaticButton; import net.silentclient.client.gui.font.SilentFontRenderer; -import net.silentclient.client.gui.hud.HUDConfigScreen; -import net.silentclient.client.gui.theme.Theme; +import net.silentclient.client.gui.lite.clickgui.GuiColorPicker; +import net.silentclient.client.gui.util.ColorPickerAction; import net.silentclient.client.gui.util.RenderUtil; import net.silentclient.client.utils.ColorUtils; -import net.silentclient.client.utils.MenuBlurUtils; import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.Sounds; -import org.lwjgl.input.Keyboard; -import org.lwjgl.opengl.GL11; import java.awt.*; -import java.io.IOException; import java.net.URI; -import java.util.ArrayList; public class PremiumGui { public static MouseCursorHandler.CursorType drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) { @@ -105,7 +93,24 @@ public class PremiumGui { int settingY = y + 25; if(ColorPicker.isHovered(mouseX, mouseY, x, settingY, width)) { Sounds.playButtonSound(); - Minecraft.getMinecraft().displayGuiScreen(new PremiumGui.PremiumColorPicker(instance)); + Minecraft.getMinecraft().displayGuiScreen(new GuiColorPicker(Client.getInstance().getAccount().getBandanaColor() == 50 ? new Color(255, 255, 255) : new Color(Client.getInstance().getAccount().getBandanaColor()), Client.getInstance().getAccount().getBandanaColor() == 50, false, 255, new ColorPickerAction() { + @Override + public void onChange(Color color, boolean chroma, int opacity) { + int colorInt = 0; + colorInt = color.getRGB(); + if(chroma) { + colorInt = 50; + } + if(Client.getInstance().getAccount().getBandanaColor() != colorInt) { + Client.getInstance().getAccount().setBandanaColor(colorInt); + } + } + + @Override + public void onClose(Color color, boolean chroma, int opacity) { + Client.getInstance().getAccount().saveBandanaColor(); + } + }, instance)); } settingY += 15; if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY, 65, 12)) { @@ -132,176 +137,4 @@ public class PremiumGui { } } } - - public static class PremiumColorPicker extends SilentScreen { - private final GuiScreen parentScreen; - - private ArrayList colors = new ArrayList(); - - public PremiumColorPicker(GuiScreen parent) { - this.parentScreen = parent; - } - - @Override - public void initGui() { - colors.clear(); - defaultCursor = false; - colors.add(new Color(255, 255, 255)); - colors.add(new Color(156, 157, 151)); - colors.add(new Color(71,79,82)); - colors.add(new Color(0, 0, 0)); - colors.add(new Color(255,216,61)); - colors.add(new Color(249,128,29)); - colors.add(new Color(176,46,38)); - colors.add(new Color(130,84,50)); - colors.add(new Color(128,199,31)); - colors.add(new Color(58,179,218)); - colors.add(new Color(22,156,157)); - colors.add(new Color(60,68,169)); - colors.add(new Color(243,140,170)); - colors.add(new Color(198,79,189)); - colors.add(new Color(137,50,183)); - MenuBlurUtils.loadBlur(); - int addX = 190; - int addY = 110; - int x = (width / 2) - addX; - int y = (height / 2) - addY; - int height = addY * 2; - this.buttonList.add(new Button(1, x + 5, y + 25, 75, 20, "< Back")); - this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD")); - } - - @Override - public void onGuiClosed() { - MenuBlurUtils.unloadBlur(); - super.onGuiClosed(); - } - - @Override - public void drawScreen(int mouseX, int mouseY, float partialTicks) { - MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList); - MenuBlurUtils.renderBackground(this); - - int addX = 190; - int addY = 110; - - int x = (width / 2) - addX; - int y = (height / 2) - addY; - int width = addX * 2; - int height = addY * 2; - GlStateManager.pushMatrix(); - GlUtils.startScale(((x) + (x) + width) / 2, ((y) + (y + height)) / 2, (float) ClickGUI.introAnimation.getValue()); - RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB()); - - GL11.glPushMatrix(); - GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); - - int settingY = y + 25; - - int colorIndex = 0; - int spacing = 100; - - for(Color color : colors) { - RenderUtils.drawRect(x + spacing, settingY - 1, 22, 22, new Color(0, 0, 0).getRGB()); - RenderUtils.drawRect(x + spacing + 1, settingY - 1 + 1, 20, 20, new Color(color.getRed(), color.getGreen(), color.getBlue()).getRGB()); - if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22)) { - cursorType = MouseCursorHandler.CursorType.POINTER; - } - spacing += 25; - colorIndex += 1; - if(colorIndex == 5 || colorIndex == 10) { - spacing = 100; - settingY += 30; - } - } - - int settingHeight = 10 + 5; - settingY += settingHeight; - settingY += settingHeight; - - Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", Client.getInstance().getAccount().getBandanaColor() == 50); - if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { - cursorType = MouseCursorHandler.CursorType.POINTER; - } - - GL11.glPopMatrix(); - - RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15); - Client.getInstance().getSilentFontRenderer().drawString("Choose a color", x + 100, (int) (y + 5), 14, SilentFontRenderer.FontType.TITLE); - - super.drawScreen(mouseX, mouseY, partialTicks); - - if(ClickGUI.close) { - ClickGUI.introAnimation.setDirection(Direction.BACKWARDS); - if(ClickGUI.introAnimation.isDone(Direction.BACKWARDS)) { - mc.displayGuiScreen(null); - } - } - - Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); - - GlUtils.stopScale(); - GlStateManager.popMatrix(); - } - - @Override - protected void actionPerformed(GuiButton button) throws IOException { - super.actionPerformed(button); - if(button.id == 1) { - mc.displayGuiScreen(parentScreen); - } - - if(button.id == 2) { - mc.displayGuiScreen(new HUDConfigScreen(this)); - } - } - - @Override - protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { - // TODO Auto-generated method stub - super.mouseClicked(mouseX, mouseY, mouseButton); - - int addX = 190; - int addY = 110; - - int x = (width / 2) - addX; - int y = (height / 2) - addY; - - int settingY = y + 25; - - int colorIndex = 0; - int spacing = 100; - - for(Color color : colors) { - if(MouseUtils.isInside(mouseX, mouseY, x + spacing, settingY - 1, 22, 22) && mouseButton == 0) { - Client.getInstance().getAccount().setBandanaColor(color.getRGB()); - Sounds.playButtonSound(); - mc.displayGuiScreen(parentScreen); - } - spacing += 25; - colorIndex += 1; - if(colorIndex == 5 || colorIndex == 10) { - spacing = 100; - settingY += 30; - } - } - - int settingHeight = 10 + 5; - - settingY += settingHeight + settingHeight; - - if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { - Client.getInstance().getAccount().setBandanaColor(Client.getInstance().getAccount().getBandanaColor() == 50 ? -1 : 50); - Sounds.playButtonSound(); - } - } - - @Override - protected void keyTyped(char typedChar, int keyCode) throws IOException { - if (keyCode == Keyboard.KEY_ESCAPE) { - Sounds.playButtonSound(); - ClickGUI.close = true; - } - } - } } diff --git a/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java b/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java index cbcf8a4..05fccf0 100644 --- a/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java +++ b/src/main/java/net/silentclient/client/utils/types/PlayerResponse.java @@ -121,12 +121,13 @@ public class PlayerResponse extends AbstractReply { if(Minecraft.getMinecraft().thePlayer != null) { Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); } - (new Thread() { - public void run() { - Requests.post("https://api.silentclient.net/plus/set_bandana_color", new JSONObject().put("color", color).toString()); - Client.getInstance().updateUserInformation(); - } - }).start(); + } + + public void saveBandanaColor() { + (new Thread(() -> { + Requests.post("https://api.silentclient.net/plus/set_bandana_color", new JSONObject().put("color", bandana_color).toString()); + Client.getInstance().updateUserInformation(); + })).start(); } public int getSelectedHat() { diff --git a/src/main/resources/assets/minecraft/silentclient/icons/dice.png b/src/main/resources/assets/minecraft/silentclient/icons/dice.png new file mode 100644 index 0000000..f2e18c9 Binary files /dev/null and b/src/main/resources/assets/minecraft/silentclient/icons/dice.png differ