Skip to content

Commit

Permalink
Removed unused imports and seperated 'Toggle Huds' from 'Hud Options'…
Browse files Browse the repository at this point in the history
… clickgui tab.

** TODO: Criticals is broken and will crash the game.
  • Loading branch information
coltonk9043 committed May 4, 2024
1 parent 7694d16 commit 7d8c249
Show file tree
Hide file tree
Showing 39 changed files with 115 additions and 161 deletions.
4 changes: 1 addition & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,12 @@ repositories {

loom {
splitEnvironmentSourceSets()

mods {
"template-mod" {
"aoba" {
sourceSet sourceSets.main
sourceSet sourceSets.client
}
}

}

dependencies {
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Done to increase the memory available to gradle.
org.gradle.jvmargs=-Xmx1G
org.gradle.jvmargs=-Xmx2G
org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.5
yarn_mappings=1.20.5+build.1
loader_version=0.15.10
loader_version=0.15.11

# Mod Properties
mod_version = 1.4.1
maven_group = net.aoba
archives_base_name = Aoba

# Dependencies
fabric_version=0.97.7+1.20.5
fabric_version=0.97.8+1.20.5
1 change: 0 additions & 1 deletion src/main/java/net/aoba/AobaClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import net.aoba.cmd.GlobalChat;
import net.aoba.event.EventManager;
import net.aoba.gui.GuiManager;
import net.aoba.gui.colors.ColorMode;
import net.aoba.gui.font.FontManager;
import net.aoba.misc.RenderUtils;
import net.aoba.mixin.interfaces.IMinecraftClient;
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/net/aoba/altmanager/AltManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLDecoder;
Expand Down Expand Up @@ -313,7 +315,8 @@ private String microsoftLogin(Alt alt, String cookie, String ppft, String urlPos
byte[] encodedDataBytes = urlEncodeMap(postData).getBytes(StandardCharsets.UTF_8);

try {
URL url = new URL(urlPost);
URI uri = URI.create(urlPost);
URL url = uri.toURL();
HttpURLConnection connection = (HttpURLConnection) url.openConnection();

connection.setRequestMethod("POST");
Expand Down Expand Up @@ -557,7 +560,8 @@ private String getMicrosoftAccessToken(String authCode) throws LoginException {
}

private String postJson(final String urlString, final String content) throws Exception {
URL url = new URL(urlString);
URI uri = new URI(urlString);
URL url = uri.toURL();
HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
Expand Down Expand Up @@ -601,9 +605,12 @@ private UUID uuidFromJson(String jsonUUID) throws Exception {

private URL createURL(String url) {
try {
return new URL(url);
URI uri = new URI(url);
return uri.toURL();
} catch (MalformedURLException e) {
throw new IllegalArgumentException(e);
} catch(URISyntaxException e) {
throw new IllegalArgumentException(e);
}
}

Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/event/events/FoodLevelEvent.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@

import java.util.ArrayList;
import java.util.List;

import net.aoba.event.listeners.AbstractListener;
import net.aoba.event.listeners.FoodLevelListener;
import net.aoba.event.listeners.PlayerHealthListener;
import net.minecraft.entity.damage.DamageSource;

public class FoodLevelEvent extends AbstractEvent {
private float foodLevel;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package net.aoba.event.listeners;

import net.aoba.event.events.BlockStateEvent;
import net.aoba.event.events.FontChangedEvent;
import net.aoba.event.events.KeyDownEvent;

public interface BlockStateListener extends AbstractListener {
public abstract void OnBlockStateChanged(BlockStateEvent event);
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/net/aoba/gui/GuiManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import net.aoba.event.listeners.LeftMouseDownListener;
import net.aoba.event.listeners.LeftMouseUpListener;
import net.aoba.event.listeners.KeyDownListener;

import org.joml.Matrix4f;
import org.lwjgl.glfw.GLFW;
import org.lwjgl.opengl.GL11;
Expand Down Expand Up @@ -115,8 +114,8 @@ public void Initialize() {
radarHud = new RadarHud(590, 500, 180, 180);
infoHud = new InfoHud(100, 500);

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

hudPane.AddHud(new HudOptionsTab());
hudPane.AddHud(new ToggleHudsTab(new AbstractHud[] { moduleSelector, armorHud,radarHud, infoHud }));
int xOffset = 50;
for (Category category : Module.Category.values()) {
ClickGuiTab tab = new ClickGuiTab(category.name(), xOffset, 75, true, category.name());
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/aoba/gui/NavigationBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@

import java.util.ArrayList;
import java.util.List;

import org.joml.Matrix4f;

import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.event.events.LeftMouseDownEvent;
Expand Down
11 changes: 4 additions & 7 deletions src/main/java/net/aoba/gui/font/FontManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,12 @@
import java.util.Iterator;
import java.util.List;
import java.util.Set;

import org.lwjgl.PointerBuffer;
import org.lwjgl.stb.STBTTFontinfo;
import org.lwjgl.stb.STBTruetype;
import org.lwjgl.system.MemoryStack;
import org.lwjgl.system.MemoryUtil;
import org.lwjgl.system.Struct;
import org.lwjgl.util.freetype.FT_Face;
import org.lwjgl.util.freetype.FreeType;

import net.aoba.Aoba;
import net.aoba.event.events.FontChangedEvent;
import net.aoba.settings.SettingManager;
Expand Down Expand Up @@ -96,9 +92,10 @@ public boolean accept(File dir, String name) {
e.printStackTrace();
}

FontStorage storage = new FontStorage(MC.getTextureManager(), new Identifier("aoba:" + file.getName()));
storage.setFonts(list, Set.of());
fontRenderers.put(file.getName().replace(".ttf", ""), new TextRenderer(id -> storage, true));
try (FontStorage storage = new FontStorage(MC.getTextureManager(), new Identifier("aoba:" + file.getName()))) {
storage.setFonts(list, Set.of());
fontRenderers.put(file.getName().replace(".ttf", ""), new TextRenderer(id -> storage, true));
}
}
}

Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/aoba/gui/hud/AbstractHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

import net.aoba.Aoba;
import net.aoba.gui.AbstractGui;
import net.aoba.gui.colors.Color;
import net.aoba.settings.SettingManager;
import net.aoba.settings.types.BooleanSetting;
import net.minecraft.client.gui.DrawContext;
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/net/aoba/gui/hud/ModuleSelectorHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@
package net.aoba.gui.hud;

import java.util.ArrayList;

import org.joml.Matrix4f;
import org.lwjgl.glfw.GLFW;
import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.gui.GuiManager;
import net.aoba.gui.colors.Color;
import net.aoba.misc.RenderUtils;
import net.aoba.module.Module;
import net.aoba.module.Module.Category;
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/gui/hud/RadarHud.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
package net.aoba.gui.hud;

import org.joml.Matrix4f;

import net.aoba.Aoba;
import net.aoba.gui.GuiManager;
import net.aoba.gui.colors.Color;
import net.aoba.misc.RenderUtils;
Expand Down Expand Up @@ -49,7 +47,6 @@ public void draw(DrawContext drawContext, float partialTicks) {
Vector2 pos = position.getValue();

// Draws background depending on components width and height
GuiManager hudManager = Aoba.getInstance().hudManager;
RenderUtils.drawRoundedBox(matrix4f, pos.x, pos.y, width, height, 6, GuiManager.backgroundColor.getValue());
RenderUtils.drawRoundedOutline(matrix4f, pos.x, pos.y, width, height, 6, GuiManager.borderColor.getValue());

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/net/aoba/gui/tabs/AuthCrackerTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
package net.aoba.gui.tabs;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.Scanner;
import java.util.concurrent.TimeUnit;
Expand Down Expand Up @@ -98,10 +100,13 @@ private void RunAuthCracker() {
URL url;
Scanner s = null;
try {
url = new URL("https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt");
URI uri = new URI("https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-1000000.txt");
url = uri.toURL();
s = new Scanner(url.openStream());
} catch (IOException e) {
e.printStackTrace();
} catch (URISyntaxException e) {
e.printStackTrace();
}
if(s != null) {
while(shouldContinue && s.hasNextLine()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,52 +22,31 @@
import java.util.HashMap;
import java.util.List;
import java.util.Set;

import net.aoba.Aoba;
import net.aoba.event.events.MouseScrollEvent;
import net.aoba.event.listeners.MouseScrollListener;
import net.aoba.gui.GuiManager;
import net.aoba.gui.colors.Color;
import net.aoba.gui.font.FontManager;
import net.aoba.gui.hud.AbstractHud;
import net.aoba.gui.tabs.components.ColorPickerComponent;
import net.aoba.gui.tabs.components.HudComponent;
import net.aoba.gui.tabs.components.KeybindComponent;
import net.aoba.gui.tabs.components.ListComponent;
import net.aoba.gui.tabs.components.StackPanelComponent;
import net.aoba.gui.tabs.components.StringComponent;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.DrawContext;
import net.aoba.module.Module;
import net.aoba.settings.types.StringSetting;

public class HudsTab extends ClickGuiTab implements MouseScrollListener {

int visibleScrollElements;
int currentScroll;

public HudsTab(AbstractHud[] abstractHuds) {
super("Hud Options", 50, 50, false);
public class HudOptionsTab extends ClickGuiTab {
public HudOptionsTab() {
super("Hud Options", 260, 50, false);

Aoba.getInstance().eventManager.AddListener(MouseScrollListener.class, this);
StackPanelComponent stackPanel = new StackPanelComponent(this);
stackPanel.setTop(30);

List<String> test = new ArrayList<String>();


List<String> fontNames = new ArrayList<String>();
HashMap<String, TextRenderer> fontRenderers = Aoba.getInstance().fontManager.fontRenderers;
Set<String> set = fontRenderers.keySet();

for(String s : set) {
test.add(s);
}

stackPanel.addChild(new StringComponent("Toggle HUD", stackPanel, GuiManager.foregroundColor.getValue(), true));

for(AbstractHud hud : abstractHuds) {
HudComponent hudComponent = new HudComponent(hud.getID(), stackPanel, hud);
stackPanel.addChild(hudComponent);
fontNames.add(s);
}

// Keybinds Header
Expand All @@ -80,9 +59,7 @@ public HudsTab(AbstractHud[] abstractHuds) {
// Hud Font Header
stackPanel.addChild(new StringComponent("HUD Font", stackPanel, GuiManager.foregroundColor.getValue(), true));



ListComponent listComponent = new ListComponent(stackPanel, test, Aoba.getInstance().fontManager.fontSetting);
ListComponent listComponent = new ListComponent(stackPanel, fontNames, Aoba.getInstance().fontManager.fontSetting);
stackPanel.addChild(listComponent);

stackPanel.addChild(new StringComponent("HUD Colors", stackPanel, GuiManager.foregroundColor.getValue(), true));
Expand All @@ -94,16 +71,6 @@ public HudsTab(AbstractHud[] abstractHuds) {
this.children.add(stackPanel);
this.setWidth(300);
}

@Override
public void OnMouseScroll(MouseScrollEvent event) {
ArrayList<Module> modules = Aoba.getInstance().moduleManager.modules;

if(event.GetVertical() > 0)
this.currentScroll = Math.min(currentScroll + 1, modules.size() - visibleScrollElements - 1);
else if(event.GetVertical() < 0)
this.currentScroll = Math.max(currentScroll - 1, 0);
}

@Override
public void draw(DrawContext drawContext, float partialTicks) {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import net.aoba.gui.tabs.components.ColorPickerComponent;
import net.aoba.gui.tabs.components.Component;
import net.aoba.gui.tabs.components.KeybindComponent;
import net.aoba.gui.tabs.components.ListComponent;
import net.aoba.gui.tabs.components.SliderComponent;
import net.aoba.gui.tabs.components.StackPanelComponent;
import net.aoba.misc.RenderUtils;
Expand All @@ -44,8 +43,6 @@
import net.aoba.settings.types.BooleanSetting;
import net.aoba.settings.types.ColorSetting;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.IndexedStringListSetting;
import net.aoba.settings.types.StringListSetting;
import net.aoba.utils.types.Vector2;

public class ModuleSettingsTab extends AbstractGui implements LeftMouseDownListener, MouseMoveListener {
Expand Down
49 changes: 49 additions & 0 deletions src/main/java/net/aoba/gui/tabs/ToggleHudsTab.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Aoba Hacked Client
* Copyright (C) 2019-2024 coltonk9043
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

package net.aoba.gui.tabs;

import net.aoba.Aoba;
import net.aoba.event.listeners.MouseScrollListener;
import net.aoba.gui.hud.AbstractHud;
import net.aoba.gui.tabs.components.HudComponent;
import net.aoba.gui.tabs.components.StackPanelComponent;
import net.minecraft.client.gui.DrawContext;

public class ToggleHudsTab extends ClickGuiTab {
public ToggleHudsTab(AbstractHud[] abstractHuds) {
super("Toggle HUDs", 50, 50, false);

Aoba.getInstance().eventManager.AddListener(MouseScrollListener.class, this);
StackPanelComponent stackPanel = new StackPanelComponent(this);
stackPanel.setTop(30);

for(AbstractHud hud : abstractHuds) {
HudComponent hudComponent = new HudComponent(hud.getID(), stackPanel, hud);
stackPanel.addChild(hudComponent);
}

this.children.add(stackPanel);
this.setWidth(300);
}

@Override
public void draw(DrawContext drawContext, float partialTicks) {
super.draw(drawContext, partialTicks);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,9 @@
package net.aoba.gui.tabs.components;

import org.joml.Matrix4f;

import net.aoba.Aoba;
import net.aoba.event.events.LeftMouseDownEvent;
import net.aoba.event.listeners.LeftMouseDownListener;
import net.aoba.gui.GuiManager;
import net.aoba.gui.IGuiElement;
import net.aoba.gui.colors.Color;
import net.aoba.misc.RenderUtils;
Expand Down
Loading

0 comments on commit 7d8c249

Please sign in to comment.