(fix) don't set chroma color to color picker

This commit is contained in:
kirillsaint 2024-01-07 16:32:45 +06:00
parent ffce69f78b
commit 213d4c3db1
3 changed files with 10 additions and 7 deletions

View File

@ -62,9 +62,12 @@ public class GuiColorPicker extends SilentScreen {
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 + 70, 120, 70, true, 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();
}

View File

@ -2,20 +2,16 @@ package net.silentclient.client.gui.modmenu;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.MathHelper;
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.elements.HSBPicker;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.Setting;
import net.silentclient.client.mods.SettingsManager;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler;
@ -41,8 +37,8 @@ public class ColorPicker extends SilentScreen {
int colorX = 3;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
hsb = new HSBPicker((int)colorX, (int)colorY, 120, 70, true, value);
float[] vals = Color.RGBtoHSB(setting.getValColor().getRed(),setting.getValColor().getGreen(),setting.getValColor().getBlue(), null);
hsb.color = new float[] {vals[0],vals[1],vals[2],setting.getValColor().getAlpha() / 255.0f};
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();
}

View File

@ -216,7 +216,11 @@ public class Setting implements Comparable<Setting> {
}
public Color getValColor() {
if(chroma) {
return getValColor(false);
}
public Color getValColor(boolean ignoreChroma) {
if(chroma && !ignoreChroma) {
return new Color(ColorUtils.getChromaColor(0, 0, 1).getRed(), ColorUtils.getChromaColor(0, 0, 1).getGreen(), ColorUtils.getChromaColor(0, 0, 1).getBlue(), getOpacity());
}
return new Color(this.cval.getRed(), this.cval.getGreen(), this.cval.getBlue(), getOpacity());