Skip to content

Commit

Permalink
aura update
Browse files Browse the repository at this point in the history
  • Loading branch information
K-ov committed Oct 8, 2022
1 parent a5707ac commit 1661645
Show file tree
Hide file tree
Showing 15 changed files with 87 additions and 34 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified build/libs/[1.8.9] BetterKeystrokes V-1.2-sources.jar
Binary file not shown.
Binary file modified build/libs/[1.8.9] BetterKeystrokes V-1.2.jar
Binary file not shown.
Binary file modified src/.DS_Store
Binary file not shown.
Binary file modified src/main/.DS_Store
Binary file not shown.
Binary file modified src/main/java/.DS_Store
Binary file not shown.
Binary file modified src/main/java/keystrokesmod/.DS_Store
Binary file not shown.
Binary file modified src/main/java/keystrokesmod/client/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
@Mixin(EntityLivingBase.class)
public abstract class MxinEntityLivingBase extends Entity {

public MxinEntityLivingBase(World worldIn) {
super(worldIn);
}

@Shadow
public float rotationYawHead;

@Shadow
public float prevRotationYawHead;

public MxinEntityLivingBase(World worldIn) {
super(worldIn);
}

/**
* @author mc code
* @reason lookevent
*/
/**
* @author mc code
* @reason lookevent
*/
@Override
@Overwrite
public Vec3 getLook(float partialTicks)
Expand Down
Binary file modified src/main/java/keystrokesmod/client/module/.DS_Store
Binary file not shown.
Binary file modified src/main/java/keystrokesmod/client/module/modules/.DS_Store
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package keystrokesmod.client.module.modules.combat;

import java.awt.Color;
import java.util.Comparator;
import java.util.List;

import org.lwjgl.input.Mouse;

Expand All @@ -13,11 +15,14 @@
import keystrokesmod.client.event.impl.UpdateEvent;
import keystrokesmod.client.module.Module;
import keystrokesmod.client.module.modules.world.AntiBot;
import keystrokesmod.client.module.setting.impl.ComboSetting;
import keystrokesmod.client.module.setting.impl.DoubleSliderSetting;
import keystrokesmod.client.module.setting.impl.SliderSetting;
import keystrokesmod.client.module.setting.impl.TickSetting;
import keystrokesmod.client.utils.CoolDown;
import keystrokesmod.client.utils.Utils;
import keystrokesmod.client.utils.Utils.Player;
import keystrokesmod.client.utils.collection.SortValue;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
Expand All @@ -35,7 +40,9 @@ public class LegitAura2 extends Module {
private EntityPlayer target;
private SliderSetting rotationDistance, fov, reach;
private DoubleSliderSetting cps;
private TickSetting disableOnTp, disableWhenFlying, mouseDown, onlySurvival, raytrace;
private TickSetting disableOnTp, disableWhenFlying, mouseDown, onlySurvival;
private List<EntityPlayer> pTargets;
private ComboSetting sortMode;
private CoolDown coolDown = new CoolDown(1);
private boolean leftDown, leftn;
private long leftDownTime, leftUpTime, leftk, leftl;
Expand All @@ -52,6 +59,7 @@ public LegitAura2() {
this.registerSetting(disableOnTp = new TickSetting("Disable after tp", true));
this.registerSetting(disableWhenFlying = new TickSetting("Disable when flying", true));
this.registerSetting(mouseDown = new TickSetting("Mouse Down", true));
this.registerSetting(sortMode = new ComboSetting("Sort mode", SortMode.Distance));
}

@Subscribe
Expand All @@ -61,17 +69,18 @@ public void onUpdate(UpdateEvent e) {
return;
}
Mouse.poll();
EntityPlayer pTarget = Utils.Player.getClosestPlayer((float) rotationDistance.getInput());
//Utils.Player.sendMessageToSelf(!(!mouseDown.isToggled() || Mouse.isButtonDown(0)) + "");
pTargets = Utils.Player.getClosePlayers((float) rotationDistance.getInput());
pTargets.removeIf(player -> !(isValidTarget(player)));
SortMode sm = (SortMode) sortMode.getMode();
EntityPlayer pTarget = pTargets.isEmpty() ? null : pTargets.stream().min(Comparator.comparingDouble(target -> sm.sv.value(target))).get();
pTargets.remove(pTarget);
if(
(pTarget == null)
|| AntiBot.bot(pTarget)
|| (mc.currentScreen != null)
(pTarget == null)
|| (mc.currentScreen != null)
|| !(!onlySurvival.isToggled() || (mc.playerController.getCurrentGameType() == GameType.SURVIVAL))
|| !coolDown.hasFinished()
|| !(!mouseDown.isToggled() || Mouse.isButtonDown(0))
|| !(!disableWhenFlying.isToggled() || !mc.thePlayer.capabilities.isFlying)
|| !Utils.Player.fov(pTarget, (float) fov.getInput())) {
|| !(!disableWhenFlying.isToggled() || !mc.thePlayer.capabilities.isFlying)) {
target = null;
prevYaw = yaw;
prevPitch = pitch;
Expand Down Expand Up @@ -99,27 +108,25 @@ public void renderWorldLast(ForgeEvent fe) {
int rgb = new Color(red, green, 0).getRGB();
Utils.HUD.drawBoxAroundEntity(target, 2, 0, 0, rgb, false);
}
for(EntityPlayer p : pTargets)
Utils.HUD.drawBoxAroundEntity(p, 2, 0, 0, 0xFF0000FF, false);
}

@Subscribe
public void packetEvent(PacketEvent e) {
if((e.getPacket() instanceof S08PacketPlayerPosLook) && mouseDown.isToggled() && (coolDown.getTimeLeft() < 2000)) {
if((e.getPacket() instanceof S08PacketPlayerPosLook) && disableOnTp.isToggled() && (coolDown.getTimeLeft() < 2000)) {
coolDown.setCooldown(2000);
coolDown.start();
}
}

@Subscribe
public void move(MoveInputEvent e) {
if(target == null)
return;
e.setYaw(yaw);
}

@Subscribe
public void lookEvent(LookEvent e) {
if(target == null)
return;
e.setPrevYaw(prevYaw);
e.setPrevPitch(prevPitch);
e.setYaw(yaw);
Expand Down Expand Up @@ -179,4 +186,32 @@ public void genLeftTimings() {
this.leftUpTime = System.currentTimeMillis() + delay;
this.leftDownTime = (System.currentTimeMillis() + (delay / 2L)) - Utils.Java.rand().nextInt(10);
}

public double getReach() {
return reach.getInput();
}

private boolean isValidTarget(EntityPlayer ep) {
return (
(ep != null)
&& !AntiBot.bot(ep)
&& (ep != mc.thePlayer)
&& Utils.Player.fov(ep, (float) fov.getInput()));
}

public enum SortMode {
Distance(player -> mc.thePlayer.getDistanceToEntity(player)),
Hurttime(player -> (float) player.hurtTime),
Fov(Player::fovToEntity);

private final SortValue sv;

private SortMode(SortValue sv) {
this.sv = sv;
}

public SortValue getSortValue() {
return sv;
}
}
}
22 changes: 10 additions & 12 deletions src/main/java/keystrokesmod/client/module/modules/combat/Reach.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package keystrokesmod.client.module.modules.combat;

import keystrokesmod.client.main.Raven;
import keystrokesmod.client.module.Module;
import keystrokesmod.client.module.setting.impl.DoubleSliderSetting;
import keystrokesmod.client.module.setting.impl.TickSetting;
Expand All @@ -10,7 +11,7 @@ public class Reach extends Module {
public static TickSetting weapon_only;
public static TickSetting moving_only;
public static TickSetting sprint_only;
// public static LegitAura2 la;
public static LegitAura2 la;

public Reach() {
super("Reach", ModuleCategory.combat);
Expand All @@ -19,31 +20,28 @@ public Reach() {
this.registerSetting(moving_only = new TickSetting("Moving only", false));
this.registerSetting(sprint_only = new TickSetting("Sprint only", false));
}

@Override
public void postApplyConfig() {
// la = (LegitAura2) Raven.moduleManager.getModuleByClazz(LegitAura2.class);
la = (LegitAura2) Raven.moduleManager.getModuleByClazz(LegitAura2.class);
}

public static double getReach() {
//if(la.isEnabled())
// return Utils.Client.ranModuleVal(la.reach, Utils.Java.rand());
if(la.isEnabled())
return la.getReach();

double normal = mc.playerController.extendedReach()? 5 : 3;

if (!Utils.Player.isPlayerInGame())
return normal;

if (weapon_only.isToggled() && !Utils.Player.isPlayerHoldingWeapon())
if (!Utils.Player.isPlayerInGame() || (weapon_only.isToggled() && !Utils.Player.isPlayerHoldingWeapon()))
return normal;

if (moving_only.isToggled() && (double) mc.thePlayer.moveForward == 0.0D
&& (double) mc.thePlayer.moveStrafing == 0.0D)
if (moving_only.isToggled() && ((double) mc.thePlayer.moveForward == 0.0D)
&& ((double) mc.thePlayer.moveStrafing == 0.0D))
return normal;

if (sprint_only.isToggled() && !mc.thePlayer.isSprinting())
return normal;

return Utils.Client.ranModuleVal(reach, Utils.Java.rand()) + (mc.playerController.extendedReach()? 2 : 0);
}
}
14 changes: 13 additions & 1 deletion src/main/java/keystrokesmod/client/utils/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ public static EntityPlayer getClosestPlayer(double dis) {
if (mc.theWorld == null)
return null;
Iterator entities;
entities = mc.theWorld.loadedEntityList.iterator();
entities = mc.theWorld.playerEntities.iterator();
EntityPlayer cplayer = null;

while (entities.hasNext()) {
Expand All @@ -466,6 +466,18 @@ public static EntityPlayer getClosestPlayer(double dis) {

return cplayer;
}

public static List<EntityPlayer> getClosePlayers(double dis) {
if (mc.theWorld == null)
return null;
List<EntityPlayer> players = new ArrayList<>();

for(EntityPlayer player : mc.theWorld.playerEntities)
if(mc.thePlayer.getDistanceToEntity(player) < dis)
players.add(player);

return players;
}
}

public static class Client {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package keystrokesmod.client.utils.collection;

import net.minecraft.entity.player.EntityPlayer;

@FunctionalInterface
public interface SortValue {
Float value(EntityPlayer player);
}

0 comments on commit 1661645

Please sign in to comment.