diff --git a/src/main/java/net/silentclient/client/Client.java b/src/main/java/net/silentclient/client/Client.java index a239f0d..9cf5cd2 100644 --- a/src/main/java/net/silentclient/client/Client.java +++ b/src/main/java/net/silentclient/client/Client.java @@ -60,7 +60,7 @@ import java.util.List; public class Client { public static final Logger logger = LogManager.getLogger("SC"); - private final String version = "2.0.1"; + private final String version = "2.1.0"; private static final Client INSTANCE = new Client(); public static final Client getInstance() { 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 ef8a37c..c685fda 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 @@ -3,6 +3,7 @@ package net.silentclient.client.gui.lite.clickgui; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.MathHelper; import net.minecraft.util.ResourceLocation; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; @@ -10,6 +11,7 @@ import net.silentclient.client.gui.animation.normal.Direction; 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.elements.Slider; import net.silentclient.client.gui.font.SilentFontRenderer; import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; @@ -61,7 +63,7 @@ public class GuiColorPicker extends SilentScreen { 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 + 70, 120, 70, true, value); + 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.init(); @@ -103,20 +105,30 @@ public class GuiColorPicker extends SilentScreen { Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); - hsb.render(mouseX, mouseY); - setting.setValColor(hsb.getSelectedColorFinal()); - setting.setOpacity(hsb.getSelectedColorFinal().getAlpha()); int settingHeight = 10 + 5; - settingY += settingHeight; - Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, "Chroma", setting.isChroma()); if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { cursorType = MouseCursorHandler.CursorType.POINTER; } + settingY += settingHeight + 90; + + hsb.render(mouseX, mouseY); + + if(setting.isCanChangeOpacity()) { + GlStateManager.color(1, 1, 1, 1); + Slider.render(x, settingY - 1, width, "Opacity", 255, setting.getOpacity()); + 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); + } + } + GL11.glPopMatrix(); RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), x + 5, y + 5, 77, 15); @@ -169,10 +181,6 @@ public class GuiColorPicker extends SilentScreen { hsb.mouseClicked(mouseX, mouseY, mouseButton); - int settingHeight = 10 + 5; - - settingY += settingHeight + settingHeight + (setting.isCanChangeOpacity() ? settingHeight : 0); - if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { Sounds.playButtonSound(); setting.setChroma(!setting.isChroma()); 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 af571c9..57ed80c 100644 --- a/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java +++ b/src/main/java/net/silentclient/client/gui/modmenu/ColorPicker.java @@ -2,6 +2,8 @@ package net.silentclient.client.gui.modmenu; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.util.MathHelper; import net.silentclient.client.Client; import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.elements.Button; @@ -36,7 +38,7 @@ public class ColorPicker extends SilentScreen { float colorY = 80; int colorX = 3; Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); - hsb = new HSBPicker((int)colorX, (int)colorY, 120, 70, true, 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(); @@ -68,20 +70,32 @@ public class ColorPicker extends SilentScreen { ModMenu.drawOverlayListBase(height, "Choose a color"); + super.drawScreen(mouseX, mouseY, partialTicks); + ModMenu.trimContentStart(width, height); float colorY = 66; - hsb.render(mouseX, mouseY); - setting.setOpacity(hsb.getSelectedColorFinal().getAlpha()); - - Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(hsb.getSelectedColorFinal()); - Checkbox.render(mouseX, mouseY, 3, colorY, "Chroma", setting.isChroma()); if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { cursorType = MouseCursorHandler.CursorType.POINTER; } - super.drawScreen(mouseX, mouseY, partialTicks); + hsb.render(mouseX, mouseY); + + colorY += 100; + + Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(hsb.getSelectedColorFinal()); + + if(setting.isCanChangeOpacity()) { + GlStateManager.color(1, 1, 1, 1); + RegularSlider.render(3, colorY, 144, "Opacity", 255, setting.getOpacity()); + 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); + } + } Client.getInstance().getMouseCursorHandler().enableCursor(cursorType); @@ -115,21 +129,11 @@ public class ColorPicker extends SilentScreen { super.mouseClicked(mouseX, mouseY, mouseButton); Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); float colorY = 66; - - hsb.mouseClicked(mouseX, mouseY, mouseButton); - - int settingHeight = 15; - colorY += settingHeight; - if(setting.isCanChangeOpacity()) { - colorY += settingHeight * 2; - } - - colorY += settingHeight; - if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { setting.setChroma(!setting.isChroma()); - mc.displayGuiScreen(parentScreen); } + + hsb.mouseClicked(mouseX, mouseY, mouseButton); } @Override @@ -145,5 +149,6 @@ public class ColorPicker extends SilentScreen { mc.renderGlobal.loadRenderers(); } MenuBlurUtils.unloadBlur(); + Client.getInstance().configManager.save(); } } diff --git a/src/main/java/net/silentclient/client/mods/hud/ComboCounterMod.java b/src/main/java/net/silentclient/client/mods/hud/ComboCounterMod.java index 8f5a040..63b4705 100644 --- a/src/main/java/net/silentclient/client/mods/hud/ComboCounterMod.java +++ b/src/main/java/net/silentclient/client/mods/hud/ComboCounterMod.java @@ -50,7 +50,7 @@ public class ComboCounterMod extends HudMod { if(combo == 0) { return "No " + getPostText(); } else { - return combo + getPostText(); + return combo + " " + getPostText(); } }