Merge pull request #97 from Silent-Client/TEST2

2.1.0-beta.2
This commit is contained in:
kirillsaint 2024-01-26 17:27:51 +06:00 committed by GitHub
commit 220f92d9e7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
18 changed files with 187 additions and 459 deletions

View File

@ -3,7 +3,6 @@ package net.silentclient.client.gui.elements;
import net.minecraft.client.gui.Gui; import net.minecraft.client.gui.Gui;
import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils; import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.util.RenderUtil;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import java.awt.*; import java.awt.*;
@ -24,11 +23,10 @@ public class HSBPicker extends Gui {
public int cursorY; public int cursorY;
public boolean alphaSlider = true; public boolean alphaSlider = true;
public String text;
public SimpleAnimation sx = new SimpleAnimation(0f); public SimpleAnimation sx = new SimpleAnimation(0f);
public SimpleAnimation sy = 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.x = x;
this.y = y; this.y = y;
this.width = width; 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.color = new float[]{0.4f, 1.0f, 1.0f, 1.0f};
this.pickingColor = false; this.pickingColor = false;
this.alphaSlider = alphaSlider; this.alphaSlider = alphaSlider;
this.text = text;
} }
public void init() { public void init() {

View File

@ -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); 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)) { 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) { if(switchHovered || isHovered) {

View File

@ -16,9 +16,8 @@ import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils; import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.gui.theme.Theme; 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.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.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.Sounds; import net.silentclient.client.utils.Sounds;
@ -27,53 +26,47 @@ import org.lwjgl.opengl.GL11;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
public class GuiColorPicker extends SilentScreen { public class GuiColorPicker extends SilentScreen {
private final Mod mod;
private final GuiScreen parentScreen; private final GuiScreen parentScreen;
private ArrayList<Color> colors = new ArrayList<Color>();
private final String value;
private long initTime; private long initTime;
private HSBPicker hsb; 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) { public GuiColorPicker(Color defaultColor, boolean chroma, boolean allowChangeOpacity, int opacity, ColorPickerAction action, GuiScreen parentScreen) {
if (mod == null) throw new IllegalArgumentException("Mod is null");
this.mod = mod;
this.parentScreen = parentScreen; this.parentScreen = parentScreen;
this.value = value; this.defaultColor = defaultColor;
float colorY = 80; this.allowChangeOpacity = allowChangeOpacity;
int colorX = 3; this.chroma = chroma;
this.opacity = opacity;
this.action = action;
} }
@Override @Override
public void initGui() { public void initGui() {
defaultCursor = false; defaultCursor = false;
this.initTime = System.currentTimeMillis(); this.initTime = System.currentTimeMillis();
colors.clear();
MenuBlurUtils.loadBlur(); MenuBlurUtils.loadBlur();
int addX = 190; int addX = 190;
int addY = 110; int addY = 110;
int x = (width / 2) - addX; int x = (width / 2) - addX;
int y = (height / 2) - addY; int y = (height / 2) - addY;
int height = addY * 2; 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(1, x + 5, y + 25, 75, 20, "< Back"));
this.buttonList.add(new Button(2, x + 5, (y + height) - 26, 75, 20, "Edit HUD")); 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); hsb = new HSBPicker(x + 100, y + 40, 120, 70, false);
float[] vals = Color.RGBtoHSB(setting.getValColor(true).getRed(),setting.getValColor(true).getGreen(), setting.getValColor(true).getBlue(), null); float[] vals = Color.RGBtoHSB(defaultColor.getRed(), defaultColor.getGreen(), defaultColor.getBlue(), null);
hsb.color = new float[] {vals[0],vals[1],vals[2], setting.getValColor(true).getAlpha() / 255.0f}; hsb.color = new float[] {vals[0],vals[1],vals[2], defaultColor.getAlpha() / 255.0f};
hsb.init(); hsb.init();
} }
@Override @Override
public void onGuiClosed() { public void onGuiClosed() {
if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) { action.onClose(hsb.getSelectedColorFinal(), chroma, opacity);
mc.renderGlobal.loadRenderers();
}
MenuBlurUtils.unloadBlur(); MenuBlurUtils.unloadBlur();
super.onGuiClosed(); super.onGuiClosed();
} }
@ -92,24 +85,18 @@ public class GuiColorPicker extends SilentScreen {
int width = addX * 2; int width = addX * 2;
int height = addY * 2; int height = addY * 2;
GlStateManager.pushMatrix(); 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()); RenderUtil.drawRoundedRect(x, y, width, height, 10, Theme.backgroundColor().getRGB());
GL11.glPushMatrix(); GL11.glPushMatrix();
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F); GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
int settingY = y + 25; int settingY = y + 25;
action.onChange(hsb.getSelectedColorFinal(), chroma, opacity);
int colorIndex = 0;
int spacing = 100;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
setting.setValColor(hsb.getSelectedColorFinal());
int settingHeight = 10 + 5; 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)) { if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
cursorType = MouseCursorHandler.CursorType.POINTER; cursorType = MouseCursorHandler.CursorType.POINTER;
} }
@ -118,14 +105,14 @@ public class GuiColorPicker extends SilentScreen {
hsb.render(mouseX, mouseY); hsb.render(mouseX, mouseY);
if(setting.isCanChangeOpacity()) { if(allowChangeOpacity) {
GlStateManager.color(1, 1, 1, 1); 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) { if (Slider.isDrag(mouseX, mouseY, x, settingY - 1, width) && (System.currentTimeMillis() - initTime) > 500) {
double diff = 255; double diff = 255;
double mouse = MathHelper.clamp_double((double) (mouseX - Slider.getLeft(x, width)) / 90D, 0, 1); double mouse = MathHelper.clamp_double((double) (mouseX - Slider.getLeft(x, width)) / 90D, 0, 1);
double newVal = 0 + mouse * diff; double newVal = 0 + mouse * diff;
setting.setOpacity((int) newVal); opacity = (int) newVal;
} }
} }
@ -165,7 +152,6 @@ public class GuiColorPicker extends SilentScreen {
@Override @Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
// TODO Auto-generated method stub
super.mouseClicked(mouseX, mouseY, mouseButton); super.mouseClicked(mouseX, mouseY, mouseButton);
int addX = 190; int addX = 190;
@ -174,16 +160,12 @@ public class GuiColorPicker extends SilentScreen {
int x = (width / 2) - addX; int x = (width / 2) - addX;
int y = (height / 2) - addY; int y = (height / 2) - addY;
int settingY = y + 25; int settingY = y + 25;
int colorIndex = 0;
int spacing = 100;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
hsb.mouseClicked(mouseX, mouseY, mouseButton); hsb.mouseClicked(mouseX, mouseY, mouseButton);
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
Sounds.playButtonSound(); Sounds.playButtonSound();
setting.setChroma(!setting.isChroma()); chroma = !chroma;
} }
} }

View File

@ -10,6 +10,7 @@ import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation; import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.animation.normal.Direction; 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.GlUtils;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils; import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils.Scroll; 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.modmenu.CellGrid;
import net.silentclient.client.gui.theme.Theme; import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.theme.input.DefaultInputTheme; 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.gui.util.RenderUtil;
import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.ModCategory;
@ -32,6 +34,7 @@ import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -194,10 +197,12 @@ public class ModSettings extends SilentScreen {
} }
if (setting.isCheck()) { if (setting.isCheck()) {
Checkbox.render(mouseX, mouseY, x + 100, settingY - 1, setting.getName(), setting.getValBoolean()); Switch.render(mouseX, mouseY, x + 100, settingY - 1, setting.switchAnimation, setting.getValBoolean(), false);
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { if(Switch.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
cursorType = MouseCursorHandler.CursorType.POINTER; 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()) { if(setting.isCellGrid()) {
MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, x + 100, settingY, setting); 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)) { if(MouseUtils.isInside(mouseX, mouseY, x + width - (10 + 8) - 15, y + 5 + scrollAnimation.getValue(), 10, 10)) {
cursorType = MouseCursorHandler.CursorType.POINTER; 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())) { if(Switch.isHovered(mouseX, mouseY, x + width - (10 + 8), y + 6 + scrollAnimation.getValue())) {
cursorType = MouseCursorHandler.CursorType.POINTER; cursorType = MouseCursorHandler.CursorType.POINTER;
} }
@ -403,7 +408,7 @@ public class ModSettings extends SilentScreen {
} }
if (setting.isCheck()) { if (setting.isCheck()) {
if(Checkbox.isHovered(mouseX, mouseY, x + 100, settingY - 1)) { if(Switch.isHovered(mouseX, mouseY, x + 100, settingY - 1)) {
Sounds.playButtonSound(); Sounds.playButtonSound();
setting.setValBoolean(!setting.getValBoolean()); setting.setValBoolean(!setting.getValBoolean());
mod.onChangeSettingValue(setting); mod.onChangeSettingValue(setting);
@ -412,7 +417,16 @@ public class ModSettings extends SilentScreen {
if (setting.isColor() && ColorPicker.isHovered(mouseX, mouseY, x, settingY - 1, width)) { if (setting.isColor() && ColorPicker.isHovered(mouseX, mouseY, x, settingY - 1, width)) {
Sounds.playButtonSound(); 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; settingY += settingHeight;

View File

@ -9,39 +9,30 @@ import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.elements.Button; import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Checkbox; import net.silentclient.client.gui.elements.Checkbox;
import net.silentclient.client.gui.elements.HSBPicker; import net.silentclient.client.gui.elements.HSBPicker;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme; import net.silentclient.client.gui.util.ColorPickerAction;
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.utils.MenuBlurUtils; import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.MouseCursorHandler;
import java.awt.*; import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
public class ColorPicker extends SilentScreen { public class ColorPicker extends SilentScreen {
private long initTime;
private final Mod mod;
private final GuiScreen parentScreen; private final GuiScreen parentScreen;
private ArrayList<Color> colors = new ArrayList<Color>(); private long initTime;
private final String value;
private HSBPicker hsb; 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) { public ColorPicker(Color defaultColor, boolean chroma, boolean allowChangeOpacity, int opacity, ColorPickerAction action, GuiScreen parentScreen) {
if (mod == null) throw new IllegalArgumentException("Mod is null");
this.mod = mod;
this.parentScreen = parentScreen; this.parentScreen = parentScreen;
this.value = value; this.defaultColor = defaultColor;
float colorY = 80; this.allowChangeOpacity = allowChangeOpacity;
int colorX = 3; this.chroma = chroma;
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value); this.opacity = opacity;
hsb = new HSBPicker((int)colorX, (int)colorY, 120, 70, false, value); this.action = action;
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();
} }
@Override @Override
@ -51,22 +42,21 @@ public class ColorPicker extends SilentScreen {
this.initTime = System.currentTimeMillis(); this.initTime = System.currentTimeMillis();
this.buttonList.clear(); this.buttonList.clear();
this.silentInputs.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(); MenuBlurUtils.loadBlur();
ModMenu.initBaseButtons(this.buttonList); ModMenu.initBaseButtons(this.buttonList);
this.buttonList.add(new Button(1, 3, 26, 144, 15, "Back")); 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 @Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) { public void drawScreen(int mouseX, int mouseY, float partialTicks) {
MenuBlurUtils.renderBackground(this); MenuBlurUtils.renderBackground(this);
MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList); MouseCursorHandler.CursorType cursorType = getCursor(silentInputs, buttonList);
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
ModMenu.drawOverlayListBase(height, "Choose a color"); ModMenu.drawOverlayListBase(height, "Choose a color");
@ -75,25 +65,25 @@ public class ColorPicker extends SilentScreen {
ModMenu.trimContentStart(width, height); ModMenu.trimContentStart(width, height);
float colorY = 66; 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)) { if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
cursorType = MouseCursorHandler.CursorType.POINTER; cursorType = MouseCursorHandler.CursorType.POINTER;
} }
hsb.render(mouseX, mouseY); hsb.render(mouseX, mouseY);
action.onChange(hsb.getSelectedColorFinal(), chroma, opacity);
colorY += 100; colorY += 100;
Client.getInstance().getSettingsManager().getSettingByName(mod, this.value).setValColor(hsb.getSelectedColorFinal()); if(allowChangeOpacity) {
if(setting.isCanChangeOpacity()) {
GlStateManager.color(1, 1, 1, 1); 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) { if (RegularSlider.isDrag(mouseX, mouseY, 3, colorY, 144) && (System.currentTimeMillis() - initTime) > 500) {
double diff = 255; double diff = 255;
double mouse = MathHelper.clamp_double((mouseX - 3) / 144D, 0, 1); double mouse = MathHelper.clamp_double((mouseX - 3) / 144D, 0, 1);
double newVal = 0 + mouse * diff; double newVal = 0 + mouse * diff;
setting.setOpacity((int) newVal); opacity = (int) newVal;
} }
} }
@ -107,30 +97,17 @@ public class ColorPicker extends SilentScreen {
super.actionPerformed(button); super.actionPerformed(button);
ModMenu.clickBaseButtons(button, this); ModMenu.clickBaseButtons(button, this);
switch (button.id) { if (button.id == 1) {
case 1: mc.displayGuiScreen(parentScreen);
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;
} }
} }
@Override @Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton); super.mouseClicked(mouseX, mouseY, mouseButton);
Setting setting = Client.getInstance().getSettingsManager().getSettingByName(mod, this.value);
float colorY = 66; float colorY = 66;
if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) { if(Checkbox.isHovered(mouseX, mouseY, 3, colorY)) {
setting.setChroma(!setting.isChroma()); chroma = !chroma;
} }
hsb.mouseClicked(mouseX, mouseY, mouseButton); hsb.mouseClicked(mouseX, mouseY, mouseButton);
@ -145,9 +122,7 @@ public class ColorPicker extends SilentScreen {
@Override @Override
public void onGuiClosed() { public void onGuiClosed() {
super.onGuiClosed(); super.onGuiClosed();
if(mod.getName() == "Pack Tweaks" && mod.isEnabled()) { action.onClose(hsb.getSelectedColorFinal(), chroma, opacity);
mc.renderGlobal.loadRenderers();
}
MenuBlurUtils.unloadBlur(); MenuBlurUtils.unloadBlur();
Client.getInstance().configManager.save(); Client.getInstance().configManager.save();
} }

View File

@ -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.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.theme.switches.DefaultSwitchTheme; 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.gui.util.RenderUtil;
import net.silentclient.client.mods.Mod; import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.ModCategory;
@ -171,7 +172,7 @@ public class ModMenu extends SilentScreen {
} }
if(modCategory == ModCategory.MODS) { 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)) { if(Switch.isHovered(mouseX, mouseY, 129, modY + 10 - 4)) {
cursorType = MouseCursorHandler.CursorType.POINTER; cursorType = MouseCursorHandler.CursorType.POINTER;
} }
@ -449,7 +450,24 @@ public class ModMenu extends SilentScreen {
premiumY += 15; premiumY += 15;
if(RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) premiumY, 144)) { if(RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) premiumY, 144)) {
// Color Picker // 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; return;
} }
premiumY += 15; premiumY += 15;

View File

@ -7,15 +7,14 @@ import net.minecraft.util.MathHelper;
import net.silentclient.client.Client; import net.silentclient.client.Client;
import net.silentclient.client.gui.SilentScreen; import net.silentclient.client.gui.SilentScreen;
import net.silentclient.client.gui.animation.SimpleAnimation; 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.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.font.SilentFontRenderer;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme; import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.RedButtonTheme; import net.silentclient.client.gui.theme.button.RedButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme; import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.theme.input.DefaultInputTheme; 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.Mod;
import net.silentclient.client.mods.ModCategory; import net.silentclient.client.mods.ModCategory;
import net.silentclient.client.mods.Setting; import net.silentclient.client.mods.Setting;
@ -26,6 +25,7 @@ import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.Sounds; import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Mouse; import org.lwjgl.input.Mouse;
import java.awt.*;
import java.io.IOException; import java.io.IOException;
import java.net.URI; import java.net.URI;
@ -130,10 +130,12 @@ public class ModSettings extends SilentScreen {
} }
} }
if (setting.isCheck()) { if (setting.isCheck()) {
Checkbox.render(mouseX, mouseY, 3, settingY, setting.getName(), setting.getValBoolean()); Switch.render(mouseX, mouseY, 3, settingY, setting.switchAnimation, setting.getValBoolean(), false);
if(Checkbox.isHovered(mouseX, mouseY, 3, settingY)) { if(Switch.isHovered(mouseX, mouseY, 3, settingY)) {
cursorType = MouseCursorHandler.CursorType.POINTER; 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()) { if(setting.isCellGrid()) {
MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, 3, settingY, setting); MouseCursorHandler.CursorType cellGridCursor = CellGrid.render(mouseX, mouseY, 3, settingY, setting);
@ -260,10 +262,19 @@ public class ModSettings extends SilentScreen {
inputIndex++; inputIndex++;
} }
if (setting.isColor() && RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) settingY, 144)) { 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 (setting.isCheck()) {
if(Checkbox.isHovered(mouseX, mouseY, 3, settingY)) { if(Switch.isHovered(mouseX, mouseY, 3, settingY)) {
Sounds.playButtonSound(); Sounds.playButtonSound();
setting.setValBoolean(!setting.getValBoolean()); setting.setValBoolean(!setting.getValBoolean());
mod.onChangeSettingValue(setting); mod.onChangeSettingValue(setting);

View File

@ -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<Color> colors = new ArrayList<Color>();
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();
}
}

View File

@ -231,7 +231,7 @@ public class SilentMultiplayerGui extends SilentScreen {
break; break;
case 2: case 2:
if(this.selectedServer != -1) { if(this.selectedServer != -1) {
this.savedServerList.removeServerData(this.selectedServer); this.savedServerList.removeServerData(this.selectedServer - Client.getInstance().getFeaturedServers().size());
this.savedServerList.saveServerList(); this.savedServerList.saveServerList();
this.selectServer(-1); this.selectServer(-1);
this.refreshServerList(); this.refreshServerList();

View File

@ -28,6 +28,7 @@ import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Random;
public class SilentResourcePacksGui extends SilentScreen { public class SilentResourcePacksGui extends SilentScreen {
private final GuiScreen parentScreen; private final GuiScreen parentScreen;
@ -40,6 +41,7 @@ public class SilentResourcePacksGui extends SilentScreen {
private int blockHeight = 0; private int blockHeight = 0;
private ScrollHelper scrollHelper = new ScrollHelper(); private ScrollHelper scrollHelper = new ScrollHelper();
private ScrollHelper scrollHelper2 = new ScrollHelper(); private ScrollHelper scrollHelper2 = new ScrollHelper();
private Random random = new Random();
public SilentResourcePacksGui(GuiScreen parentScreenIn) public SilentResourcePacksGui(GuiScreen parentScreenIn)
{ {
@ -61,6 +63,7 @@ public class SilentResourcePacksGui extends SilentScreen {
if(mc.thePlayer != null) { 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(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(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(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")); 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(); this.apply();
mc.displayGuiScreen(parentScreen); mc.displayGuiScreen(parentScreen);
break; 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 @Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException { protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton); super.mouseClicked(mouseX, mouseY, mouseButton);

View File

@ -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) {
}
}

View File

@ -9,8 +9,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.event.impl.RenderTickEvent; import net.silentclient.client.event.impl.RenderTickEvent;
import net.silentclient.client.mods.render.BlockOverlayMod; 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.Final;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite; import org.spongepowered.asm.mixin.Overwrite;
@ -45,4 +47,11 @@ public abstract class RenderGlobalMixin {
{ {
BlockOverlayMod.drawSelectionBox(player, movingObjectPositionIn, p_72731_3_, partialTicks); 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();
}
}
} }

View File

@ -31,7 +31,7 @@ public class Mod implements IMod {
private boolean updated = false; private boolean updated = false;
private boolean newMod = 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) { public Mod(String name, ModCategory category, String icon, boolean defaultEnabled, boolean updated, boolean newMod) {
this.mc = Minecraft.getMinecraft(); this.mc = Minecraft.getMinecraft();

View File

@ -2,6 +2,7 @@ package net.silentclient.client.mods;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.silentclient.client.Client; import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.utils.ColorUtils; import net.silentclient.client.utils.ColorUtils;
import org.lwjgl.input.Keyboard; import org.lwjgl.input.Keyboard;
@ -49,6 +50,7 @@ public class Setting implements Comparable<Setting> {
private boolean canChangeOpacity = false; private boolean canChangeOpacity = false;
private boolean onlyPremiumPlus = false; private boolean onlyPremiumPlus = false;
public SimpleAnimation switchAnimation = new SimpleAnimation(0);
public Setting(String name, Mod parent, String sval, ArrayList<String> options) { public Setting(String name, Mod parent, String sval, ArrayList<String> options) {
this.name = name; this.name = name;

View File

@ -76,6 +76,7 @@ public class FPSBoostMod extends Mod {
this.addBooleanSetting("Hide Lava Particles", this, false); // ready this.addBooleanSetting("Hide Lava Particles", this, false); // ready
this.addBooleanSetting("Hide Mob in Spawner", this, false); // ready this.addBooleanSetting("Hide Mob in Spawner", this, false); // ready
this.addBooleanSetting("Hide Spawner Particles", 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("Player Render Distance", this, 64, 1, 64, true); // ready
this.addSliderSetting("Passive Entity 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 this.addSliderSetting("Hostile Entity Render Distance", this, 64, 1, 64, true); // ready

View File

@ -1,35 +1,23 @@
package net.silentclient.client.premium; package net.silentclient.client.premium;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client; 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.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.font.SilentFontRenderer;
import net.silentclient.client.gui.hud.HUDConfigScreen; import net.silentclient.client.gui.lite.clickgui.GuiColorPicker;
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.gui.util.RenderUtil;
import net.silentclient.client.utils.ColorUtils; import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.MouseCursorHandler; import net.silentclient.client.utils.MouseCursorHandler;
import net.silentclient.client.utils.Sounds; import net.silentclient.client.utils.Sounds;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import java.awt.*; import java.awt.*;
import java.io.IOException;
import java.net.URI; import java.net.URI;
import java.util.ArrayList;
public class PremiumGui { public class PremiumGui {
public static MouseCursorHandler.CursorType drawScreen(int x, int y, int width, int height, int mouseX, int mouseY, float partialTicks, Input input) { 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; int settingY = y + 25;
if(ColorPicker.isHovered(mouseX, mouseY, x, settingY, width)) { if(ColorPicker.isHovered(mouseX, mouseY, x, settingY, width)) {
Sounds.playButtonSound(); 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; settingY += 15;
if(StaticButton.isHovered(mouseX, mouseY, x + 310, settingY, 65, 12)) { 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<Color> colors = new ArrayList<Color>();
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;
}
}
}
} }

View File

@ -121,12 +121,13 @@ public class PlayerResponse extends AbstractReply {
if(Minecraft.getMinecraft().thePlayer != null) { if(Minecraft.getMinecraft().thePlayer != null) {
Players.getPlayerStatus(false, ((AbstractClientPlayerExt) Minecraft.getMinecraft().thePlayer).silent$getNameClear(), EntityPlayer.getUUID(Minecraft.getMinecraft().thePlayer.getGameProfile()), Minecraft.getMinecraft().thePlayer); 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()); public void saveBandanaColor() {
Client.getInstance().updateUserInformation(); (new Thread(() -> {
} Requests.post("https://api.silentclient.net/plus/set_bandana_color", new JSONObject().put("color", bandana_color).toString());
}).start(); Client.getInstance().updateUserInformation();
})).start();
} }
public int getSelectedHat() { public int getSelectedHat() {

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB