Skip to content

Commit

Permalink
Release 2.7.2
Browse files Browse the repository at this point in the history
- 新模块 AirStuck 卡在空中
    - 使你卡在空中。
    - 感谢 @CCBlueX。
- 新模块 NoFall 减小摔落伤害
    - 仅PAS模式
    - 绕过latest vulcan
    - 感谢 @CCBlueX。
- 新模块 ClientSpoof 客户端伪装
    - 伪装你的客户端类型
- 改进MotionA检查,现在MotionA不再是实验性检查。
- 修复AntiFall的一个鞘翅bug
- 修复一个崩端bug
- 细微调整
  • Loading branch information
xia-mc committed May 16, 2024
1 parent fb24bd2 commit 189612b
Show file tree
Hide file tree
Showing 26 changed files with 451 additions and 72 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.7.0
mod_version = 2.7.2
maven_group = top.infsky
archives_base_name = CheatDetector

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package top.infsky.cheatdetector.config;

import top.hendrixshen.magiclib.dependency.api.annotation.Dependencies;
import top.hendrixshen.magiclib.dependency.api.annotation.Dependency;

import top.hendrixshen.magiclib.malilib.api.annotation.Config;
import top.infsky.cheatdetector.config.utils.ConfigCategory;
import top.infsky.cheatdetector.config.utils.ConfigPredicate;

public class Advanced2Config {
@Config(category = ConfigCategory.ADVANCED2)
Expand Down
36 changes: 34 additions & 2 deletions src/main/java/top/infsky/cheatdetector/config/Advanced3Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import top.infsky.cheatdetector.config.utils.ConfigCategory;

public class Advanced3Config {
@Config(category = ConfigCategory.ADVANCED3)
public static int flagDetectorAlertBuffer = 1;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3)
public static int flagDetectorWorldChangedDisableTick = 60;
@Config(category = ConfigCategory.ADVANCED3)
Expand All @@ -26,14 +25,17 @@ public class Advanced3Config {
@Numeric(minValue = -180, maxValue = 180)
@Config(category = ConfigCategory.ADVANCED3)
public static double spinDefaultPitch = -90;
@Numeric(minValue = 0, maxValue = 360)
@Config(category = ConfigCategory.ADVANCED3)
public static double spinYawStep = 45;
@Numeric(minValue = 0, maxValue = 180)
@Config(category = ConfigCategory.ADVANCED3)
public static double spinPitchStep = 35;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean spinOnlyPacket = false;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean spinAutoPause = false;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3)
public static int spinAutoPauseTime = 10;

Expand Down Expand Up @@ -68,18 +70,23 @@ public class Advanced3Config {
public static int fakelagDelayMs = 100;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagLatencyMode.class)
public static boolean fakelagShowCount = false;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static double fakelagMaxTargetRange = 15.0;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static double fakelagStartRange = 6.0;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static double fakelagStopRange = 1.0;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static int fakelagMaxLagTicks = 100;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static boolean fakelagOnlyOutgoing = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static boolean fakelagStopOnHurt = true;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
public static int fakelagPauseTicksOnHurt = 10;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.FakelagDynamicMode.class)
Expand All @@ -89,6 +96,7 @@ public class Advanced3Config {
public static boolean fakelagAutoDisable = false;


@Numeric(minValue = 0, maxValue = 8)
@Config(category = ConfigCategory.ADVANCED3)
public static double airPlaceReach = 4.5;
@Config(category = ConfigCategory.ADVANCED3)
Expand All @@ -103,6 +111,7 @@ public class Advanced3Config {

@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean backtrackShowCount = false;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int backtrackDelayMs = 100;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
Expand Down Expand Up @@ -153,6 +162,7 @@ public class Advanced3Config {
public static boolean scaffoldAutoSwitch = false;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean scaffoldSameY = false;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int scaffoldPlaceMinDelay = 1;

Expand Down Expand Up @@ -205,6 +215,7 @@ public class Advanced3Config {

@Config(category = ConfigCategory.ADVANCED3)
public static boolean handSpinPerfectSwing = false;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3)
public static int handSpinSwingDelay = 0;
@Config(category = ConfigCategory.ADVANCED3)
Expand All @@ -214,6 +225,7 @@ public class Advanced3Config {
@Config(category = ConfigCategory.ADVANCED3)
public static boolean handSpinDiffSwing = false;

@Numeric(minValue = 0, maxValue = 6)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static double nukerRange = 4.5;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
Expand All @@ -224,16 +236,36 @@ public class Advanced3Config {
public static boolean nukerSilentRotation = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean nukerKeepRotation = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean nukerKeepGround = true;

@Numeric(minValue = Integer.MIN_VALUE, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int blockDetectorX = 0;
@Numeric(minValue = Integer.MIN_VALUE, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int blockDetectorY = 0;
@Numeric(minValue = Integer.MIN_VALUE, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int blockDetectorZ = 0;
@Numeric(minValue = 0, maxValue = Integer.MAX_VALUE)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int blockDetectorPostDelay = 20;

@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean airStuckCancelPacket = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean airStuckLegit = false;
@Numeric(minValue = -1, maxValue = 20)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static double airStuckMinDistanceBeforeGround = -1;
@Numeric(minValue = -1, maxValue = 20)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static double airStuckMinFallDistance = -1;

@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static String clientSpoofBrand = "vanilla";

public static NotebotUtils.NotebotMode getNoteBotMode() {
if (noteBotMode.equals("AnyInstrument")) {
return NotebotUtils.NotebotMode.AnyInstrument;
Expand Down
12 changes: 12 additions & 0 deletions src/main/java/top/infsky/cheatdetector/config/ModuleConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,16 @@ public class ModuleConfig {
@Hotkey
@Config(category = ConfigCategory.MODULES, predicate = ConfigPredicate.PASMode.class)
public static boolean blockDetectorEnabled = false;

@Hotkey
@Config(category = ConfigCategory.MODULES)
public static boolean airStuckEnabled = false;

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

@Hotkey
@Config(category = ConfigCategory.MODULES)
public static boolean clientSpoofEnabled = false;
}
2 changes: 2 additions & 0 deletions src/main/java/top/infsky/cheatdetector/impl/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public boolean isDisabled() {
}

public void flag() {
if (player.manager.disableTick > 0) return;
if (!AntiCheatConfig.antiCheatEnabled) return;
if (isDisabled()) return;
if (AntiCheatConfig.disableSelfCheck && player.equals(TRSelf.getInstance())) return;
Expand All @@ -45,6 +46,7 @@ public void flag() {
}

public void flag(String extraMsg) {
if (player.manager.disableTick > 0) return;
if (!AntiCheatConfig.antiCheatEnabled) return;
if (isDisabled()) return;
if (AntiCheatConfig.disableSelfCheck && player.equals(TRSelf.getInstance())) return;
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/top/infsky/cheatdetector/impl/Module.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ public Module(String moduleName, @NotNull TRSelf player) {
public void flag() {
}

@Override
public void flag(String extraMsg) {
}

@Override
public final int getAlertBuffer() {
return super.getAlertBuffer();
}
}
50 changes: 38 additions & 12 deletions src/main/java/top/infsky/cheatdetector/impl/checks/MotionA.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package top.infsky.cheatdetector.impl.checks;

import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.effect.MobEffects;
import net.minecraft.world.level.block.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import top.infsky.cheatdetector.config.AdvancedConfig;
import top.infsky.cheatdetector.config.AntiCheatConfig;
import top.infsky.cheatdetector.impl.Check;
Expand All @@ -12,18 +14,22 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;

public class MotionA extends Check {
public static final List<MobEffect> IGNORED_EFFECTS = List.of(MobEffects.JUMP, MobEffects.SLOW_FALLING);
public static final List<MobEffect> IGNORED_EFFECTS = List.of(MobEffects.SLOW_FALLING);
public static final List<Class<? extends Block>> IGNORED_BLOCKS = List.of(BedBlock.class, SlimeBlock.class, HoneyBlock.class, PowderSnowBlock.class);
public static final List<Double> JUMP_MOTIONS = List.of(0.41159999516010254, -0.08506399504327788, -0.08336271676487925, -0.0816954640195993, -0.08006155629742463, -0.07846032669852913, -0.07689112166107052, -0.07535330069443089, -0.07384623611779237, -0.07236931280394177, -0.07092192792819801);
public static final List<Double> JUMP_MOTIONS_1 = List.of(0.5095999912261959, -0.08702399309539816, -0.08528351489334113, -0.08357784622212827, -0.0819062908918066, -0.08026816663620898, -0.07866280483447859, -0.07708955023816295, -0.07554776070376615, -0.07403680693065001, -0.07255607220417704, -0.07110495214399076, -0.0696828544573303);
public static final List<Double> JUMP_MOTIONS_2 = List.of(0.6076000164985658, -0.0889839917316434, -0.08720431359424546, -0.08546022898565087, -0.08375102603596235, -0.08207600711266715, -0.0804344885358894, -0.07882580029933772, -0.07724928579683382, -0.07570430155431032, -0.0741902169671691, -0.0727064140428918, -0.07125228714879878, -0.06982724276485225, -0.06843069924140427);

private final List<Double> motionY = new ArrayList<>();
private boolean readyToJump = false;
private Double jumpFromY = null;

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

@Override
Expand All @@ -45,19 +51,24 @@ public void _onTick() {
motionY.add(player.fabricPlayer.getDeltaMovement().y());
} else if (jumpFromY != null) {
if (jumpFromY == player.currentPos.y()) { // 满足判断条件
check:
try {
for (int i = 0; i < JUMP_MOTIONS.size(); i++) {
if (Math.abs(motionY.get(i) - JUMP_MOTIONS.get(i)) > AntiCheatConfig.threshold) {
flag("Invalid jump motion at tick %s.".formatted(i));
break check;
List<Double> possibleMotion = Objects.requireNonNull(getPossibleMotions());

check:
try {
for (int i = 0; i < possibleMotion.size(); i++) {
if (Math.abs(motionY.get(i) - possibleMotion.get(i)) > AntiCheatConfig.threshold) {
flag("Invalid jump motion at tick %s.".formatted(i));
break check;
}
}
if (possibleMotion.size() != motionY.size()) {
flag("Invalid jump time: %s ticks. (should be %s)".formatted(motionY.size(), possibleMotion.size()));
}
} catch (IndexOutOfBoundsException e) {
flag("Invalid jump time: %s ticks. (should be %s)".formatted(motionY.size(), possibleMotion.size()));
}
if (JUMP_MOTIONS.size() != motionY.size()) {
flag("Invalid jump time: %s ticks. (should be %s)".formatted(motionY.size(), JUMP_MOTIONS.size()));
}
} catch (IndexOutOfBoundsException e) {
flag("Invalid jump time: %s ticks. (should be %s)".formatted(motionY.size(), JUMP_MOTIONS.size()));
} catch (NullPointerException ignored) {
}
}
jumpFromY = null;
Expand All @@ -78,6 +89,21 @@ private boolean check() {
return !player.fabricPlayer.getAbilities().flying;
}

private @Nullable List<Double> getPossibleMotions() {
List<Double> result;
Map<MobEffect, MobEffectInstance> activeEffectsMap = player.fabricPlayer.getActiveEffectsMap();
if (!activeEffectsMap.containsKey(MobEffects.JUMP)) {
result = JUMP_MOTIONS;
} else {
switch (activeEffectsMap.get(MobEffects.JUMP).getAmplifier()) {
case 0 -> result = JUMP_MOTIONS_1;
case 1 -> result = JUMP_MOTIONS_2;
default -> result = null;
}
}
return result;
}

@Override
public int getAlertBuffer() {
return AdvancedConfig.motionAAlertBuffer;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package top.infsky.cheatdetector.impl.modules;

import lombok.Getter;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
Expand Down Expand Up @@ -51,7 +52,14 @@ public void _onTick() {

@Contract("_, _, _ -> new")
public static @NotNull ConfigGui create(String identifier, String defaultTab, ConfigManager configManager) {
return new ConfigGui(identifier, defaultTab, configManager, Component.translatable("cheatdetector.gui.title").getString());
return new ConfigGui(identifier, defaultTab, configManager,
Component.translatable("cheatdetector.pretty_name")
.append(" ")
.append(
FabricLoader.getInstance().getModContainer(CheatDetector.MOD_ID).orElseThrow().getMetadata().getVersion().getFriendlyString()
)
.getString()
);
}

public static void register(@NotNull ConfigManager manager) {
Expand Down
Loading

0 comments on commit 189612b

Please sign in to comment.