Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
improve anticheat autoreport
Browse files Browse the repository at this point in the history
improve settings
add notwhilescaffold to delayremover
improve scaffold
  • Loading branch information
xia-mc committed Jul 8, 2024
1 parent 211b086 commit 7c9829e
Show file tree
Hide file tree
Showing 9 changed files with 68 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/main/java/keystrokesmod/module/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public void registerSetting(Setting setting) {
this.settings.add(setting);
}

public void registerSetting(Setting @NotNull ... setting) {
public void registerSetting(Setting @NotNull ... setting) {
for (Setting set : setting) {
registerSetting(set);
}
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/keystrokesmod/module/ModuleManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ public void register() {
this.addModule(new AutoPot());
this.addModule(modSpoofer = new ModSpoofer());
antiBot.enable();
commandChat.enable();
modSpoofer.enable();
modules.sort(Comparator.comparing(Module::getPrettyName));
}

Expand Down
7 changes: 4 additions & 3 deletions src/main/java/keystrokesmod/module/impl/other/Anticheat.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import keystrokesmod.module.impl.other.anticheats.PlayerManager;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.DescriptionSetting;
import keystrokesmod.module.setting.impl.ModeSetting;
import keystrokesmod.module.setting.impl.SliderSetting;
import net.minecraftforge.event.entity.EntityJoinWorldEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
Expand All @@ -23,7 +24,7 @@ public class Anticheat extends Module {
private static SliderSetting vlClearTime;
private static ButtonSetting noAlertBuffer;
private static ButtonSetting shouldPing;
private static ButtonSetting autoReport;
private static ModeSetting autoReport;
private static ButtonSetting experimentalMode;
private static ButtonSetting aimCheck;
private static ButtonSetting combatCheck;
Expand All @@ -42,7 +43,7 @@ public Anticheat() {
this.registerSetting(vlClearTime = new SliderSetting("VL clear time", 6000, -1, 12000, 1, "ticks"));
this.registerSetting(noAlertBuffer = new ButtonSetting("Remove alert buffer", false));
this.registerSetting(shouldPing = new ButtonSetting("Should ping", true));
this.registerSetting(autoReport = new ButtonSetting("Auto report", false));
this.registerSetting(autoReport = new ModeSetting("Auto report", new String[]{"None", "/wdr", "/report"}, 0));
this.registerSetting(experimentalMode = new ButtonSetting("Experimental mode", true));
this.registerSetting(aimCheck = new ButtonSetting("Aim checks", true));
this.registerSetting(combatCheck = new ButtonSetting("Combat checks", true));
Expand Down Expand Up @@ -82,7 +83,7 @@ public static ButtonSetting getShouldPing() {
return shouldPing;
}

public static ButtonSetting getAutoReport() {
public static ModeSetting getAutoReport() {
return autoReport;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@ public static void alert(String player, String module, String extraMsg) {
if (Anticheat.getShouldPing().isToggled()) {
Raven.mc.thePlayer.playSound("note.pling", 1.0f, 1.0f);
}
if (Anticheat.getAutoReport().isToggled()) {
Raven.mc.thePlayer.sendChatMessage("/wdr " + Utils.stripColor(player));
if (Anticheat.getAutoReport().getInput() != 0) {
Raven.mc.thePlayer.sendChatMessage(
Anticheat.getAutoReport().getOptions()[(int) Anticheat.getAutoReport().getInput()]
+ " "
+ Utils.stripColor(player)
);
}
}
}
Expand Down
19 changes: 11 additions & 8 deletions src/main/java/keystrokesmod/module/impl/player/DelayRemover.java
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
package keystrokesmod.module.impl.player;

import keystrokesmod.module.Module;
import keystrokesmod.module.ModuleManager;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.utility.Reflection;
import keystrokesmod.utility.Utils;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.jetbrains.annotations.NotNull;

public class DelayRemover extends Module { // from b4 src
public static ButtonSetting oldReg, removeJumpTicks;
private final ButtonSetting oldReg;
private final ButtonSetting removeJumpTicks;
private final ButtonSetting notWhileScaffold;

public DelayRemover() {
super("Delay Remover", category.player, 0);
this.registerSetting(oldReg = new ButtonSetting("1.7 hitreg", true));
this.registerSetting(oldReg = new ButtonSetting("1.7 hitReg", true));
this.registerSetting(removeJumpTicks = new ButtonSetting("Remove jump ticks", false));
this.registerSetting(notWhileScaffold = new ButtonSetting("Not while scaffold", false, removeJumpTicks::isToggled));
}

@SubscribeEvent
public void onTick(final TickEvent.PlayerTickEvent event) {
public void onTick(final TickEvent.@NotNull PlayerTickEvent event) {
if (event.phase != TickEvent.Phase.END || !mc.inGameHasFocus || !Utils.nullCheck()) {
return;
}
if (oldReg.isToggled()) {
try {
Reflection.leftClickCounter.set(mc, 0);
} catch (IllegalAccessException ex) {
} catch (IndexOutOfBoundsException ex2) {
} catch (IllegalAccessException | IndexOutOfBoundsException ignored) {
}
}
if (removeJumpTicks.isToggled()) {
if (removeJumpTicks.isToggled() && (!notWhileScaffold.isToggled() || !ModuleManager.scaffold.isEnabled())) {
try {
Reflection.jumpTicks.set(mc.thePlayer, 0);
} catch (IllegalAccessException ex3) {
} catch (IndexOutOfBoundsException ex4) {
} catch (IllegalAccessException | IndexOutOfBoundsException ignored) {
}
}
}
Expand Down
51 changes: 26 additions & 25 deletions src/main/java/keystrokesmod/module/impl/world/Scaffold.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package keystrokesmod.module.impl.world;

import keystrokesmod.event.JumpEvent;
import keystrokesmod.event.PreMotionEvent;
import keystrokesmod.event.PreUpdateEvent;
import keystrokesmod.event.RotationEvent;
import keystrokesmod.module.Module;
import keystrokesmod.module.impl.other.RotationHandler;
import keystrokesmod.module.impl.render.HUD;
import keystrokesmod.module.setting.impl.ButtonSetting;
import keystrokesmod.module.setting.impl.ModeSetting;
Expand Down Expand Up @@ -37,6 +39,7 @@ public class Scaffold extends Module { // from b4 :)
private final ModeSetting rotation;
private final SliderSetting strafe;
private final ModeSetting fastScaffold;
private final ButtonSetting cancelSprint;
private final ModeSetting precision;
private final ButtonSetting autoSwap;
private final ButtonSetting fastOnRMB;
Expand All @@ -48,13 +51,12 @@ public class Scaffold extends Module { // from b4 :)
private final ButtonSetting silentSwing;
public final ButtonSetting tower;
public final ButtonSetting fast;
public final ButtonSetting onlyOffGround;
public final ButtonSetting sameY;

protected MovingObjectPosition placeBlock;
private int lastSlot;
private static final String[] rotationModes = new String[]{"None", "Backwards", "Strict", "Precise", "Telly"};
private static final String[] fastScaffoldModes = new String[]{"Disabled", "Sprint", "Edge", "Jump A", "Jump B", "Jump C", "Float"};
private static final String[] fastScaffoldModes = new String[]{"Disabled", "Sprint", "Edge", "Jump A", "Jump B", "Jump C", "Float", "Side", "Legit"};
private static final String[] precisionModes = new String[]{"Very low", "Low", "Moderate", "High", "Very high"};
public float placeYaw;
public float placePitch;
Expand All @@ -78,6 +80,7 @@ public Scaffold() {
this.registerSetting(rotation = new ModeSetting("Rotation", rotationModes, 1));
this.registerSetting(strafe = new SliderSetting("Strafe", 0, -45, 45, 5));
this.registerSetting(fastScaffold = new ModeSetting("Fast scaffold", fastScaffoldModes, 0));
this.registerSetting(cancelSprint = new ButtonSetting("Cancel sprint", false, () -> fastScaffold.getInput() != 0));
this.registerSetting(precision = new ModeSetting("Precision", precisionModes, 4));
this.registerSetting(autoSwap = new ButtonSetting("AutoSwap", true));
this.registerSetting(delayOnJump = new ButtonSetting("Delay on jump", true));
Expand All @@ -89,8 +92,7 @@ public Scaffold() {
this.registerSetting(silentSwing = new ButtonSetting("Silent swing", false));
this.registerSetting(tower = new ButtonSetting("Tower", false));
this.registerSetting(fast = new ButtonSetting("Fast", false));
this.registerSetting(onlyOffGround = new ButtonSetting("Only offGround", false));
this.registerSetting(sameY = new ButtonSetting("SameY", false, new ModeOnly(fastScaffold, 3, 4, 5)));
this.registerSetting(sameY = new ButtonSetting("SameY", false));
}

public void onDisable() {
Expand Down Expand Up @@ -119,7 +121,7 @@ public void onEnable() {
}

@SubscribeEvent
public void onPreMotion(RotationEvent event) {
public void onRotation(RotationEvent event) {
if (!Utils.nullCheck()) {
return;
}
Expand All @@ -141,12 +143,10 @@ public void onPreMotion(RotationEvent event) {
event.setPitch(placePitch);
break;
case 4:
if (offGroundTicks >= 3 && placeBlock != null) {
if (!overBlock(new float[]{event.getYaw(), event.getPitch()}, placeBlock.getBlockPos())) {
telly$noBlockPlace = true;
event.setYaw(event.getYaw());
event.setPitch(event.getPitch());
}
if (offGroundTicks >= 3 && offGroundTicks < 8 && placeBlock != null && MoveUtil.isMoving()) {
telly$noBlockPlace = true;
event.setYaw(event.getYaw());
event.setPitch(event.getPitch());
} else {
event.setYaw(placeYaw);
event.setPitch(placePitch);
Expand All @@ -157,15 +157,11 @@ public void onPreMotion(RotationEvent event) {
place = true;
}

public static boolean overBlock(final float @NotNull [] rotation, final BlockPos pos) {
final MovingObjectPosition movingObjectPosition = RotationUtils.rayTraceCustom(4.5f, rotation[0], rotation[1]);

if (movingObjectPosition == null) return false;

final Vec3 hitVec = movingObjectPosition.hitVec;
if (hitVec == null) return false;

return movingObjectPosition.getBlockPos().equals(pos);
@SubscribeEvent
public void onPreMotion(PreMotionEvent event) {
if (cancelSprint.isToggled()) {
event.setSprinting(false);
}
}

@SubscribeEvent
Expand All @@ -180,7 +176,9 @@ public void onPreUpdate(PreUpdateEvent e) { // place here
} else {
offGroundTicks++;
}
if (onlyOffGround.isToggled() && mc.thePlayer.onGround) return;
if (rotation.getInput() == 4 && mc.thePlayer.onGround && MoveUtil.isMoving()) {
mc.thePlayer.jump();
}

if (fast.isToggled() && mc.gameSettings.keyBindJump.isKeyDown()) {
if (mc.gameSettings.keyBindForward.isKeyDown() && mc.thePlayer.onGround) {
Expand All @@ -192,8 +190,7 @@ public void onPreUpdate(PreUpdateEvent e) { // place here
}
}

if (sameY.isToggled() && (fastScaffold.getInput() == 3 || fastScaffold.getInput() == 4 || fastScaffold.getInput() == 5)
&& sameY$bridged != 0 && sameY$bridged % 2 == 0 && placeBlock != null && !Utils.jumpDown()) {
if (fastScaffold.getInput() == 6 && sameY$bridged != 0 && sameY$bridged % 2 == 0 && placeBlock != null && !Utils.jumpDown()) {
List<BlockPos> possible = new ArrayList<>(Arrays.asList(
placeBlock.getBlockPos().west(),
placeBlock.getBlockPos().east(),
Expand Down Expand Up @@ -236,7 +233,7 @@ else if (!keepYPosition()) {
down = false;
placedUp = false;
}
if (keepYPosition() && (fastScaffold.getInput() == 3 || fastScaffold.getInput() == 4 || fastScaffold.getInput() == 5) && mc.thePlayer.onGround && !sameY.isToggled()) {
if (keepYPosition() && (fastScaffold.getInput() == 3 || fastScaffold.getInput() == 4 || fastScaffold.getInput() == 5) && mc.thePlayer.onGround) {
mc.thePlayer.jump();
add = 0;
if (Math.floor(mc.thePlayer.posY) == Math.floor(startPos) && fastScaffold.getInput() == 5) {
Expand Down Expand Up @@ -493,6 +490,7 @@ public boolean sprint() {
if (this.isEnabled() && fastScaffold.getInput() > 0 && placeBlock != null && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1))) {
switch ((int) fastScaffold.getInput()) {
case 1:
case 7:
return true;
case 2:
return Utils.onEdge();
Expand All @@ -501,6 +499,8 @@ public boolean sprint() {
case 5:
case 6:
return keepYPosition();
case 8:
return Math.abs(MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - MathHelper.wrapAngleTo180_float(RotationHandler.getRotationYaw())) <= 90;
}
}
return false;
Expand All @@ -511,7 +511,8 @@ private boolean forceStrict(float value) {
}

private boolean keepYPosition() {
return this.isEnabled() && Utils.keysDown() && (fastScaffold.getInput() == 4 || fastScaffold.getInput() == 3 || fastScaffold.getInput() == 5 || fastScaffold.getInput() == 6) && (!Utils.jumpDown() || fastScaffold.getInput() == 6) && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1));
boolean sameYSca = fastScaffold.getInput() == 4 || fastScaffold.getInput() == 3 || fastScaffold.getInput() == 5 || fastScaffold.getInput() == 6;
return this.isEnabled() && Utils.keysDown() && (sameYSca || sameY.isToggled()) && (!Utils.jumpDown() || fastScaffold.getInput() == 6) && (!fastOnRMB.isToggled() || Mouse.isButtonDown(1));
}

public boolean safewalk() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keystrokesmod.module.setting.impl;

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import keystrokesmod.module.setting.Setting;
import org.jetbrains.annotations.NotNull;

Expand Down Expand Up @@ -68,8 +69,11 @@ public void setEnabled(boolean b) {
@Override
public void loadProfile(JsonObject data) {
if (data.has(getName()) && data.get(getName()).isJsonPrimitive() && !this.isMethodButton) {
boolean booleanValue = data.getAsJsonPrimitive(getName()).getAsBoolean();
setEnabled(booleanValue);
JsonPrimitive jsonPrimitive = data.getAsJsonPrimitive(getName());
if (jsonPrimitive.isBoolean()) {
boolean booleanValue = jsonPrimitive.getAsBoolean();
setEnabled(booleanValue);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keystrokesmod.module.setting.impl;

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import keystrokesmod.module.setting.Setting;
import keystrokesmod.module.setting.interfaces.InputSetting;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -86,7 +87,11 @@ public static double correctValue(double v, double i, double a) {
@Override
public void loadProfile(@NotNull JsonObject data) {
if (data.has(getName()) && data.get(getName()).isJsonPrimitive()) {
setValue((int) data.getAsJsonPrimitive(getName()).getAsDouble());
JsonPrimitive jsonPrimitive = data.getAsJsonPrimitive(getName());
if (jsonPrimitive.isNumber()) {
int newValue = jsonPrimitive.getAsInt();
setValue(newValue);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package keystrokesmod.module.setting.impl;

import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import keystrokesmod.module.setting.Setting;
import keystrokesmod.module.setting.interfaces.InputSetting;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -121,8 +122,11 @@ public static double roundToInterval(double v, int p) {
@Override
public void loadProfile(JsonObject data) {
if (data.has(getName()) && data.get(getName()).isJsonPrimitive()) {
double newValue = data.getAsJsonPrimitive(getName()).getAsDouble();
setValue(newValue);
JsonPrimitive jsonPrimitive = data.getAsJsonPrimitive(getName());
if (jsonPrimitive.isNumber()) {
double newValue = jsonPrimitive.getAsDouble();
setValue(newValue);
}
}
}
}

0 comments on commit 7c9829e

Please sign in to comment.