Skip to content

Commit

Permalink
Module fixes + slimmed Macros for update
Browse files Browse the repository at this point in the history
Fixed Reach
Fixed NoRender
Modified ESP default colors to include transparency
Added Blocks list to Surround module
  • Loading branch information
coltonk9043 committed Dec 8, 2024
1 parent 7c66be4 commit f15bb0c
Show file tree
Hide file tree
Showing 21 changed files with 142 additions and 227 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 @@ -49,7 +49,7 @@
public class AobaClient {
public static final String NAME = "Aoba";
public static final String VERSION = "1.21.3";
public static final String AOBA_VERSION = "1.4.3";
public static final String AOBA_VERSION = "1.4.4";

public static MinecraftClient MC;
public static IMinecraftClient IMC;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/aoba/gui/components/BlocksComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void draw(DrawContext drawContext, float partialTicks) {
float actualY = this.getActualSize().getY();
float actualWidth = this.getActualSize().getWidth();

Render2D.drawString(drawContext, text, actualX + 6, actualY + 6, 0xFFFFFF);
Render2D.drawString(drawContext, text, actualX, actualY + 6, 0xFFFFFF);
Render2D.drawString(drawContext, collapsed ? ">>" : "<<", (actualX + actualWidth - 24), actualY + 6,
GuiManager.foregroundColor.getValue().getColorAsInt());

Expand Down
53 changes: 24 additions & 29 deletions src/main/java/net/aoba/gui/navigation/windows/MacroWindow.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
package net.aoba.gui.navigation.windows;

import java.util.function.Function;

import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.gui.UIElement;
import net.aoba.gui.components.ButtonComponent;
import net.aoba.gui.components.ItemsComponent;
import net.aoba.gui.components.SeparatorComponent;
Expand Down Expand Up @@ -76,32 +73,30 @@ public void run() {
replayButton.addChild(replayButtonText);
stackPanel.addChild(replayButton);

stackPanel.addChild(new StringComponent("Filename:"));

filenameText = new TextBoxComponent();
stackPanel.addChild(filenameText);

saveButton = new ButtonComponent(new Runnable() {
@Override
public void run() {
AobaClient aoba = Aoba.getInstance();
Macro currentMacro = aoba.macroManager.getCurrentlySelected();
currentMacro.setName(filenameText.getText());
aoba.macroManager.addMacro(currentMacro);

// Reload the items control.
macrosList.setItemsSource(aoba.macroManager.getMacros());
}
});

saveButton.addChild(new StringComponent("Save"));

stackPanel.addChild(saveButton);

// Add Macros ItemComponents
Function<Macro, UIElement> test = s -> new StringComponent(s.getName());
macrosList = new ItemsComponent<Macro>(Aoba.getInstance().macroManager.getMacros(), test);
stackPanel.addChild(macrosList);
/**
* stackPanel.addChild(new StringComponent("Filename:"));
*
* filenameText = new TextBoxComponent(); stackPanel.addChild(filenameText);
*
* saveButton = new ButtonComponent(new Runnable() {
*
* @Override public void run() { AobaClient aoba = Aoba.getInstance(); Macro
* currentMacro = aoba.macroManager.getCurrentlySelected();
* currentMacro.setName(filenameText.getText());
* aoba.macroManager.addMacro(currentMacro);
*
* // Reload the items control.
* macrosList.setItemsSource(aoba.macroManager.getMacros()); } });
*
* saveButton.addChild(new StringComponent("Save"));
*
* stackPanel.addChild(saveButton);
*
* // Add Macros ItemComponents Function<Macro, UIElement> test = s ->
* new StringComponent(s.getName()); macrosList = new
* ItemsComponent<Macro>(Aoba.getInstance().macroManager.getMacros(),
* test); stackPanel.addChild(macrosList);
*/

// Add stackpanel to child.
addChild(stackPanel);
Expand Down
61 changes: 26 additions & 35 deletions src/main/java/net/aoba/macros/MacroManager.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package net.aoba.macros;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.mojang.logging.LogUtils;

import net.minecraft.client.MinecraftClient;

public class MacroManager {
Expand All @@ -26,40 +22,35 @@ public MacroManager() {
}

private void load() {
File macroDirectory = new File(MC.runDirectory + File.separator + "aoba" + File.separator + "macros");

if (macroDirectory.exists() && macroDirectory.isDirectory()) {
LogUtils.getLogger().info("Found Macro Directory: " + macroDirectory.getAbsolutePath());
File[] files = macroDirectory.listFiles((dir, name) -> name.endsWith(".macro"));

if (files != null) {
for (File file : files) {
try {
Macro macro = new Macro(file);
macros.put(macro.getName(), macro);
} catch (Exception e) {

}
}
}
}
/*
* File macroDirectory = new File(MC.runDirectory + File.separator + "aoba" +
* File.separator + "macros");
*
* if (macroDirectory.exists() && macroDirectory.isDirectory()) {
* LogUtils.getLogger().info("Found Macro Directory: " +
* macroDirectory.getAbsolutePath()); File[] files =
* macroDirectory.listFiles((dir, name) -> name.endsWith(".macro"));
*
* if (files != null) { for (File file : files) { try { Macro macro = new
* Macro(file); macros.put(macro.getName(), macro); } catch (Exception e) {
*
* } } } }
*/
}

public void save() {
try {
File macrosFolder = new File(
MinecraftClient.getInstance().runDirectory + File.separator + "aoba" + File.separator + "macros");
if (!macrosFolder.exists() && !macrosFolder.mkdirs()) {
throw new IOException("Failed to create macro folder: " + macrosFolder.getAbsolutePath());
}

for (Macro macro : macros.values()) {
macro.save();
}
} catch (Exception e) {

}

/*
* try { File macrosFolder = new File(
* MinecraftClient.getInstance().runDirectory + File.separator + "aoba" +
* File.separator + "macros"); if (!macrosFolder.exists() &&
* !macrosFolder.mkdirs()) { throw new
* IOException("Failed to create macro folder: " +
* macrosFolder.getAbsolutePath()); }
*
* for (Macro macro : macros.values()) { macro.save(); } } catch (Exception e) {
*
* }
*/
}

public void addMacro(Macro macro) {
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/aoba/mixin/BackgroundRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.aoba.Aoba;
import net.minecraft.client.render.BackgroundRenderer;
import net.minecraft.entity.Entity;

Expand All @@ -31,8 +32,8 @@ public class BackgroundRendererMixin {
@Inject(at = { @At("HEAD") }, method = {
"getFogModifier(Lnet/minecraft/entity/Entity;F)Lnet/minecraft/client/render/BackgroundRenderer$StatusEffectFogModifier;" }, cancellable = true)
private static void onGetFogModifier(Entity entity, float tickDelta, CallbackInfoReturnable<?> cir) {
// TODO: NoRender
// if (Aoba.getInstance().moduleManager.nooverlay.getState())
// cir.setReturnValue(null);
if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
cir.setReturnValue(null);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,31 +18,19 @@

package net.aoba.mixin;

import net.aoba.interfaces.IClientPlayerInteractionManager;
import net.minecraft.client.network.ClientPlayerInteractionManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;

import net.aoba.interfaces.IClientPlayerInteractionManager;
import net.minecraft.client.network.ClientPlayerInteractionManager;

@Mixin(ClientPlayerInteractionManager.class)
public abstract class ClientPlayerInteractionManagerMixin implements IClientPlayerInteractionManager {
@Shadow
protected abstract void syncSelectedSlot();

@Override
public void aoba$syncSelected() {
syncSelectedSlot();
}
@Shadow
protected abstract void syncSelectedSlot();

// TODO Reach?
/*
* @Inject(at = { @At("HEAD") }, method = { "getReachDistance()F" }, cancellable
* = true) private void onGetReachDistance(CallbackInfoReturnable<Float> ci) {
* Reach reachHack = (Reach) Aoba.getInstance().moduleManager.reach; if
* (reachHack.getState()) { ci.setReturnValue(reachHack.getReach()); } }
*
* @Inject(at = { @At("HEAD") }, method = { "hasExtendedReach()Z" }, cancellable
* = true) private void hasExtendedReach(CallbackInfoReturnable<Boolean> cir) {
* Reach reachHack = (Reach) Aoba.getInstance().moduleManager.reach; if
* (reachHack.getState()) cir.setReturnValue(true); }
*/
@Override
public void aoba$syncSelected() {
syncSelectedSlot();
}
}
14 changes: 6 additions & 8 deletions src/main/java/net/aoba/mixin/GameRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,17 @@ public abstract class GameRendererMixin {
@Inject(at = { @At("HEAD") }, method = {
"bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V" }, cancellable = true)
private void onBobViewWhenHurt(MatrixStack matrixStack, float f, CallbackInfo ci) {
// TODO: NoRender
// if (Aoba.getInstance().moduleManager.nooverlay.getState()) {
// ci.cancel();
// }
if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
ci.cancel();
}
}

@Redirect(at = @At(value = "INVOKE", target = "Lnet/minecraft/util/math/MathHelper;lerp(FFF)F", ordinal = 0), method = {
"renderWorld(Lnet/minecraft/client/render/RenderTickCounter;)V" })
private float nauseaLerp(float delta, float first, float second) {
// TODO: NoRender
// if (Aoba.getInstance().moduleManager.nooverlay.getState())
// return 0;

if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
return 0;
}
return MathHelper.lerp(delta, first, second);
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/net/aoba/mixin/LightmapTextureManagerMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

import net.aoba.Aoba;
import net.minecraft.client.render.LightmapTextureManager;

@Mixin(LightmapTextureManager.class)
public class LightmapTextureManagerMixin {
@Inject(at = { @At("HEAD") }, method = { "getDarknessFactor(F)F" }, cancellable = true)
private void onGetDarknessFactor(float delta, CallbackInfoReturnable<Float> cir) {
// TODO: NoRender
// if (Aoba.getInstance().moduleManager.nooverlay.getState())
// cir.setReturnValue(0F);
if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
cir.setReturnValue(0F);
}
}
}
17 changes: 17 additions & 0 deletions src/main/java/net/aoba/mixin/PlayerEntityMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import net.aoba.Aoba;
import net.aoba.AobaClient;
import net.aoba.module.modules.combat.Reach;
import net.aoba.module.modules.misc.FastBreak;
import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity;
Expand Down Expand Up @@ -66,4 +67,20 @@ public void onGetBlockBreakingSpeed(BlockState blockState, CallbackInfoReturnabl
protected void onGetOffGroundSpeed(CallbackInfoReturnable<Float> cir) {
return;
}

@Inject(at = { @At("HEAD") }, method = "getBlockInteractionRange()D", cancellable = true)
private void onBlockInteractionRange(CallbackInfoReturnable<Double> cir) {
if (Aoba.getInstance().moduleManager.reach.state.getValue()) {
Reach reach = (Reach) Aoba.getInstance().moduleManager.reach;
cir.setReturnValue((double) reach.getReach());
}
}

@Inject(at = { @At("HEAD") }, method = "getEntityInteractionRange()D", cancellable = true)
private void onEntityInteractionRange(CallbackInfoReturnable<Double> cir) {
if (Aoba.getInstance().moduleManager.reach.state.getValue()) {
Reach reach = (Reach) Aoba.getInstance().moduleManager.reach;
cir.setReturnValue((double) reach.getReach());
}
}
}
6 changes: 3 additions & 3 deletions src/main/java/net/aoba/mixin/WorldRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public void render(ObjectAllocator allocator, RenderTickCounter tickCounter, boo

@Inject(at = @At("HEAD"), method = "hasBlindnessOrDarkness(Lnet/minecraft/client/render/Camera;)Z", cancellable = true)
private void onHasBlindnessOrDarknessEffect(Camera camera, CallbackInfoReturnable<Boolean> cir) {
// TODO: NoRender
// if (Aoba.getInstance().moduleManager.nooverlay.getState())
// cir.setReturnValue(false);
if (Aoba.getInstance().moduleManager.norender.state.getValue()) {
cir.setReturnValue(false);
}
}

@Inject(at = @At("HEAD"), method = "drawBlockOutline(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;Lnet/minecraft/entity/Entity;DDDLnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;I)V", cancellable = true)
Expand Down
31 changes: 0 additions & 31 deletions src/main/java/net/aoba/mixin/interfaces/ILlamaEntityModel.java

This file was deleted.

40 changes: 0 additions & 40 deletions src/main/java/net/aoba/mixin/interfaces/IRabbitEntityModel.java

This file was deleted.

Loading

0 comments on commit f15bb0c

Please sign in to comment.