Skip to content

Commit

Permalink
Merge pull request #39 from coltonk9043/1.20.5
Browse files Browse the repository at this point in the history
Removed more unused imports and fixed GUI crash on mouse scroll.
  • Loading branch information
coltonk9043 committed May 5, 2024
2 parents b0da88d + ac15b9c commit b77ae05
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 101 deletions.
2 changes: 0 additions & 2 deletions src/main/java/net/aoba/gui/tabs/HudOptionsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import java.util.List;
import java.util.Set;
import net.aoba.Aoba;
import net.aoba.event.listeners.MouseScrollListener;
import net.aoba.gui.GuiManager;
import net.aoba.gui.tabs.components.ColorPickerComponent;
import net.aoba.gui.tabs.components.KeybindComponent;
Expand All @@ -37,7 +36,6 @@ 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);

Expand Down
24 changes: 1 addition & 23 deletions src/main/java/net/aoba/gui/tabs/HudsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,8 @@
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.Color;
import net.aoba.gui.GuiManager;
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;
Expand All @@ -38,18 +33,11 @@
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 class HudsTab extends ClickGuiTab {
public HudsTab(AbstractHud[] abstractHuds) {
super("Hud Options", 50, 50, false);

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

Expand Down Expand Up @@ -94,16 +82,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
52 changes: 24 additions & 28 deletions src/main/java/net/aoba/gui/tabs/ModuleSettingsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
package net.aoba.gui.tabs;

import org.joml.Matrix4f;

import net.aoba.Aoba;
import net.aoba.event.events.LeftMouseDownEvent;
import net.aoba.event.listeners.LeftMouseDownListener;
import net.aoba.event.listeners.MouseMoveListener;
import net.aoba.gui.AbstractGui;
import net.aoba.gui.GuiManager;
import net.aoba.gui.colors.Color;
Expand All @@ -45,7 +41,7 @@
import net.aoba.settings.types.FloatSetting;
import net.aoba.utils.types.Vector2;

public class ModuleSettingsTab extends AbstractGui implements LeftMouseDownListener, MouseMoveListener {
public class ModuleSettingsTab extends AbstractGui {
protected String title;
protected Module module;

Expand Down Expand Up @@ -144,27 +140,27 @@ public void draw(DrawContext drawContext, float partialTicks) {
}
}

@Override
public void OnLeftMouseDown(LeftMouseDownEvent event) {
double mouseX = mc.mouse.getX();
double mouseY = mc.mouse.getY();
Vector2 pos = position.getValue();

if (Aoba.getInstance().hudManager.isClickGuiOpen()) {
if (mouseX >= pos.x && mouseX <= pos.x + width) {
if (mouseY >= pos.y && mouseY <= pos.y + 24) {
this.lastClickOffsetX = mouseX - pos.x;
this.lastClickOffsetY = mouseY - pos.y;
GuiManager.currentGrabbed = this;
}
}

if (mouseX >= (pos.x + width - 24) && mouseX <= (pos.x + width - 2)) {
if (mouseY >= (pos.y + 4) && mouseY <= (pos.y + 20)) {
GuiManager.currentGrabbed = null;
Aoba.getInstance().hudManager.RemoveHud(this, "Modules");
}
}
}
}
// @Override
// public void OnLeftMouseDown(LeftMouseDownEvent event) {
// double mouseX = mc.mouse.getX();
// double mouseY = mc.mouse.getY();
// Vector2 pos = position.getValue();
//
// if (Aoba.getInstance().hudManager.isClickGuiOpen()) {
// if (mouseX >= pos.x && mouseX <= pos.x + width) {
// if (mouseY >= pos.y && mouseY <= pos.y + 24) {
// this.lastClickOffsetX = mouseX - pos.x;
// this.lastClickOffsetY = mouseY - pos.y;
// GuiManager.currentGrabbed = this;
// }
// }
//
// if (mouseX >= (pos.x + width - 24) && mouseX <= (pos.x + width - 2)) {
// if (mouseY >= (pos.y + 4) && mouseY <= (pos.y + 20)) {
// GuiManager.currentGrabbed = null;
// Aoba.getInstance().hudManager.RemoveHud(this, "Modules");
// }
// }
// }
// }
}
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/gui/tabs/ToggleHudsTab.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

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;
Expand All @@ -29,7 +27,6 @@ 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);

Expand Down
6 changes: 3 additions & 3 deletions src/main/java/net/aoba/module/modules/combat/KillAura.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ public void OnUpdate(TickEvent event) {
// If the entity is found, we want to attach it.
if (found) {
if(legit.getValue()) {
float camPitch = MC.cameraEntity.getPitch();
float camYaw = MC.cameraEntity.getYaw();
//float camPitch = MC.cameraEntity.getPitch();
//float camYaw = MC.cameraEntity.getYaw();

Vec2f vec2 = new Vec2f((float)(MC.player.getX() - entityToAttack.getX()), (float)(MC.player.getZ() - entityToAttack.getZ()));
vec2 = vec2.normalize();

double angleFromPlayer = Math.atan2(vec2.y, vec2.x);
//double angleFromPlayer = Math.atan2(vec2.y, vec2.x);
}
MC.interactionManager.attackEntity(MC.player, entityToAttack);
MC.player.swingHand(Hand.MAIN_HAND);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/module/modules/misc/AutoEat.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,13 @@
import org.lwjgl.glfw.GLFW;
import net.aoba.Aoba;
import net.aoba.event.events.FoodLevelEvent;
import net.aoba.event.events.TickEvent;
import net.aoba.event.listeners.FoodLevelListener;
import net.aoba.event.listeners.TickListener;
import net.aoba.module.Module;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.util.InputUtil;
import net.minecraft.component.DataComponentTypes;
import net.minecraft.component.type.FoodComponent;
import net.minecraft.component.type.FoodComponents;
import net.minecraft.item.Item;

public class AutoEat extends Module implements FoodLevelListener {
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/module/modules/movement/Step.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@
package net.aoba.module.modules.movement;

import org.lwjgl.glfw.GLFW;

import net.aoba.Aoba;
import net.aoba.gui.font.FontManager;
import net.aoba.module.Module;
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
Expand Down
5 changes: 0 additions & 5 deletions src/main/java/net/aoba/module/modules/render/Breadcrumbs.java
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@
import net.aoba.event.listeners.RenderListener;
import net.aoba.event.listeners.TickListener;
import net.aoba.gui.colors.Color;
import net.aoba.gui.colors.RainbowColor;

import org.lwjgl.glfw.GLFW;
import net.aoba.module.Module;
import net.aoba.settings.types.BooleanSetting;
Expand All @@ -45,8 +43,6 @@ public class Breadcrumbs extends Module implements RenderListener, TickListener
private Color currentColor;

private ColorSetting color = new ColorSetting("breadcrumbs_color", "Color", "Color", new Color(0, 1f, 1f));

private RainbowColor rainbowColor;

public BooleanSetting rainbow = new BooleanSetting("breadcrumbs_rainbow", "Rainbow", "Rainbow", false);
public FloatSetting effectSpeed = new FloatSetting("breadcrumbs_effectspeed", "Effect Spd.", "Effect Spd", 4f, 1f, 20f, 0.1f);
Expand All @@ -62,7 +58,6 @@ public Breadcrumbs() {
this.setCategory(Category.Render);
this.setDescription("Shows breadcrumbs of where you last stepped;");
currentColor = color.getValue();
rainbowColor = new RainbowColor();

this.addSetting(color);
this.addSetting(rainbow);
Expand Down
3 changes: 0 additions & 3 deletions src/main/java/net/aoba/module/modules/render/ChestESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@
import org.lwjgl.glfw.GLFW;
import net.aoba.Aoba;
import net.aoba.event.events.RenderEvent;
import net.aoba.event.events.TickEvent;
import net.aoba.event.listeners.RenderListener;
import net.aoba.event.listeners.TickListener;
import net.aoba.gui.colors.Color;
import net.aoba.gui.colors.RainbowColor;
import net.aoba.misc.ModuleUtils;
import net.aoba.misc.RenderUtils;
import net.aoba.module.Module;
Expand Down
23 changes: 1 addition & 22 deletions src/main/java/net/aoba/module/modules/render/EntityESP.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,14 @@
import net.aoba.settings.types.FloatSetting;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.mob.Monster;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;

public class EntityESP extends Module implements RenderListener, TickListener {
public class EntityESP extends Module implements RenderListener {
private ColorSetting color_passive = new ColorSetting("entityesp_color_passive", "Passive Color", "Passive Color", new Color(0, 1f, 1f));
private ColorSetting color_enemies = new ColorSetting("entityesp_color_enemy", "Enemy Color", "Enemy Color", new Color(0, 1f, 1f));
private ColorSetting color_misc = new ColorSetting("entityesp_color_misc", "Misc. Color", "Misc. Color", new Color(0, 1f, 1f));
Expand All @@ -71,13 +69,11 @@ public EntityESP() {
@Override
public void onDisable() {
Aoba.getInstance().eventManager.RemoveListener(RenderListener.class, this);
Aoba.getInstance().eventManager.RemoveListener(TickListener.class, this);
}

@Override
public void onEnable() {
Aoba.getInstance().eventManager.AddListener(RenderListener.class, this);
Aoba.getInstance().eventManager.AddListener(TickListener.class, this);
}

@Override
Expand All @@ -88,17 +84,10 @@ public void onToggle() {
@Override
public void OnRender(RenderEvent event) {
Matrix4f matrix4f = event.GetMatrix().peek().getPositionMatrix();
float partialTicks = event.GetPartialTicks();



for (Entity entity : MC.world.getEntities()) {
if (entity instanceof LivingEntity && !(entity instanceof PlayerEntity)) {

//double x = Math.lerp(partialTicks, entity.lastRenderX, entity.getX());
//double y = Math.lerp(partialTicks, entity.lastRenderY, entity.getY());
//double z = Math.lerp(partialTicks, entity.lastRenderZ, entity.getZ());

Box boundingBox = entity.getBoundingBox();
//Vec3d offset = RenderUtils.getEntityPositionOffsetInterpolated(entity, partialTicks);
//boundingBox = boundingBox.offset(offset);
Expand All @@ -112,14 +101,4 @@ public void OnRender(RenderEvent event) {
}
}
}

@Override
public void OnUpdate(TickEvent event) {
/*
* if(this.rainbow.getValue()) {
* this.rainbowColor.update(this.effectSpeed.getValue().floatValue()); }else {
*
* this.color.setHSV(hue.getValue().floatValue(), 1f, 1f); }
*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.InputUtil;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.item.BowItem;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Vec3d;
Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/aoba/module/modules/render/XRay.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
package net.aoba.module.modules.render;

import java.util.HashSet;
import java.util.List;
import org.lwjgl.glfw.GLFW;
import com.google.common.collect.Lists;
import net.aoba.interfaces.ISimpleOption;
Expand Down
4 changes: 0 additions & 4 deletions src/main/java/net/aoba/module/modules/world/Nuker.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@
package net.aoba.module.modules.world;

import java.util.HashSet;

import org.lwjgl.glfw.GLFW;

import com.google.common.collect.Lists;

import net.aoba.Aoba;
import net.aoba.event.events.BlockStateEvent;
import net.aoba.event.events.RenderEvent;
Expand Down

0 comments on commit b77ae05

Please sign in to comment.