Skip to content

Commit

Permalink
Release 2.10.0
Browse files Browse the repository at this point in the history
- 新检查 AutoClickerA
- 新检查 HitBoxA
- 重写FlyA检查
- 移除FlyB检查,原FlyC被重命名为FlyB
- 改进MotionA检查
- 新模块 Velocity 反反击退
    - 增加你的击退!
- 新模块 NoStopBreak 保留挖掘进度
    - 你所熟知的一切都将改变,你所熟悉的世界都将加诸 ⌈永恒⌋ 的历练。
      至此,一锤定音。
      尘埃,已然落定。
- 改进Fly
- 修复AutoCatch的一个无限递归bug
  • Loading branch information
xia-mc committed May 27, 2024
1 parent 47b707f commit 833e962
Show file tree
Hide file tree
Showing 24 changed files with 356 additions and 208 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ minecraft_version=1.20.1
loader_version=0.14.23

# Mod Properties
mod_version = 2.9.4
mod_version = 2.10.0
maven_group = top.infsky
archives_base_name = CheatDetector

Expand Down
17 changes: 17 additions & 0 deletions src/main/java/top/infsky/cheatdetector/config/Advanced3Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,23 @@ public class Advanced3Config {
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int speedBoost = 2;

@Numeric(minValue = 1.0, maxValue = 4.0)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static double velocityHorizon = 2.0;
@Numeric(minValue = 1.0, maxValue = 3.0)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static double velocityVertical = 1.0;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean velocityReserve = false;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean velocityStrafe = false;
@Numeric(minValue = 1, maxValue = 10)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int velocityStrafeMinHurtTime = 7;

@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean noStopBreakSilent = false;

public static NotebotUtils.NotebotMode getNoteBotMode() {
if (noteBotMode.equals("AnyInstrument")) {
return NotebotUtils.NotebotMode.AnyInstrument;
Expand Down
58 changes: 20 additions & 38 deletions src/main/java/top/infsky/cheatdetector/config/AdvancedConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,28 +12,6 @@ public class AdvancedConfig {
@Config(category = ConfigCategory.ADVANCED)
public static double blinkMaxDistance = 8;


@Config(category = ConfigCategory.ADVANCED)
public static boolean flyACheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAlertBuffer = 20;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAOnGroundJumpTick = 1;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAInLiquidLiquidTick = 8;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAInHurtJumpTick = 6;
@Config(category = ConfigCategory.ADVANCED)
public static double flyAFromWaterYDistance = 0.5;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAOnTeleportDisableTick = 2;

@Config(category = ConfigCategory.ADVANCED)
public static boolean flyBCheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyBAlertBuffer = 1;


@Config(category = ConfigCategory.ADVANCED)
public static boolean gameModeACheck = true;
@Config(category = ConfigCategory.ADVANCED)
Expand Down Expand Up @@ -129,36 +107,40 @@ public class AdvancedConfig {
public static int motionAAlertBuffer = 10;

@Config(category = ConfigCategory.ADVANCED)
public static boolean flyCCheck = true;
public static boolean flyBCheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyCAlertBuffer = 10;
public static int flyBAlertBuffer = 10;

@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean reachACheck = true;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int reachAAlertBuffer = 2;
public static int reachAAlertBuffer = 4;
@Numeric(minValue = 0, maxValue = 6)
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double reachADefaultReach = 3.5;
@Numeric(minValue = 0, maxValue = 4)
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int reachACheckDelay = 2;

public static short getFlyAOnGroundJumpTick() {
return (short) flyAOnGroundJumpTick;
}

public static short getFlyAInLiquidLiquidTick() {
return (short) flyAInLiquidLiquidTick;
}
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean hitBoxACheck = true;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int hitBoxAAlertBuffer = 4;
@Numeric(minValue = 0, maxValue = 4)
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int hitBoxACheckDelay = 2;

public static short getFlyAInHurtJumpTick() {
return (short) flyAInHurtJumpTick;
}
@Config(category = ConfigCategory.ADVANCED)
public static boolean flyACheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyAAlertBuffer = 10;

public static short getFlyAOnTeleportDisableTick() {
return (short) flyAOnTeleportDisableTick;
}
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean autoClickerACheck = true;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int autoClickerAAlertBuffer = 10;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int autoClickerAMinDiffMs = 5;

public static short getNoSlowAInJumpDisableTick() {
return (short) noSlowAInJumpDisableTick;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,12 @@ public class ModuleConfig {
@Hotkey
@Config(category = ConfigCategory.MODULES, predicate = ConfigPredicate.PASMode.class)
public static boolean speedEnabled = false;

@Hotkey
@Config(category = ConfigCategory.MODULES, predicate = ConfigPredicate.PASMode.class)
public static boolean velocityEnabled = false;

@Hotkey
@Config(category = ConfigCategory.MODULES)
public static boolean noStopBreakEnabled = false;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package top.infsky.cheatdetector.impl.checks;

import io.netty.channel.ChannelHandlerContext;
import net.minecraft.network.Connection;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.game.ClientboundAnimatePacket;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.config.AntiCheatConfig;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.utils.TRPlayer;

public class AutoClickerA extends Check {
private long click1 = -1;
private long click2 = -1;
private long click3 = -1;
public AutoClickerA(@NotNull TRPlayer player) {
super("AutoClickerA", player);
}

@Override
public void _onTick() {
if (click2 == -1 || click1 == -1) return;

long delay1 = Math.abs(click2 - click1);
long delay2 = Math.abs(click3 - click2);

if (Math.abs(delay1 - delay2) < AdvancedConfig.autoClickerAMinDiffMs) {
flag("constant click delay: %s->%s".formatted(delay2, delay1));
}
}

@Override
public boolean _onPacketReceive(@NotNull Packet<ClientGamePacketListener> basePacket, Connection connection, ChannelHandlerContext channelHandlerContext, CallbackInfo ci) {
if (basePacket instanceof ClientboundAnimatePacket packet) {
if (packet.getId() != player.fabricPlayer.getId()) return false;
if (packet.getAction() != ClientboundAnimatePacket.SWING_MAIN_HAND && packet.getAction() != ClientboundAnimatePacket.SWING_OFF_HAND) return false;

click3 = click2;
click2 = click1;
click1 = System.currentTimeMillis();
}
return false;
}

@Override
public int getAlertBuffer() {
return AdvancedConfig.autoClickerAAlertBuffer;
}

@Override
public boolean isDisabled() {
return !AdvancedConfig.autoClickerACheck || !AntiCheatConfig.experimentalCheck;
}
}
76 changes: 4 additions & 72 deletions src/main/java/top/infsky/cheatdetector/impl/checks/FlyA.java
Original file line number Diff line number Diff line change
@@ -1,93 +1,25 @@
package top.infsky.cheatdetector.impl.checks;

import net.minecraft.world.item.TridentItem;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.utils.TRPlayer;
import top.infsky.cheatdetector.impl.utils.world.PlayerMove;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.config.AntiCheatConfig;

import java.util.List;

public class FlyA extends Check {
public short jumpTick = 0;
public short liquidTick = 0;
public short disableTick = 0;

public FlyA(@NotNull TRPlayer player) {
super("FlyA", player);
}

@Override
public void _onTick() {
if (isDisabled()) return;
if ((player.fabricPlayer.getMainHandItem().getItem() instanceof TridentItem
|| player.fabricPlayer.getOffhandItem().getItem() instanceof TridentItem) && player.fabricPlayer.isUsingItem()) return;
if (player.fabricPlayer.isPassenger()) return;
if (player.fabricPlayer.isFallFlying()) {
jumpTick = Short.MAX_VALUE;
return;
}

if (disableTick > 0) {
disableTick--;
return;
}

if (player.currentOnGround) {
jumpTick = AdvancedConfig.getFlyAOnGroundJumpTick(); // MC原版OnGround不可靠。方块边缘会误判。
}

// fix liquid
if (player.fabricPlayer.isInWater() || player.fabricPlayer.isInLava()) {
liquidTick = AdvancedConfig.getFlyAInLiquidLiquidTick();
}

// fix hurt
if (player.fabricPlayer.hurtTime > 0) {
jumpTick = AdvancedConfig.getFlyAInHurtJumpTick();
}


if (!player.currentOnGround && jumpTick > 0
&& player.currentPos.y() - player.lastOnGroundPos.y()
< PlayerMove.getJumpDistance(player.fabricPlayer) + AntiCheatConfig.threshold
// && player.currentPos.distanceTo(player.lastPos) < 5.612 *
// (1 + player.fabricPlayer.getSpeed()) + ModConfig.getThreshold() // 警惕跳跃弱检测
) {
jumpTick--;
} else if ((!player.fabricPlayer.isInWater() || !player.fabricPlayer.isInLava()) && liquidTick > 0
&& player.currentPos.y() - player.lastInLiquidPos.y()
< AdvancedConfig.flyAFromWaterYDistance + AntiCheatConfig.threshold // 瞎写的0.5 (getFlightAFromWaterYDistance)
// && (lastPos.y() - lastPos2.y() + ModConfig.getThreshold()) > (player.position().y() - lastPos.y()) // 警惕出水弱检测
) {
liquidTick--;
} else if (player.posHistory.get(1) != null && !player.currentOnGround && (!player.fabricPlayer.isInWater() && !player.fabricPlayer.isInLava())) {
jumpTick = 0;
liquidTick = 0;
if (player.lastPos.y() - player.currentPos.y() < AntiCheatConfig.threshold &&
player.posHistory.get(1).y() - player.lastPos.y() <= AntiCheatConfig.threshold) {
flag();
}
if (player.lastMotion.y() == 0 && player.currentMotion.y() == 0) {
flag("Invalid Y-axis motion.");
}
}

@Override
public void _onTeleport() {
disableTick = AdvancedConfig.getFlyAOnTeleportDisableTick();
}

@Override
public void _onJump() {
List<Double> motions = MotionA.getPossibleMotions(player);

jumpTick = motions != null ? (short) (motions.size() + 1) : Short.MAX_VALUE;
}

@Override
public int getAlertBuffer() {
return AdvancedConfig.flyAlertBuffer;
return AdvancedConfig.flyAAlertBuffer;
}

@Override
Expand Down
16 changes: 3 additions & 13 deletions src/main/java/top/infsky/cheatdetector/impl/checks/FlyB.java
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
package top.infsky.cheatdetector.impl.checks;

import net.minecraft.world.entity.player.Abilities;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.impl.Check;
import top.infsky.cheatdetector.utils.TRPlayer;
import top.infsky.cheatdetector.config.AdvancedConfig;


public class FlyB extends Check {
public boolean hasFlag = false;

public FlyB(@NotNull TRPlayer player) {
super("FlyB", player);
}

@Override
public void _onTick() {
Abilities abilities = player.fabricPlayer.getAbilities();
if (abilities.mayfly || abilities.flying) {
if (!hasFlag) {
flag(String.format("mayfly: %s flying: %s", abilities.mayfly, abilities.flying));
hasFlag = true;
}
} else {
hasFlag = false;
if (player.fabricPlayer.isSwimming() && !player.fabricPlayer.isInWater()) {
flag();
}
}

Expand Down
29 changes: 0 additions & 29 deletions src/main/java/top/infsky/cheatdetector/impl/checks/FlyC.java

This file was deleted.

Loading

0 comments on commit 833e962

Please sign in to comment.