Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
Cvr committed Oct 3, 2024
1 parent 8c8f27f commit aa4536a
Show file tree
Hide file tree
Showing 19 changed files with 72 additions and 105 deletions.
10 changes: 4 additions & 6 deletions src/main/java/cc/unknown/mixin/mixins/gui/MixinGuiMainMenu.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@

@Mixin(GuiMainMenu.class)
public abstract class MixinGuiMainMenu extends GuiScreen {
@Shadow
public abstract void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_);
@Shadow
private DynamicTexture viewportTexture;
@Shadow
Expand All @@ -42,6 +40,8 @@ public abstract class MixinGuiMainMenu extends GuiScreen {
private static final ResourceLocation minecraftTitleTextures = new ResourceLocation("textures/gui/title/minecraft.png");
@Shadow
private float updateCounter;
@Shadow
public abstract void renderSkybox(int p_73971_1_, int p_73971_2_, float p_73971_3_);

@Overwrite
public void initGui() {
Expand Down Expand Up @@ -73,8 +73,7 @@ private void addSingleplayerMultiplayerButtons(int p_73969_1_, int p_73969_2_) {
new GuiButton(1, this.width / 2 - 100, p_73969_1_, I18n.format("menu.singleplayer")));
this.buttonList.add(new GuiButton(2, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 1,
I18n.format("menu.multiplayer")));
this.buttonList.add(new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20,
I18n.format("menu.online")));
this.buttonList.add(new GuiButton(14, this.width / 2 + 2, p_73969_1_ + p_73969_2_ * 2, 98, 20, "Alt Manager"));
this.buttonList.add(new GuiButton(6, this.width / 2 - 100, p_73969_1_ + p_73969_2_ * 2, 98, 20,
I18n.format("fml.menu.mods")));
}
Expand Down Expand Up @@ -117,8 +116,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
int i = 274;
int j = this.width / 2 - i / 2;
int k = 30;
this.drawGradientRect(0, 0, this.width, this.height, -2130706433, 16777215);
this.drawGradientRect(0, 0, this.width, this.height, 0, -2147483648);

this.mc.getTextureManager().bindTexture(minecraftTitleTextures);
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
if ((double) this.updateCounter < 1.0E-4D) {
Expand Down
3 changes: 1 addition & 2 deletions src/main/java/cc/unknown/module/impl/visuals/ClickGui.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@ public class ClickGui extends Module {
private DescValue d = new DescValue("ClickGui Custom Colors");
public SliderValue clickGuiColor = new SliderValue("ClickGui Color [H/S/B]", 0, 0, 350, 10);
public SliderValue saturation = new SliderValue("Saturation [H/S/B]", 1.0, 0.0, 1.0, 0.1);
public SliderValue brightness = new SliderValue("Brightness [H/S/B]", 1.0, 0.0, 1.0, 0.1);
private final KeyBinding[] moveKeys = new KeyBinding[]{mc.gameSettings.keyBindForward, mc.gameSettings.keyBindBack, mc.gameSettings.keyBindRight, mc.gameSettings.keyBindLeft, mc.gameSettings.keyBindJump, mc.gameSettings.keyBindSprint, mc.gameSettings.keyBindSneak};

public ClickGui() {
this.registerSetting(a, clientTheme, c, backGroundMode, d, clickGuiColor, saturation, brightness);
this.registerSetting(a, clientTheme, c, backGroundMode, d, clickGuiColor, saturation);
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cc/unknown/module/impl/visuals/ESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ public ESP() {
@EventLink
public void onRender(RenderEvent e) {
if (PlayerUtil.inGame() && e.is3D()) {
int playerColorRGB = enablePlayerColor.isToggled() ? Color.getHSBColor((playerColorHSB.getInputToFloat() % 360) / 360.0f, 1.0f, 1.0f).getRGB() : Theme.instance.getMainColor().getRGB();
int chestColorRGB = enableChestColor.isToggled() ? Color.getHSBColor((chestColorHSB.getInputToFloat() % 360) / 360.0f, 1.0f, 1.0f).getRGB() : Theme.instance.getMainColor().getRGB();
int playerColorRGB = enablePlayerColor.isToggled() ? Color.getHSBColor((playerColorHSB.getInputToFloat() % 360) / 360.0f, 1.0f, 1.0f).getRGB() : Theme.getMainColor().getRGB();
int chestColorRGB = enableChestColor.isToggled() ? Color.getHSBColor((chestColorHSB.getInputToFloat() % 360) / 360.0f, 1.0f, 1.0f).getRGB() : Theme.getMainColor().getRGB();

if (renderMode.is("Player") || renderMode.is("Both")) {
for (EntityPlayer player : mc.theWorld.playerEntities) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cc/unknown/module/impl/visuals/HUD.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public void onDraw(RenderEvent e) {
new Color(173, 216, 230), y.get()).getRGB());
break;
case "Theme":
color.set(Theme.instance.getMainColor().getRGB());
color.set(Theme.getMainColor().getRGB());
break;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private void drawKeyIndicator(String keyLabel, int alpha, float x1, float y1) {
RenderUtil.drawRect(x1, y1, x2, y2, new Color(0, 0, 0, 150).getRGB());
RenderUtil.drawRect(x1, y1, x2, y2, new Color(alpha, alpha, alpha, 150).getRGB());

mc.fontRendererObj.drawStringWithShadow(keyLabel, x1 + 8.0F, y1 + 5.0F, Theme.instance.getMainColor().getRGB());
mc.fontRendererObj.drawStringWithShadow(keyLabel, x1 + 8.0F, y1 + 5.0F, Theme.getMainColor().getRGB());
}

private float approach(float current, float target, float maxChange) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/cc/unknown/ui/AltLoginScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import cc.unknown.ui.auth.Browser;
import cc.unknown.ui.auth.MicrosoftAccount;
import cc.unknown.ui.auth.MicrosoftLogin;
import cc.unknown.utils.client.BackgroundUtil;
import cc.unknown.utils.client.RenderUtil;
import lombok.Getter;
import lombok.Setter;
Expand Down Expand Up @@ -64,7 +65,6 @@ public void initGui() {

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
RenderUtil.drawRect(0.0D, 0.0D, this.width, this.height, (new Color(0)).getRGB());
super.drawScreen(mouseX, mouseY, partialTicks);

ScaledResolution sr = new ScaledResolution(mc);
Expand Down Expand Up @@ -100,7 +100,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {
double scale = 1;

RenderUtil.drawRect(startX, y, startX + buttonWidth * scale, y + buttonHeight,
new Color(0, 0, 0).getRGB());
new Color(0, 0, 0, 100).getRGB());
}

String buttonName = button.getName();
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cc/unknown/ui/clickgui/raven/ClickGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public void drawScreen(int mouseX, int mouseY, float partialTicks) {

if (cg.backGroundMode.is("Gradient")) {
this.drawGradientRect(0, 0, sr.getScaledWidth(), sr.getScaledHeight(),
Theme.instance.getMainColor().getRGB(), Theme.instance.getMainColor().getAlpha());
Theme.getMainColor().getRGB(), Theme.getMainColor().getAlpha());
} else if (cg.backGroundMode.is("Normal")) {
this.drawGradientRect(0, 0, this.width, this.height, -1072689136, -804253680);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,6 @@ private boolean i(int x, int y) {
}

private void dr(String s) {
mc.fontRendererObj.drawStringWithShadow(s, (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o.get() + 3) * 2), Theme.instance.getMainColor().getRGB());
mc.fontRendererObj.drawStringWithShadow(s, (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o.get() + 3) * 2), Theme.getMainColor().getRGB());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void renderComponent() {
: "[-] " + this.cl1ckbUtt0n.getName(),
(float) ((this.module.category.getX() + 4) * 2),
(float) ((this.module.category.getY() + this.o + 5) * 2),
this.cl1ckbUtt0n.isToggled() ? Theme.instance.getMainColor().getRGB() : -1);
this.cl1ckbUtt0n.isToggled() ? Theme.getMainColor().getRGB() : -1);
GL11.glPopMatrix();
}

Expand Down
84 changes: 7 additions & 77 deletions src/main/java/cc/unknown/ui/clickgui/raven/impl/CategoryComp.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,12 @@
import cc.unknown.ui.clickgui.raven.impl.api.Component;
import cc.unknown.ui.clickgui.raven.impl.api.Theme;
import cc.unknown.utils.client.RenderUtil;
import cc.unknown.utils.font.FontUtil;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.client.gui.FontRenderer;

@Getter
@Setter
public class CategoryComp {
private ArrayList<ModuleComp> modulesInCategory = new ArrayList<>();
private Category category;
Expand Down Expand Up @@ -80,16 +83,16 @@ public void render(FontRenderer r) {
categoryHeight += module.getHeight();
}

RenderUtil.drawBorderedRoundedRect(this.x - 1, this.y, this.x + this.width + 1, this.y + this.bh + categoryHeight + 4f, 20f, 2f, Theme.instance.getMainColor().getRGB(), Theme.instance.getBackColor().getRGB());
RenderUtil.drawBorderedRoundedRect(this.x - 1, this.y, this.x + this.width + 1, this.y + this.bh + categoryHeight + 4f, 20f, 2f, Theme.getMainColor().getRGB(), Theme.getBackColor().getRGB());
} else if (!this.open) {
RenderUtil.drawBorderedRoundedRect(this.x - 1, this.y, this.x + this.width + 1, this.y + this.bh + 4f, 20f, 2f, Theme.instance.getMainColor().getRGB(), Theme.instance.getBackColor().getRGB());
RenderUtil.drawBorderedRoundedRect(this.x - 1, this.y, this.x + this.width + 1, this.y + this.bh + 4f, 20f, 2f, Theme.getMainColor().getRGB(), Theme.getBackColor().getRGB());
}

String center = this.n4m ? this.pvp : this.category.getName();
int gf = (int) r.getStringWidth(this.n4m ? this.pvp : this.category.getName());
int x = this.x + (this.width - gf) / 2;
int y = this.y + 4;
FontUtil.light.drawStringWithShadow(center, (float) x, (float) y, Theme.instance.getMainColor().getRGB());
r.drawStringWithShadow(center, (float) x, (float) y, Theme.getMainColor().getRGB());

if (!this.n4m) {
if (this.open && !this.modulesInCategory.isEmpty()) {
Expand All @@ -107,18 +110,6 @@ public void refresh() {
}
}

public int getX() {
return this.x;
}

public int getY() {
return this.y;
}

public int getWidth() {
return this.width;
}

public void updatePosition(int x, int y) {
if (this.dragging) {
this.setX(x - this.dragX);
Expand All @@ -143,65 +134,4 @@ public boolean isInside(int x, int y) {
public String getName() {
return String.valueOf(modulesInCategory);
}

public Category getCategory() {
return category;
}

public void setDragX(int dragX) {
this.dragX = dragX;
}

public void setDragY(int dragY) {
this.dragY = dragY;
}

public ArrayList<ModuleComp> getModulesInCategory() {
return modulesInCategory;
}

public boolean isN4m() {
return n4m;
}

public String getPvp() {
return pvp;
}

public AtomicInteger gettY() {
return tY;
}

public boolean isPin() {
return pin;
}

public int getBh() {
return bh;
}

public double getMarginX() {
return marginX;
}

public double getMarginY() {
return marginY;
}

public boolean isDragging() {
return dragging;
}

public void setDragging(boolean dragging) {
this.dragging = dragging;
}

public boolean isOpen() {
return open;
}

public void setOpen(boolean open) {
this.open = open;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public DescComp(DescValue desc, ModuleComp b, int o) {
public void renderComponent() {
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
mc.fontRendererObj.drawStringWithShadow(this.desc.getDesc(), (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o + 4) * 2), Theme.instance.getMainColor().getRGB());
mc.fontRendererObj.drawStringWithShadow(this.desc.getDesc(), (float)((this.p.category.getX() + 4) * 2), (float)((this.p.category.getY() + this.o + 4) * 2), Theme.getMainColor().getRGB());
GL11.glPopMatrix();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public void renderComponent() {
+ (int) this.blankWidth + boxMargin - 1;

Gui.drawRect(startToDrawFrom, this.module.category.getY() + this.moduleStartY + textSize, finishDrawingAt,
this.module.category.getY() + this.moduleStartY + textSize + boxHeight, Theme.instance.getMainColor().getRGB());
this.module.category.getY() + this.moduleStartY + textSize + boxHeight, Theme.getMainColor().getRGB());
Gui.drawRect(middleThing, this.module.category.getY() + this.moduleStartY + textSize - 1,
middleThing + (middleThing % 2 == 0 ? 2 : 1),
this.module.category.getY() + this.moduleStartY + textSize + boxHeight + 1, 0xff1D1D1F);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void renderComponent() {

GL11.glPushMatrix();

int buttonColor = mod.isEnabled() ? Theme.instance.getMainColor().getRGB() :
int buttonColor = mod.isEnabled() ? Theme.getMainColor().getRGB() :
mod.canBeEnabled() ? Color.lightGray.getRGB() :
new Color(102, 102, 102).getRGB();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public void renderComponent() {
}

Gui.drawRect(l, p.category.getY() + offset + 11, r, p.category.getY() + offset + 15,
Theme.instance.getMainColor().getRGB());
Theme.getMainColor().getRGB());
GL11.glPushMatrix();
GL11.glScaled(0.5D, 0.5D, 0.5D);
mc.fontRendererObj.drawStringWithShadow(v.getName() + ": " + v.getInput(),
Expand Down
28 changes: 21 additions & 7 deletions src/main/java/cc/unknown/ui/clickgui/raven/impl/api/Theme.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,44 @@
import java.awt.Color;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
import java.util.function.Supplier;

import cc.unknown.Haru;
import cc.unknown.module.impl.visuals.ClickGui;
import cc.unknown.utils.client.ColorUtil;
import lombok.experimental.UtilityClass;

public enum Theme {
instance;
private Supplier<Color> backColorSupplier = () -> new Color(0, 0, 0, 100);
@UtilityClass
public class Theme {
private final Supplier<Color> backColorSupplier = () -> new Color(0, 0, 0, 100);
private final Map<String, Supplier<Color>> colorMap = new HashMap<>();

{
static {
initializeColorMap();
}

private void initializeColorMap() {
colorMap.put("Lilith", () -> ColorUtil.reverseGradientDraw(new Color(76, 56, 108), new Color(255, 51, 51), new Color(76, 56, 108), 5));
colorMap.put("Rainbow", () -> Color.getHSBColor((float) (System.currentTimeMillis() % (15000L / 3)) / (15000.0F / 3), 1.0F, 1.0F));
colorMap.put("Rainbow", () -> Color.getHSBColor((float) (System.currentTimeMillis() % 15000) / 15000, 1.0F, 1.0F));
colorMap.put("Pastel", () -> ColorUtil.reverseGradientDraw(new Color(255, 190, 190), new Color(255, 190, 255), 2));
colorMap.put("Memories", () -> ColorUtil.reverseGradientDraw(new Color(255, 0, 255), new Color(255, 255, 0), new Color(255, 0, 158), 2));
colorMap.put("Cantina", () -> ColorUtil.gradientDraw(new Color(255, 0, 0), new Color(0, 0, 255), 7));
}

public Color getMainColor() {
ClickGui clickgui = (ClickGui) Haru.instance.getModuleManager().getModule(ClickGui.class);
return colorMap.getOrDefault(clickgui.clientTheme.getMode(), () -> Color.getHSBColor((clickgui.clickGuiColor.getInputToFloat() % 360) / 360.0f, clickgui.saturation.getInputToFloat(), clickgui.brightness.getInputToFloat())).get();
return Optional.ofNullable(colorMap.get(clickgui.clientTheme.getMode()))
.map(Supplier::get)
.orElseGet(() -> createHSBColor(clickgui));
}


private Color createHSBColor(ClickGui clickgui) {
float hue = (clickgui.clickGuiColor.getInputToFloat() % 360) / 360.0f;
float saturation = clickgui.saturation.getInputToFloat();
return Color.getHSBColor(hue, saturation, 1.0F);
}

public Color getBackColor() {
return backColorSupplier.get();
}
Expand Down
13 changes: 13 additions & 0 deletions src/main/java/cc/unknown/utils/client/BackgroundUtil.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package cc.unknown.utils.client;

import cc.unknown.utils.Loona;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.util.ResourceLocation;

public class BackgroundUtil implements Loona {
public static void renderBackground(GuiScreen gui) {
final int width = gui.width;
final int height = gui.height;
RenderUtil.drawImage(new ResourceLocation("haru/images/background.jpg"), 0, 0, width, height);
}
}
11 changes: 11 additions & 0 deletions src/main/java/cc/unknown/utils/player/PlayerUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import cc.unknown.utils.Loona;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -197,4 +198,14 @@ public static float getToolDigEfficiency(ItemStack stack, Block block) {
}
return f;
}

public static void sendClick(final int button, final boolean state) {
final int keyBind = button == 0 ? mc.gameSettings.keyBindAttack.getKeyCode() : mc.gameSettings.keyBindUseItem.getKeyCode();

KeyBinding.setKeyBindState(keyBind, state);

if (state) {
KeyBinding.onTick(keyBind);
}
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/main/resources/haru_at.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ public net.minecraft.client.multiplayer.PlayerControllerMP field_78770_f # curBl

public net.minecraft.client.Minecraft field_71428_T # timer

public net.minecraft.client.gui.GuiMainMenu func_73971_c # renderSkybox

public net.minecraft.network.NetworkManager field_150744_m # packetListener
public net.minecraft.network.NetworkManager func_150733_h()V # flushOutboundQueue
public net.minecraft.network.NetworkManager func_150732_b(Lnet/minecraft/network/Packet;[Lio/netty/util/concurrent/GenericFutureListener;)V # dispatchPacket
Expand Down

0 comments on commit aa4536a

Please sign in to comment.