Premium Bandana Color Picker

This commit is contained in:
kirillsaint 2023-07-22 15:26:54 +06:00
parent d1bcfe3fd4
commit dcd58ab7b6
4 changed files with 142 additions and 10 deletions

View File

@ -10,11 +10,11 @@ import java.awt.*;
public class ColorPicker {
public static void render(int x, int y, int width, String name, int color) {
Client.getInstance().getSilentFontRenderer().drawString(name, x + 100, y - 2, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x + width - 20, y + 1, 15, 9, 5, color);
RenderUtil.drawRoundedRect(x + width - 20, y + 1, 15, 8, 5, color);
RenderUtil.drawRoundedOutline(x + width - 20, y + 1, 15, 8, 5, 2, new Color(255, 255, 255).getRGB());
}
public static boolean isHovered(int mouseX, int mouseY, int x, int y, int width) {
return MouseUtils.isInside(mouseX, mouseY, x + width - 20, y + 1, 15, 9);
return MouseUtils.isInside(mouseX, mouseY, x + width - 20, y + 1, 15, 8);
}
}

View File

@ -108,6 +108,7 @@ public class ModMenu extends SilentScreen {
}
public static void drawOverlayListBase(float height, String header) {
ModMenu.introAnimation.setValue(0);
GlStateManager.translate(ModMenu.introAnimation.getValue(), 0, 0);
RenderUtils.drawRect(0, 0, 150, height, Theme.backgroundColor().getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), 3, 3, 97.7F, 19);
@ -118,12 +119,6 @@ public class ModMenu extends SilentScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
if(ModMenu.introAnimation.getValue() == 0) {
ModMenu.loaded = true;
}
if(!loaded) {
ModMenu.introAnimation.setAnimation(0, 30);
}
MenuBlurUtils.renderBackground(this);
ModMenu.drawOverlayListBase(height, modCategory == ModCategory.PLUS ? "Premium" : null);
@ -416,6 +411,7 @@ public class ModMenu extends SilentScreen {
premiumY += 15;
if(RegularColorPicker.isHovered(mouseX, mouseY, 3, (int) premiumY, 144)) {
// Color Picker
mc.displayGuiScreen(new PremiumColorPicker(this));
return;
}
premiumY += 15;

View File

@ -0,0 +1,136 @@
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 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();
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);
ModMenu.drawOverlayListBase(height, "Choose a color");
super.drawScreen(mouseX, mouseY, partialTicks);
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());
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);
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

@ -10,11 +10,11 @@ import java.awt.*;
public class RegularColorPicker {
public static void render(float x, float y, int width, String name, int color) {
Client.getInstance().getSilentFontRenderer().drawString(name, x, y - 1, 12, SilentFontRenderer.FontType.TITLE);
RenderUtil.drawRoundedRect(x + width - 15, y + 2, 15, 9, 5, color);
RenderUtil.drawRoundedRect(x + width - 15, y + 2, 15, 8, 5, color);
RenderUtil.drawRoundedOutline(x + width - 15, y + 2, 15, 8, 5, 2, new Color(255, 255, 255).getRGB());
}
public static boolean isHovered(int mouseX, int mouseY, int x, int y, int width) {
return MouseUtils.isInside(mouseX, mouseY, x + width - 15, y + 2, 15, 9);
return MouseUtils.isInside(mouseX, mouseY, x + width - 15, y + 2, 15, 8);
}
}