Skip to content

Commit

Permalink
Module fixes and command system fix.
Browse files Browse the repository at this point in the history
NoSlowdown now works thanks to IEntity interface.
Aimbot now has a toggle radius that goes from 1-256 blocks.
Commands no longer send in chat.
  • Loading branch information
coltonk9043 committed Jun 21, 2024
1 parent f1e8a55 commit fcd5968
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 15 deletions.
2 changes: 2 additions & 0 deletions src/main/java/net/aoba/mixin/ChatScreenMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,10 @@ protected void onRender(DrawContext context, int mouseX, int mouseY, float delta
public void onSendMessage(String message, boolean addToHistory, CallbackInfo ci) {
if (message.startsWith(CommandManager.PREFIX.getValue())) {
Aoba.getInstance().commandManager.command(message.split(" "));
ci.cancel();
}else if (GlobalChat.chatType == ChatType.Global) {
Aoba.getInstance().globalChat.SendMessage(message);
ci.cancel();
}
}
}
15 changes: 15 additions & 0 deletions src/main/java/net/aoba/mixin/interfaces/IEntity.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package net.aoba.mixin.interfaces;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;
import net.minecraft.entity.Entity;
import net.minecraft.util.math.Vec3d;

@Mixin(Entity.class)
public interface IEntity {
@Accessor("movementMultiplier")
Vec3d getMovementMultiplier();

@Accessor("movementMultiplier")
void setMovementMultiplier(Vec3d val);
}
35 changes: 22 additions & 13 deletions src/main/java/net/aoba/module/modules/combat/Aimbot.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public class Aimbot extends Module implements TickListener, RenderListener {
private BooleanSetting targetPlayers;
private BooleanSetting targetFriends;
private FloatSetting frequency;

private FloatSetting radius;

private int currentTick = 0;

public Aimbot() {
Expand All @@ -61,12 +62,14 @@ public Aimbot() {
targetAnimals = new BooleanSetting("aimbot_target_mobs", "Target Mobs", "Target mobs.", false);
targetPlayers = new BooleanSetting("aimbot_target_players", "Target Players", "Target players.", true);
targetFriends = new BooleanSetting("aimbot_target_friends", "Target Friends", "Target friends.", false);
frequency = new FloatSetting("aimbot_frequency", "Ticks", "How frequent the aimbot updates (Lower = Laggier)",
1.0f, 1.0f, 20.0f, 1.0f);
frequency = new FloatSetting("aimbot_frequency", "Ticks", "How frequent the aimbot updates (Lower = Laggier)", 1.0f, 1.0f, 20.0f, 1.0f);
radius = new FloatSetting("aimbot_radius", "Radius", "Radius", 64.0f, 1.0f, 256.0f, 1.0f);

this.addSetting(targetAnimals);
this.addSetting(targetPlayers);
this.addSetting(targetFriends);
this.addSetting(frequency);
this.addSetting(radius);
}

@Override
Expand Down Expand Up @@ -97,6 +100,9 @@ public void OnRender(RenderEvent event) {
@Override
public void OnUpdate(TickEvent event) {
currentTick++;

float radiusSqr = radius.getValue() * radius.getValue();

if (currentTick >= frequency.getValue()) {
LivingEntity entityFound = null;

Expand All @@ -110,10 +116,8 @@ public void OnUpdate(TickEvent event) {
if (!targetFriends.getValue() && Aoba.getInstance().friendsList.contains(entity))
continue;

if(entityFound == null)
entityFound = entity;

if (entity.squaredDistanceTo(MC.player) < entityFound.squaredDistanceTo(MC.player)) {
double entityDistanceToPlayer = entity.squaredDistanceTo(MC.player);
if (entityDistanceToPlayer < entityFound.squaredDistanceTo(MC.player) && entityDistanceToPlayer < radiusSqr) {
entityFound = entity;
}
}
Expand All @@ -125,20 +129,25 @@ public void OnUpdate(TickEvent event) {
if (entity instanceof ClientPlayerEntity)
continue;

if (entityFound == null) {
double entityDistanceToPlayer = entity.squaredDistanceTo(MC.player);
if(entityDistanceToPlayer >= radiusSqr)
continue;

if(entityFound == null)
entityFound = (LivingEntity)entity;
else if (entityDistanceToPlayer < entityFound.squaredDistanceTo(MC.player)) {
entityFound = (LivingEntity) entity;
} else {
if (entity.squaredDistanceTo(MC.player) < entityFound.squaredDistanceTo(MC.player)) {
entityFound = (LivingEntity) entity;
}
}
}
}
}

temp = entityFound;

currentTick = 0;
}else {
if(temp != null && temp.squaredDistanceTo(MC.player) >= radiusSqr) {
temp = null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,11 @@
import net.aoba.Aoba;
import net.aoba.event.events.TickEvent;
import net.aoba.event.listeners.TickListener;
import net.aoba.mixin.interfaces.IEntity;
import net.aoba.module.Module;
import net.aoba.settings.types.KeybindSetting;
import net.minecraft.client.util.InputUtil;
import net.minecraft.util.math.Vec3d;

public class NoSlowdown extends Module implements TickListener {

Expand Down Expand Up @@ -56,6 +58,7 @@ public void onToggle() {

@Override
public void OnUpdate(TickEvent event) {
//mc.player.setMotionMultiplier(null, Vec3d.ZERO);
IEntity playerEntity = (IEntity)MC.player;
playerEntity.setMovementMultiplier(Vec3d.ZERO);
}
}
3 changes: 2 additions & 1 deletion src/main/resources/aoba.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"interfaces.IMinecraftClient",
"interfaces.IExplosionS2CPacket",
"interfaces.IEntityVelocityUpdateS2CPacket",
"interfaces.IPlayerInteractEntityC2SPacket"
"interfaces.IPlayerInteractEntityC2SPacket",
"interfaces.IEntity"
],
"client": [
"AbstractBlockStateMixin",
Expand Down

0 comments on commit fcd5968

Please sign in to comment.