Skip to content

Commit

Permalink
Merge branch 'master' into nextgen/1.20.4
Browse files Browse the repository at this point in the history
  • Loading branch information
xia-mc committed Jun 3, 2024
2 parents e93b401 + a184aaa commit 4dde5db
Show file tree
Hide file tree
Showing 45 changed files with 846 additions and 171 deletions.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies {
exclude(group: "carpet", module: "fabric-carpet")
}
modImplementation("maven.modrinth:replaymod:${project.minecraft_version}-${project.replaymod_version}")
modImplementation("curse.maven:minihud-244260:${project.minihud_fileId}") // minihud-fabric-1.20.1-0.27.0

// modApi "com.terraformersmc:modmenu:${project.modmenu_version}"

Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@ minecraft_version=1.20.4
loader_version=0.14.23

# Mod Properties
mod_version = 2.10.2
mod_version = 2.10.4
maven_group = top.infsky
archives_base_name = CheatDetector-nextgen

# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.91.0+1.20.1
magiclib_version=0.7.398
replaymod_version=2.6.15
replaymod_version=2.6.15
minihud_fileId=4593082
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ public static void register(@NotNull CommandDispatcher<FabricClientCommandSource
.then(argument("name", StringArgumentType.string())
.executes(DebugCommand::execute))
)
.then(literal("surround")
.executes(SurroundCommand::execute)
.then(argument("name", StringArgumentType.string())
.executes(SurroundCommand::execute))
)
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import net.minecraft.network.chat.Component;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.CheatDetector;
import top.infsky.cheatdetector.impl.utils.ListUtils;

import java.util.NoSuchElementException;

Expand All @@ -14,13 +13,14 @@ public static int execute(@NotNull CommandContext<FabricClientCommandSource> con
String name = context.getArgument("name", String.class);

try {
context.getSource().sendFeedback(Component.literal(ListUtils.getSpilt(
context.getSource().sendFeedback(Component.literal("slot: %s".formatted(
CheatDetector.manager.getDataMap().values()
.stream()
.filter(trPlayer -> trPlayer.fabricPlayer.getName().getString().endsWith(name))
.findAny()
.orElseThrow()
.motionHistory)));
.stream()
.filter(trPlayer -> trPlayer.fabricPlayer.getName().getString().endsWith(name))
.findAny()
.orElseThrow()
.fabricPlayer.getInventory().selected))
);
return 1;
} catch (NoSuchElementException e) {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class HelpCommand {
§r/ctr clientspoof <brand> §f- §7设置客户端伪装名§r
§r/ctr writer <part> §f- §7写一本书。§r
§r/ctr catch <name> §f- §7设置自动骑上一名玩家。§r
§r/ctr surround <name> §f- §7设置自动用方块自动包围一名玩家。§r
""";

public static int execute(@NotNull CommandContext<FabricClientCommandSource> context) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package top.infsky.cheatdetector.commands;

import com.mojang.brigadier.context.CommandContext;
import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource;
import net.minecraft.ChatFormatting;
import net.minecraft.world.entity.player.Player;
import org.jetbrains.annotations.NotNull;
import top.infsky.cheatdetector.CheatDetector;
import top.infsky.cheatdetector.config.Advanced3Config;
import top.infsky.cheatdetector.utils.LogUtils;
import top.infsky.cheatdetector.utils.TRPlayer;

public class SurroundCommand {
public static int execute(@NotNull CommandContext<FabricClientCommandSource> context) {
String name;

try {
name = context.getArgument("name", String.class);
} catch (IllegalArgumentException e) {
if (TRPlayer.CLIENT.crosshairPickEntity instanceof Player target) {
name = target.getName().getString();
} else {
name = Advanced3Config.surroundName;
}
}

if (CheatDetector.CONFIG_HANDLER.configManager.setValue("surroundName", name)) {
LogUtils.custom(ChatFormatting.GREEN + "已设置: " + ChatFormatting.WHITE + name);
return 1;
} else {
return -1;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package top.infsky.cheatdetector.compat;

import fi.dy.masa.minihud.util.DataStorage;

public class MinihudHelper {
public static double getServerTPS() {
return DataStorage.getInstance().getServerTPS();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import top.hendrixshen.magiclib.malilib.api.annotation.Config;
import top.hendrixshen.magiclib.malilib.api.annotation.Numeric;
import top.infsky.cheatdetector.config.utils.ConfigCategory;
import top.infsky.cheatdetector.config.utils.ConfigPredicate;

public class Advanced2Config {
@Config(category = ConfigCategory.ADVANCED2)
Expand Down Expand Up @@ -33,6 +34,11 @@ public class Advanced2Config {
@Numeric(minValue = 0, maxValue = 30000)
@Config(category = ConfigCategory.ADVANCED2)
public static int serverFreezeMaxMs = 800;
@Numeric(minValue = 0, maxValue = 20)
@Config(category = ConfigCategory.ADVANCED2, predicate = ConfigPredicate.MiniHudLoaded.class)
public static double serverFreezeMinTPS = 18.0;
@Config(category = ConfigCategory.ADVANCED2, predicate = ConfigPredicate.MiniHudLoaded.class)
public static boolean serverFreezeAlertTPS = true;
@Config(category = ConfigCategory.ADVANCED2)
public static boolean serverFreezeAutoDisableCheck = true;
@Config(category = ConfigCategory.ADVANCED2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public class Advanced3Config {
@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotLatency = false;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotInTabList = false;
public static boolean antiBotHypixel = false;
@Config(category = ConfigCategory.ADVANCED3)
public static boolean antiBotDebug = false;
@Config(category = ConfigCategory.ADVANCED3)
Expand Down Expand Up @@ -338,6 +338,30 @@ public class Advanced3Config {
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean noStopBreakSilent = false;

@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static String surroundName = "";
@Numeric(minValue = 0, maxValue = 8)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static double surroundDistance = 8;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundAutoSwitch = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundAutoSwitchBack = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundDoRotation = false;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundSilentRotation = true;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundSwing = false;
@Numeric(minValue = 0, maxValue = 20)
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static int surroundPlaceDelay = 0;
@Config(category = ConfigCategory.ADVANCED3, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundSmartPlaceDelay = true;

@Config(category = ConfigCategory.ADVANCED3)
public static double debugDouble = 0.0;

public static NotebotUtils.NotebotMode getNoteBotMode() {
if (noteBotMode.equals("AnyInstrument")) {
return NotebotUtils.NotebotMode.AnyInstrument;
Expand Down
72 changes: 55 additions & 17 deletions src/main/java/top/infsky/cheatdetector/config/AdvancedConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,6 @@ public class AdvancedConfig {
@Config(category = ConfigCategory.ADVANCED)
public static int noSlowAAlertBuffer = 20;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick1 = 2.56;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick2 = 1.92;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick3 = 1.6;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick4 = 1.4;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick5 = 1.36;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick6 = 1.26;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick7 = 1.18;
@Config(category = ConfigCategory.ADVANCED)
public static double noSlowASpeedTick8 = 1.16;
@Config(category = ConfigCategory.ADVANCED)
public static int noSlowAInJumpDisableTick = 4;


Expand Down Expand Up @@ -143,7 +127,7 @@ public class AdvancedConfig {
public static int autoClickerAMinDiffMs = 5;

@Config(category = ConfigCategory.ADVANCED)
public static boolean flyCCheck = false;
public static boolean flyCCheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int flyCAlertBuffer = 30;
@Config(category = ConfigCategory.ADVANCED)
Expand All @@ -161,6 +145,60 @@ public class AdvancedConfig {
@Config(category = ConfigCategory.ADVANCED)
public static double strafeAMaxDiffToFlag = 0.005;

@Config(category = ConfigCategory.ADVANCED)
public static boolean timerACheck = true;
@Config(category = ConfigCategory.ADVANCED)
public static int timerAAlertBuffer = 20;
@Config(category = ConfigCategory.ADVANCED)
public static int timerADefaultBalance = -300;
@Config(category = ConfigCategory.ADVANCED)
public static int timerAFlagBalance = 100;

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

@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean aimACheck = true;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int aimAAlertBuffer = 30;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean aimAOnlyOnSwing = false;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean aimAOnlyIfTargetIsMoving = true;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean aimAOnlyPlayer = false;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimAMinDiffYaw = 2;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimAMinDeltaYaw = 2;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimAMinDiffPitch = 2;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimAMinDeltaPitch = 2;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimAMaxDistance = 6;

@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean scaffoldACheck = false;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int scaffoldAAlertBuffer = 30;

@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean aimBCheck = true;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int aimBAlertBuffer = 10;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimBMinDiffYaw = 2;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static double aimBMinDiffPitch = 2;

@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static boolean motionBCheck = false;
@Config(category = ConfigCategory.ADVANCED, predicate = ConfigPredicate.ExperimentalMode.class)
public static int motionBAlertBuffer = 10;

public static short getNoSlowAInJumpDisableTick() {
return (short) noSlowAInJumpDisableTick;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,8 @@ public class ModuleConfig {
@Hotkey
@Config(category = ConfigCategory.MODULES)
public static boolean noStopBreakEnabled = false;

@Hotkey
@Config(category = ConfigCategory.MODULES, predicate = ConfigPredicate.PASMode.class)
public static boolean surroundEnabled = false;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package top.infsky.cheatdetector.config.utils;

import net.fabricmc.loader.api.FabricLoader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Unmodifiable;
import top.hendrixshen.magiclib.dependency.api.ConfigDependencyPredicate;
Expand All @@ -17,6 +18,14 @@ public static void onJoinWorld(String ip, @NotNull ConfigManager configManager)
configManager.setValue("aaaPASModeEnabled", PASMode.getIpAddresses().contains(ip));
}

public static class MiniHudLoaded implements ConfigDependencyPredicate {
@Override
public boolean isSatisfied(ConfigOption option) {
return FabricLoader.getInstance().isModLoaded("minihud");
}

}

public static class ExperimentalMode implements ConfigDependencyPredicate {
@Override
public boolean isSatisfied(ConfigOption option) {
Expand Down
6 changes: 4 additions & 2 deletions src/main/java/top/infsky/cheatdetector/impl/Check.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
import io.netty.channel.ChannelHandlerContext;
import lombok.Getter;
import net.minecraft.ChatFormatting;
import net.minecraft.core.BlockPos;
import net.minecraft.network.Connection;
import net.minecraft.network.PacketSendListener;
import net.minecraft.network.protocol.Packet;
import net.minecraft.network.protocol.game.ClientGamePacketListener;
import net.minecraft.network.protocol.game.ServerGamePacketListener;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.Entity;
import org.jetbrains.annotations.NotNull;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
Expand Down Expand Up @@ -70,6 +72,6 @@ public void _onGameTypeChange() {}
public boolean _handleStopDestroyBlock(CallbackInfo ci) { return false; }
public boolean _onPacketSend(@NotNull Packet<ServerGamePacketListener> basePacket, Connection connection, PacketSendListener listener, CallbackInfo ci) { return false; }
public boolean _onPacketReceive(@NotNull Packet<ClientGamePacketListener> basePacket, Connection connection, ChannelHandlerContext channelHandlerContext, CallbackInfo ci) { return false; }
public void _handleAttack(Entity entity) {
}
public void _handleAttack(Entity entity) {}
public void _onPlaceBlock(InteractionHand hand, BlockPos blockPos) {}
}
Loading

0 comments on commit 4dde5db

Please sign in to comment.