Skip to content

Commit

Permalink
Fixed Modules. Added new Modules. Small fixes.
Browse files Browse the repository at this point in the history
Added Zoom, Surround modules.
Fixed FastBreak, Tracer.
Fixed Sliders not working as intended.
Experimental 'global chat' tab. Does not work but plan to fix in the future.
Made RenderUtils static again.
  • Loading branch information
coltonk9043 committed Jan 19, 2024
1 parent 8677023 commit bc57148
Show file tree
Hide file tree
Showing 36 changed files with 628 additions and 171 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/aoba/AobaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public void endClient() {
SettingManager.saveSettings("modules_category", settingManager.modules_category);
SettingManager.saveSettings("hidden_category", settingManager.hidden_category);
altManager.saveAlts();

moduleManager.modules.forEach(s -> s.onDisable());
}catch(Exception e) {
e.printStackTrace();
}
Expand Down
24 changes: 1 addition & 23 deletions src/main/java/net/aoba/altmanager/AltManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,7 @@ public ArrayList<Alt> getAlts() {
*/
public boolean login(Alt alt) {
// Log in to the correct service depending on the Alt type.
if (alt.isMicrosoft()) {
return loginMicrosoft(alt);
} else {
return loginMinecraft(alt);
}
return loginMicrosoft(alt);
}

/**
Expand Down Expand Up @@ -352,24 +348,6 @@ private String microsoftLogin(Alt alt, String cookie, String ppft, String urlPos
}
}

private boolean loginMinecraft(Alt alt) {
return false;
// TODO: Seems like MC removed old accounts. If i can find a way around this, I will.
/*
* YggdrasilUserAuthentication auth = (YggdrasilUserAuthentication) new
* YggdrasilAuthenticationService(Proxy.NO_PROXY,
* "").createUserAuthentication(Agent.MINECRAFT);
* auth.setUsername(alt.getEmail()); auth.setPassword(alt.getPassword());
*
* try { auth.logIn(); IMinecraftClient iMC = (IMinecraftClient) this.mc;
* iMC.setSession( new Session(auth.getSelectedProfile().getName(),
* auth.getSelectedProfile().getId().toString(), auth.getAuthenticatedToken(),
* Optional.empty(), Optional.empty(), AccountType.MOJANG));
* alt.setUsername(mc.getSession().getUsername()); return true; } catch
* (Exception e) { e.printStackTrace(); return false; }
*/
}

public boolean loginCracked(String alt) {
try {
IMinecraftClient iMC = (IMinecraftClient) this.mc;
Expand Down
34 changes: 29 additions & 5 deletions src/main/java/net/aoba/cmd/GlobalChat.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,34 @@
import java.io.PrintWriter;
import java.net.Socket;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import net.aoba.Aoba;
import net.aoba.settings.SettingManager;
import net.aoba.settings.types.BooleanSetting;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.hud.ChatHudLine;
import net.minecraft.client.gui.hud.MessageIndicator;
import net.minecraft.client.util.ChatMessages;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

public class GlobalChat {

public enum ChatType{
Minecraft,
Global
}

public static ChatType chatType = ChatType.Minecraft;

public final List<ChatHudLine.Visible> messages = Lists.newArrayList();

private Gson gson;
private Socket socket;
Expand All @@ -35,19 +50,28 @@ public GlobalChat() {
}

private void Send(String json) {
out.print(json);
out.flush();
if(out != null) {
out.print(json);
out.flush();
}
}

public void SendMessage(String message) {
Send(gson.toJson(new MessageAction(message, null)));
}

private void SendChatMessage(String message) {
MinecraftClient mc = MinecraftClient.getInstance();
if(mc.inGameHud != null) {
mc.inGameHud.getChatHud().addMessage(Text.of(Formatting.DARK_PURPLE + "[" + Formatting.LIGHT_PURPLE + "GLOBAL" + Formatting.DARK_PURPLE + "] " + Formatting.RESET + message));
List<OrderedText> list = ChatMessages.breakRenderedChatMessageLines(Text.of(message), 1, MinecraftClient.getInstance().textRenderer);
for(int i = 0; i < list.size(); ++i) {
OrderedText orderedText = list.get(i);
this.messages.add(0, new ChatHudLine.Visible(MinecraftClient.getInstance().inGameHud.getTicks(), orderedText, MessageIndicator.system(), false));
}


//MinecraftClient mc = MinecraftClient.getInstance();
//if(mc.inGameHud != null) {
// mc.inGameHud.getChatHud().addMessage(Text.of(Formatting.DARK_PURPLE + "[" + Formatting.LIGHT_PURPLE + "GLOBAL" + Formatting.DARK_PURPLE + "] " + Formatting.RESET + message));
//}
}


Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/aoba/cmd/commands/CmdHelp.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ private void ShowCommands(int page) {

@Override
public String[] getAutocorrect(String previousParameter) {
// TODO Auto-generated method stub
CommandManager cm = Aoba.getInstance().commandManager;
int numCmds = cm.getNumOfCommands();
String[] commands = new String[numCmds];
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/aoba/gui/GuiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void Initialize() {

hudPane.AddHud(new HudsTab(new AbstractHud[] { moduleSelector, armorHud,radarHud, infoHud }));

int xOffset = 335;
int xOffset = 50;
for (Category category : Module.Category.values()) {
ClickGuiTab tab = new ClickGuiTab(category.name(), xOffset, 75, true, category.name());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import net.aoba.event.listeners.LeftMouseDownListener;
import net.aoba.gui.Color;
import net.aoba.gui.IGuiElement;
import net.aoba.misc.RenderUtils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;

Expand Down Expand Up @@ -58,8 +59,8 @@ public void setOnClick(Runnable onClick) {
@Override
public void draw(DrawContext drawContext, float partialTicks, Color color) {
MatrixStack matrixStack = drawContext.getMatrices();
renderUtils.drawOutlinedBox(matrixStack, actualX + 2, actualY, actualWidth - 4, actualHeight - 2, backgroundColor);
renderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, 0xFFFFFF);
RenderUtils.drawOutlinedBox(matrixStack, actualX + 2, actualY, actualWidth - 4, actualHeight - 2, backgroundColor);
RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, 0xFFFFFF);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.aoba.gui.GuiManager;
import net.aoba.gui.IGuiElement;
import net.aoba.gui.tabs.ClickGuiTab;
import net.aoba.misc.RenderUtils;
import net.aoba.settings.types.BooleanSetting;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
Expand Down Expand Up @@ -40,12 +41,12 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) {
super.draw(drawContext, partialTicks, color);

MatrixStack matrixStack = drawContext.getMatrices();
renderUtils.drawString(drawContext, this.text, actualX + 10, actualY + 8, 0xFFFFFF);
RenderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 8, 0xFFFFFF);
if (this.checkbox.getValue()) {
renderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 24, actualY + 5, 20, 20,
RenderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 24, actualY + 5, 20, 20,
new Color(0, 154, 0, 200));
} else {
renderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 24, actualY + 5, 20, 20,
RenderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 24, actualY + 5, 20, 20,
new Color(154, 0, 0, 200));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.aoba.event.listeners.MouseMoveListener;
import net.aoba.gui.Color;
import net.aoba.gui.IGuiElement;
import net.aoba.misc.RenderUtils;
import net.aoba.settings.types.ColorSetting;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
Expand Down Expand Up @@ -131,36 +132,36 @@ public void update() {
public void draw(DrawContext drawContext, float partialTicks, Color color) {
MatrixStack matrixStack = drawContext.getMatrices();

renderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 6, 0xFFFFFF);
renderUtils.drawString(drawContext, collapsed ? "<<" : ">>", (actualX + actualWidth - 24), actualY + 6, color.getColorAsInt());
RenderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 6, 0xFFFFFF);
RenderUtils.drawString(drawContext, collapsed ? "<<" : ">>", (actualX + actualWidth - 24), actualY + 6, color.getColorAsInt());

if(!collapsed) {
Color newColor = new Color(255, 0, 0);
newColor.setHSV(this.hue, 1.0f, 1.0f);
renderUtils.drawHorizontalGradient(matrixStack, actualX + 4, actualY + 29, actualWidth - 76, actualHeight - 33, new Color(255, 255, 255), newColor);
renderUtils.drawVerticalGradient(matrixStack, actualX + 4, actualY+ 29, actualWidth - 76, actualHeight - 33, new Color(0, 0, 0, 0), new Color(0, 0, 0));
RenderUtils.drawHorizontalGradient(matrixStack, actualX + 4, actualY + 29, actualWidth - 76, actualHeight - 33, new Color(255, 255, 255), newColor);
RenderUtils.drawVerticalGradient(matrixStack, actualX + 4, actualY+ 29, actualWidth - 76, actualHeight - 33, new Color(0, 0, 0, 0), new Color(0, 0, 0));

// Draw Hue Rectangle
float increment = ((this.actualHeight - 33) / 6.0f);
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29, 30, increment, new Color(255, 0, 0), new Color(255, 255, 0));
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + increment, 30,increment, new Color(255, 255, 0), new Color(0, 255, 0));
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (2 * increment), 30, increment, new Color(0, 255, 0), new Color(0, 255, 255));
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (3 * increment), 30, increment, new Color(0, 255, 255), new Color(0, 0, 255));
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (4 * increment), 30, increment, new Color(0, 0, 255), new Color(255, 0, 255));
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (5 * increment), 30, increment, new Color(255, 0, 255), new Color(255, 0, 0));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29, 30, increment, new Color(255, 0, 0), new Color(255, 255, 0));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + increment, 30,increment, new Color(255, 255, 0), new Color(0, 255, 0));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (2 * increment), 30, increment, new Color(0, 255, 0), new Color(0, 255, 255));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (3 * increment), 30, increment, new Color(0, 255, 255), new Color(0, 0, 255));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (4 * increment), 30, increment, new Color(0, 0, 255), new Color(255, 0, 255));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 68, actualY + 29 + (5 * increment), 30, increment, new Color(255, 0, 255), new Color(255, 0, 0));

// Draw Alpha Rectangle
renderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 34 , actualY + 29, 30, actualHeight - 33, new Color(255, 255, 255), new Color(0, 0, 0));
RenderUtils.drawVerticalGradient(matrixStack, actualX + actualWidth - 34 , actualY + 29, 30, actualHeight - 33, new Color(255, 255, 255), new Color(0, 0, 0));

// Draw Outlines
renderUtils.drawOutline(matrixStack, actualX + 4, actualY + 29, actualWidth - 76, actualHeight - 33);
renderUtils.drawOutline(matrixStack, actualX + actualWidth - 68, actualY + 29, 30, actualHeight - 33);
renderUtils.drawOutline(matrixStack, actualX + actualWidth - 34, actualY + 29, 30, actualHeight - 33);
RenderUtils.drawOutline(matrixStack, actualX + 4, actualY + 29, actualWidth - 76, actualHeight - 33);
RenderUtils.drawOutline(matrixStack, actualX + actualWidth - 68, actualY + 29, 30, actualHeight - 33);
RenderUtils.drawOutline(matrixStack, actualX + actualWidth - 34, actualY + 29, 30, actualHeight - 33);

// Draw Indicators
renderUtils.drawCircle(matrixStack, actualX + 4 + (saturation * (actualWidth - 72)), actualY + 29 + ((1.0f - luminance) * (actualHeight - 33)), 3, new Color(255, 255, 255, 255));
renderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 68, actualY + 29 + ((hue / 360.0f) * (actualHeight - 33)), 30, 3, new Color(255, 255, 255, 255));
renderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 34, actualY + 29 + (((255.0f - alpha) / 255.0f) * (actualHeight - 33)), 30, 3, new Color(255, 255, 255, 255));
RenderUtils.drawCircle(matrixStack, actualX + 4 + (saturation * (actualWidth - 72)), actualY + 29 + ((1.0f - luminance) * (actualHeight - 33)), 3, new Color(255, 255, 255, 255));
RenderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 68, actualY + 29 + ((hue / 360.0f) * (actualHeight - 33)), 30, 3, new Color(255, 255, 255, 255));
RenderUtils.drawOutlinedBox(matrixStack, actualX + actualWidth - 34, actualY + 29 + (((255.0f - alpha) / 255.0f) * (actualHeight - 33)), 30, 3, new Color(255, 255, 255, 255));
}

}
Expand Down
8 changes: 1 addition & 7 deletions src/main/java/net/aoba/gui/tabs/components/Component.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import net.minecraft.client.gui.DrawContext;

public abstract class Component implements IGuiElement, MouseMoveListener {
protected static RenderUtils renderUtils;

private static boolean DEBUG = false;

private boolean visible = false;
Expand Down Expand Up @@ -51,10 +49,6 @@ public Component(IGuiElement parent) {
this.setLeft(0);
this.setRight(0);
this.setBottom(0);

if(renderUtils == null) {
renderUtils = Aoba.getInstance().renderUtils;
}
}

/**
Expand Down Expand Up @@ -325,7 +319,7 @@ public void update() {
public void draw(DrawContext drawContext, float partialTicks, Color color) {
if(this.visible) {
if(this.hovered && DEBUG) {
renderUtils.drawOutline(drawContext.getMatrices(), this.actualX, this.actualY, this.actualWidth, this.actualHeight);
RenderUtils.drawOutline(drawContext.getMatrices(), this.actualX, this.actualY, this.actualWidth, this.actualHeight);
}

for(Component child : children) {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/aoba/gui/tabs/components/HudComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.aoba.gui.Color;
import net.aoba.gui.IGuiElement;
import net.aoba.gui.hud.AbstractHud;
import net.aoba.misc.RenderUtils;
import net.minecraft.client.gui.DrawContext;

public class HudComponent extends Component implements LeftMouseDownListener {
Expand All @@ -29,12 +30,12 @@ public void update() {
@Override
public void draw(DrawContext drawContext, float partialTicks, Color color) {
super.draw(drawContext, partialTicks, color);
renderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, 0xFFFFFF);
RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, 0xFFFFFF);

if(this.hud.activated.getValue()) {
renderUtils.drawString(drawContext, "-", actualX + actualWidth - 16, actualY + 8, 0xFF0000);
RenderUtils.drawString(drawContext, "-", actualX + actualWidth - 16, actualY + 8, 0xFF0000);
}else {
renderUtils.drawString(drawContext, "+", actualX + actualWidth - 16, actualY + 8, 0x00FF00);
RenderUtils.drawString(drawContext, "+", actualX + actualWidth - 16, actualY + 8, 0x00FF00);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.aoba.event.listeners.LeftMouseDownListener;
import net.aoba.gui.Color;
import net.aoba.gui.IGuiElement;
import net.aoba.misc.RenderUtils;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.InputUtil;
Expand All @@ -33,15 +34,15 @@ public void update() {
@Override
public void draw(DrawContext drawContext, float partialTicks, Color color) {
super.draw(drawContext, partialTicks, color);
renderUtils.drawString(drawContext, "Keybind", actualX + 8, actualY + 8, 0xFFFFFF);
renderUtils.drawBox(drawContext.getMatrices(), actualX + actualWidth - 100, actualY + 2, 98, actualHeight - 4, new Color(115, 115, 115, 200));
renderUtils.drawOutline(drawContext.getMatrices(), actualX + actualWidth - 100, actualY + 2, 98, actualHeight - 4);
RenderUtils.drawString(drawContext, "Keybind", actualX + 8, actualY + 8, 0xFFFFFF);
RenderUtils.drawBox(drawContext.getMatrices(), actualX + actualWidth - 100, actualY + 2, 98, actualHeight - 4, new Color(115, 115, 115, 200));
RenderUtils.drawOutline(drawContext.getMatrices(), actualX + actualWidth - 100, actualY + 2, 98, actualHeight - 4);

String keyBindText = this.keyBind.getValue().getLocalizedText().getString();
if(keyBindText.equals("scancode.0") || keyBindText.equals("key.keyboard.0"))
keyBindText = "N/A";

renderUtils.drawString(drawContext, keyBindText, actualX + actualWidth - 90, actualY + 8, 0xFFFFFF);
RenderUtils.drawString(drawContext, keyBindText, actualX + actualWidth - 90, actualY + 8, 0xFFFFFF);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.aoba.gui.Color;
import net.aoba.gui.IGuiElement;
import net.aoba.gui.tabs.ModuleSettingsTab;
import net.aoba.misc.RenderUtils;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
Expand Down Expand Up @@ -46,10 +47,10 @@ public void update() {
@Override
public void draw(DrawContext drawContext, float partialTicks, Color color) {
super.draw(drawContext, partialTicks, color);
renderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, module.getState() ? 0x00FF00 : this.hovered ? color.getColorAsInt() : 0xFFFFFF);
RenderUtils.drawString(drawContext, this.text, actualX + 8, actualY + 8, module.getState() ? 0x00FF00 : this.hovered ? color.getColorAsInt() : 0xFFFFFF);
if(module.hasSettings()) {
Color hudColor = Aoba.getInstance().hudManager.color.getValue();
renderUtils.drawTexturedQuad(drawContext, gear, (actualX + actualWidth - 20), (actualY + 6), 16, 16, hudColor);
RenderUtils.drawTexturedQuad(drawContext, gear, (actualX + actualWidth - 20), (actualY + 6), 16, 16, hudColor);
}
}

Expand Down
17 changes: 6 additions & 11 deletions src/main/java/net/aoba/gui/tabs/components/SliderComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.aoba.gui.Color;
import net.aoba.gui.GuiManager;
import net.aoba.gui.IGuiElement;
import net.aoba.misc.RenderUtils;
import net.aoba.settings.types.FloatSetting;
import net.aoba.utils.types.Vector2;
import net.minecraft.client.MinecraftClient;
Expand Down Expand Up @@ -118,22 +119,16 @@ public void draw(DrawContext drawContext, float partialTicks, Color color) {
float xLength = ((actualWidth - 18) * (float) ((slider.getValue() - slider.min_value) / (slider.max_value - slider.min_value)));

GuiManager hudManager = Aoba.getInstance().hudManager;
renderUtils.drawBox(matrixStack, actualX + 10, actualY + 35, xLength, 2, hudManager.color.getValue());
renderUtils.drawBox(matrixStack, actualX + 10 + xLength, actualY + 35, (actualWidth - xLength - 18), 2, new Color(255, 255, 255, 255));
renderUtils.drawCircle(matrixStack, actualX + 10 + xLength, actualY + 35, 6, hudManager.color.getValue());


//renderUtils.drawBox(matrixStack, actualX + 4, actualY + 4, (actualWidth - 8) * (float) ((slider.getValue() - slider.min_value) / (slider.max_value - slider.min_value)), actualHeight - 8, color, 1f);
//renderUtils.drawOutline(matrixStack, actualX + 4, actualY + 24, actualWidth - 8, actualHeight - 8);
RenderUtils.drawBox(matrixStack, actualX + 10, actualY + 35, xLength, 2, hudManager.color.getValue());
RenderUtils.drawBox(matrixStack, actualX + 10 + xLength, actualY + 35, (actualWidth - xLength - 18), 2, new Color(255, 255, 255, 255));
RenderUtils.drawCircle(matrixStack, actualX + 10 + xLength, actualY + 35, 6, hudManager.color.getValue());

if (this.slider == null)
return;
// TODO: Slow but it works. Perhaps we can modify a STORED string using our new
// Consumer delegates?
renderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 6, 0xFFFFFF);
RenderUtils.drawString(drawContext, this.text, actualX + 6, actualY + 6, 0xFFFFFF);

String valueText = String.format("%.02f", this.slider.getValue());
int textSize = MinecraftClient.getInstance().textRenderer.getWidth(valueText) * MinecraftClient.getInstance().options.getGuiScale().getValue();
renderUtils.drawString(drawContext, valueText, actualX + actualWidth - 6 - textSize, actualY + 6, 0xFFFFFF);
RenderUtils.drawString(drawContext, valueText, actualX + actualWidth - 6 - textSize, actualY + 6, 0xFFFFFF);
}
}
Loading

0 comments on commit bc57148

Please sign in to comment.