Skip to content

Commit

Permalink
Release 2.8.1 (#822)
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc authored Oct 16, 2024
1 parent 26f0c8a commit a776de4
Show file tree
Hide file tree
Showing 24 changed files with 514 additions and 71 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
package keystrokesmod.mixins.impl.entity;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.PotionEffect;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

import java.util.Map;

@Mixin(EntityLivingBase.class)
public interface EntityLivingBaseAccessor {

Expand All @@ -24,4 +27,13 @@ public interface EntityLivingBaseAccessor {

@Accessor("newPosRotationIncrements")
int getNewPosRotationIncrements();

@Accessor("activePotionsMap")
Map<Integer, PotionEffect> getActivePotionsMap();

@Accessor("activePotionsMap")
void setActivePotionsMap(Map<Integer, PotionEffect> map);

@Accessor("dead")
boolean isDead();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package keystrokesmod.mixins.impl.entity;


import net.minecraft.entity.player.EntityPlayer;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.gen.Accessor;

@Mixin(EntityPlayer.class)
public interface EntityPlayerAccessor {

@Accessor("itemInUseCount")
void setItemInUseCount(int count);
}
28 changes: 25 additions & 3 deletions src/main/java/keystrokesmod/module/impl/combat/KillAura.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public class KillAura extends IAutoClicker {
private final ModeSetting rotationMode;
private final ModeSetting moveFixMode;
private final ModeSetting rayCastMode;
private final SliderSetting rotationSpeed;
private final ButtonSetting nearest;
private final SliderSetting nearestAccuracy;
private final ButtonSetting lazy;
Expand All @@ -77,7 +78,14 @@ public class KillAura extends IAutoClicker {
private final SliderSetting noiseDelay;
private final ButtonSetting delayAim;
private final SliderSetting delayAimAmount;
private final SliderSetting rotationSpeed;
private final ButtonSetting scale;
private final SliderSetting scaleHorizontal;
private final SliderSetting scaleVertical;
private final SliderSetting scaleChance;
private final ButtonSetting offset;
private final SliderSetting offsetHorizontal;
private final SliderSetting offsetVertical;
private final ModeSetting offsetTiming;

private final ModeSetting sortMode;
private final SliderSetting switchDelay;
Expand Down Expand Up @@ -157,11 +165,19 @@ public KillAura() {
this.registerSetting(constantOnlyIfNotMoving = new ButtonSetting("Constant only if not moving", false, doRotation.extend(constant::isToggled)));
this.registerSetting(noise = new ButtonSetting("Noise", false, doRotation));
this.registerSetting(noiseHorizontal = new SliderSetting("Noise horizontal", 0.35, 0.01, 1, 0.01, doRotation.extend(noise::isToggled)));
this.registerSetting(noiseVertical = new SliderSetting("Noise vertical", 0.5, 0.01, 1, 0.01, doRotation.extend(noise::isToggled)));
this.registerSetting(noiseVertical = new SliderSetting("Noise vertical", 0.5, 0.01, 1.5, 0.01, doRotation.extend(noise::isToggled)));
this.registerSetting(noiseAimSpeed = new SliderSetting("Noise aim speed", 0.35, 0.01, 1, 0.01, doRotation.extend(noise::isToggled)));
this.registerSetting(noiseDelay = new SliderSetting("Noise delay", 100, 50, 500, 10, doRotation.extend(noise::isToggled)));
this.registerSetting(delayAim = new ButtonSetting("Delay aim", false, doRotation));
this.registerSetting(delayAimAmount = new SliderSetting("Delay aim amount", 5, 5, 100, 1, doRotation.extend(delayAim::isToggled)));
this.registerSetting(delayAimAmount = new SliderSetting("Delay aim amount", 5, 5, 150, 1, doRotation.extend(delayAim::isToggled)));
this.registerSetting(scale = new ButtonSetting("Scale", false, doRotation));
this.registerSetting(scaleHorizontal = new SliderSetting("Scale horizontal", 1, 0.5, 1.5, 0.1, doRotation.extend(scale::isToggled)));
this.registerSetting(scaleVertical = new SliderSetting("Scale vertical", 1, 0.5, 1.5, 0.1, doRotation.extend(scale::isToggled)));
this.registerSetting(scaleChance = new SliderSetting("Scale chance", 100, 0, 100, 1, "%", doRotation.extend(scale::isToggled)));
this.registerSetting(offset = new ButtonSetting("Offset", false, doRotation));
this.registerSetting(offsetHorizontal = new SliderSetting("Offset horizontal", 0, -1, 1, 0.05, doRotation.extend(offset::isToggled)));
this.registerSetting(offsetVertical = new SliderSetting("Offset vertical", -0.5, -1.5, 1, 0.05, doRotation.extend(offset::isToggled)));
this.registerSetting(offsetTiming = new ModeSetting("Offset timing", new String[]{"Pre", "Post"}, 0, doRotation.extend(offset::isToggled)));
this.registerSetting(new DescriptionSetting("Targets"));
String[] sortModes = new String[]{"Health", "HurtTime", "Distance", "Yaw"};
this.registerSetting(sortMode = new ModeSetting("Sort mode", sortModes, 0));
Expand Down Expand Up @@ -213,6 +229,12 @@ private float[] getRotations() {
new Pair<>((float) noiseHorizontal.getInput(), (float) noiseVertical.getInput()),
noiseAimSpeed.getInput(), (long) noiseDelay.getInput());
aimSimulator.setDelay(delayAim.isToggled(), (int) delayAimAmount.getInput());
if (scale.isToggled() && Math.random() > scaleChance.getInput()) {
aimSimulator.setScale(scale.isToggled(), scaleHorizontal.getInput(), scaleVertical.getInput());
} else {
aimSimulator.setScale(scale.isToggled(), 1, 1);
}
aimSimulator.setOffset(offset.isToggled(), offsetHorizontal.getInput(), offsetVertical.getInput(), offsetTiming.getInput() == 0);

if (constant.isToggled() && !noAimToEntity() && !(constantOnlyIfNotMoving.isToggled() && (MoveUtil.isMoving() || MoveUtil.isMoving(target))))
return rotations;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void guiUpdate() {

@SubscribeEvent
public void onPreMotion(PreMotionEvent event) {
if (!always && left ? !Mouse.isButtonDown(0) : !Mouse.isButtonDown(1))
if (!always && (left ? !Mouse.isButtonDown(0) : !Mouse.isButtonDown(1)))
return;

if (nextLength < 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public RecordAutoClicker(String name, @NotNull IAutoClicker parent, boolean left

@SubscribeEvent
public void onPreMotion(PreMotionEvent event) {
if (!always && left ? !Mouse.isButtonDown(0) : !Mouse.isButtonDown(1))
if (!always && (left ? !Mouse.isButtonDown(0) : !Mouse.isButtonDown(1)))
return;
if (System.currentTimeMillis() < RecordClick.getNextClickTime())
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class HypixelVelocity extends SubMode<Velocity> {
private final SliderSetting chance;
private final ButtonSetting cancelAir;
private final ButtonSetting damageBoost;
private final ButtonSetting damageBoostOnlyOnGround;
private final ButtonSetting onlyFirstHit;
private final SliderSetting resetTime;

Expand All @@ -38,6 +39,7 @@ public HypixelVelocity(String name, @NotNull Velocity parent) {
this.registerSetting(chance = new SliderSetting("Chance", 100, 0, 100, 1, "%"));
this.registerSetting(cancelAir = new ButtonSetting("Cancel air", false));
this.registerSetting(damageBoost = new ButtonSetting("Damage boost", false));
this.registerSetting(damageBoostOnlyOnGround = new ButtonSetting("Damage boost only on ground", false, damageBoost::isToggled));
this.registerSetting(onlyFirstHit = new ButtonSetting("Only first hit", false));
this.registerSetting(resetTime = new SliderSetting("Reset time", 5000, 500, 10000, 500, "ms", onlyFirstHit::isToggled));
}
Expand Down Expand Up @@ -71,7 +73,7 @@ public void onPreVelocity(@NotNull PreVelocityEvent event) {

mc.thePlayer.motionY = choose(mc.thePlayer.motionY, motionY);

if (damageBoost.isToggled()) {
if (damageBoost.isToggled() && !(!mc.thePlayer.onGround && damageBoostOnlyOnGround.isToggled())) {
MoveUtil.moveFlying(0.2);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ public void onUpdate() {
@Override
public void onDisable() {
isFinished = false;
offGroundTicks = 0;
ProgressManager.remove(progress);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class HypixelTestFly extends SubMode<Fly> {

public HypixelTestFly(String name, @NotNull Fly parent) {
super(name, parent);
this.registerSetting(speed = new SliderSetting("Speed", 1, 0.1, 2, 0.01));
this.registerSetting(speed = new SliderSetting("Speed", 0.1, 0.01, 0.5, 0.01));
this.registerSetting(packet = new ButtonSetting("Packet", false));
}

Expand All @@ -41,6 +41,7 @@ public void onPreMotion(PreMotionEvent event) {
PacketUtils.sendPacket(new C03PacketPlayer(true));
event.setPosZ(event.getPosZ() + Utils.randomizeDouble(0.09, 0.12)); // 0.095
}
event.setPosY(event.getPosY() + speed.getInput());

mc.thePlayer.motionY = 0.0;
MoveUtil.strafe(MoveUtil.isMoving() && active ? speed.getInput() / 10 : 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class HypixelBowLongJump extends SubMode<LongJump> {

public HypixelBowLongJump(String name, @NotNull LongJump parent) {
super(name, parent);
this.registerSetting(speed = new SliderSetting("Speed", 1, 0.5, 1.5, 0.1));
this.registerSetting(speed = new SliderSetting("Speed", 1, 0, 1.5, 0.1));
this.registerSetting(autoDisable = new ButtonSetting("Auto disable", true));
}

Expand Down Expand Up @@ -100,7 +100,8 @@ public void onPrePlayerInput(PrePlayerInputEvent event) {
}
break;
case BOOST:
MoveUtil.strafe(speed.getInput());
if (speed.getInput() > 0)
MoveUtil.strafe(speed.getInput());
state = State.NONE;
break;
case NONE:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public void onPrePlayerInput(PrePlayerInputEvent event) {
if (parent.parent.noAction()) return;

if (!Utils.jumpDown() && Utils.isMoving() && mc.currentScreen == null && mc.thePlayer.onGround) {
MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance());
MoveUtil.strafe(MoveUtil.getAllowedHorizontalDistance() - Math.random() / 100f);
mc.thePlayer.jump();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,6 @@ public void onMove(MoveEvent event) {
event.setY(mc.thePlayer.motionY = 0.4198479950428009);
MoveUtil.strafe(speed - randomAmount());
break;
case 1:
event.setY(Math.floor(mc.thePlayer.posY + 1.0) - mc.thePlayer.posY);
break;
case 5:
if (mc.thePlayer.isCollidedHorizontally || !BlockUtils.blockRelativeToPlayer(0, -1, 0).isFullCube())
return;
Expand Down
17 changes: 9 additions & 8 deletions src/main/java/keystrokesmod/module/impl/other/Anticheat.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import keystrokesmod.module.setting.impl.SliderSetting;
import lombok.Getter;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -49,6 +48,8 @@ public class Anticheat extends Module {
private static ButtonSetting movementCheck;
@Getter
private static ButtonSetting scaffoldingCheck;
@Getter
private static ButtonSetting simulationCheck;

private PlayerManager manager = new PlayerManager();
public Anticheat() {
Expand All @@ -64,18 +65,15 @@ public Anticheat() {
this.registerSetting(shouldPing = new ButtonSetting("Should ping", true));
this.registerSetting(pingSound = new ModeSetting("Ping sound", new String[]{"Note", "Augustus"}, 0, shouldPing::isToggled));
this.registerSetting(autoReport = new ModeSetting("Auto report", new String[]{"None", "/wdr", "/report"}, 0));
this.registerSetting(experimentalMode = new ButtonSetting("Experimental mode", true));
this.registerSetting(experimentalMode = new ButtonSetting("Experimental mode", false));
this.registerSetting(aimCheck = new ButtonSetting("Aim checks", true));
this.registerSetting(combatCheck = new ButtonSetting("Combat checks", true));
this.registerSetting(movementCheck = new ButtonSetting("Movement checks", true));
this.registerSetting(scaffoldingCheck = new ButtonSetting("Scaffolding checks", true));
this.registerSetting(simulationCheck = new ButtonSetting("Simulation checks", false));
}

public void onUpdate() {
if (mc.isSingleplayer()) {
return;
}

manager.update(Raven.mc);
}

Expand All @@ -87,8 +85,11 @@ public void onEntityJoin(@NotNull WorldChangeEvent e) {

@Override
public void onDisable() throws Throwable {
manager.dataMap.values().forEach(trPlayer -> trPlayer.manager.onCustomAction(MinecraftForge.EVENT_BUS::unregister));
manager = null;
//noinspection SynchronizeOnNonFinalField
synchronized (manager) {
manager.dataMap.values().forEach(trPlayer -> trPlayer.manager.onCustomAction(MinecraftForge.EVENT_BUS::unregister));
manager = null;
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import net.minecraftforge.common.MinecraftForge;
import org.jetbrains.annotations.NotNull;

import java.lang.ref.WeakReference;

public abstract class Check {
protected final @NotNull TRPlayer player;
public String checkName;
Expand All @@ -18,7 +20,7 @@ public Check(String checkName, @NotNull TRPlayer player) {
}

@Override
protected void finalize() throws Throwable {
protected void finalize() {
MinecraftForge.EVENT_BUS.unregister(this);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package keystrokesmod.module.impl.other.anticheats;

import keystrokesmod.module.impl.other.anticheats.checks.simulation.Simulation;
import keystrokesmod.module.impl.other.anticheats.utils.world.EntityUtils;
import keystrokesmod.module.impl.other.anticheats.checks.aim.*;
import keystrokesmod.module.impl.other.anticheats.checks.combat.*;
Expand Down Expand Up @@ -51,6 +52,7 @@ public CheckManager(@NotNull Map<Class<? extends Check>, Check> preChecks,
normal.put(ScaffoldB.class, new ScaffoldB(player));
normal.put(NoFallA.class, new NoFallA(player));
normal.put(AutoClickerA.class, new AutoClickerA(player));
// post.put(Simulation.class, new Simulation(player)); buggy

return new CheckManager(pre, normal, post, player);
}
Expand Down Expand Up @@ -89,7 +91,6 @@ public void onJump() {
}

public void onCustomAction(Consumer<Check> action) {
if (player == null) return;
for (Check check : preChecks.values()) action.accept(check);
for (Check check : normalChecks.values()) action.accept(check);
for (Check check : postChecks.values()) action.accept(check);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public class TRPlayer {

public PlayerData compatPlayerData = new PlayerData();

public @NotNull ScheduledExecutorService timeTask = Executors.newScheduledThreadPool(4);
public @NotNull ScheduledExecutorService timeTask = Executors.newScheduledThreadPool(1);
@Contract("_ -> new")
public static @NotNull TRPlayer create(@NotNull AbstractClientPlayer player) {
return new TRPlayer(player, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,18 @@
import keystrokesmod.module.impl.other.anticheats.Check;
import keystrokesmod.module.impl.other.anticheats.TRPlayer;
import keystrokesmod.module.impl.other.anticheats.config.AdvancedConfig;
import keystrokesmod.utility.RotationUtils;
import keystrokesmod.utility.Utils;
import net.minecraft.network.play.server.S0BPacketAnimation;
import net.minecraft.network.play.server.S14PacketEntity;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import org.jetbrains.annotations.NotNull;

import static keystrokesmod.Raven.mc;

public class AutoBlockA extends Check {
private boolean needToCheck = false;

public AutoBlockA(@NotNull TRPlayer player) {
super("AutoBlockA", player);
}
Expand All @@ -18,9 +25,20 @@ public AutoBlockA(@NotNull TRPlayer player) {
public void onReceivePacket(@NotNull ReceivePacketEvent event) {
if (event.getPacket() instanceof S0BPacketAnimation) {
if (((S0BPacketAnimation) event.getPacket()).getEntityID() == player.fabricPlayer.getEntityId()) {
if (player.fabricPlayer.isBlocking())
flag("Impossible hit.");
if (RotationUtils.rayCast(
Utils.getEyePos(player.fabricPlayer).toVec3(), 3,
player.fabricPlayer.rotationYaw, player.fabricPlayer.rotationPitch) == null
) {
needToCheck = false;
return;
}

needToCheck = true;
}
} else if (event.getPacket() instanceof S14PacketEntity) {
if (((S14PacketEntity) event.getPacket()).getEntity(mc.theWorld) == player.fabricPlayer
&& player.fabricPlayer.isBlocking() && needToCheck)
flag("Impossible hit.");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ public void onReceivePacket(@NotNull ReceivePacketEvent event) {

private void onClick() {
final long time = System.currentTimeMillis();
if (clicks.size() == 15) {
if (clicks.size() >= 15) {
final long lastClick = clicks.dequeueLong();
if (time - lastClick < 1000) {
flag(String.format("High cps: %.1f", (time - lastClick) / 1000.0 * 15));
final double lastCPS = (time - lastClick) / 1000.0 * 15;
if (time - lastClick < 1000 && lastCPS >= 15) {
flag(String.format("High cps: %.1f", lastCPS));
clicks.clear();
}
}
Expand Down
Loading

0 comments on commit a776de4

Please sign in to comment.