-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 新模块 AutoCatch 自动骑乘 - 仅限PAS模式 - 自动骑到设定的玩家身上 - 修复静默瞄准系统的一个bug - 改进AntiBot
- Loading branch information
Showing
27 changed files
with
256 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/main/java/top/infsky/cheatdetector/commands/CatchCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 CatchCommand { | ||
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.autoCatchName; | ||
} | ||
} | ||
|
||
if (CheatDetector.CONFIG_HANDLER.configManager.setValue("autoCatchName", name)) { | ||
LogUtils.custom(ChatFormatting.GREEN + "已设置: " + ChatFormatting.WHITE + name); | ||
return 1; | ||
} else { | ||
return -1; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...tector/impl/modules/common/AimAssist.java → ...tector/impl/modules/danger/AimAssist.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...etector/impl/modules/common/AirStuck.java → ...etector/impl/modules/danger/AirStuck.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...y/cheatdetector/impl/modules/pas/Fly.java → ...heatdetector/impl/modules/danger/Fly.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cheatdetector/impl/modules/pas/Nuker.java → ...atdetector/impl/modules/danger/Nuker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...detector/impl/modules/pas/SlowMotion.java → ...ector/impl/modules/danger/SlowMotion.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
106 changes: 106 additions & 0 deletions
106
src/main/java/top/infsky/cheatdetector/impl/modules/pas/AutoCatch.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
package top.infsky.cheatdetector.impl.modules.pas; | ||
|
||
import lombok.Getter; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.network.protocol.game.ServerboundInteractPacket; | ||
import net.minecraft.world.InteractionHand; | ||
import net.minecraft.world.item.AirItem; | ||
import net.minecraft.world.phys.Vec3; | ||
import org.jetbrains.annotations.NotNull; | ||
import org.jetbrains.annotations.Nullable; | ||
import top.infsky.cheatdetector.config.Advanced3Config; | ||
import top.infsky.cheatdetector.config.ModuleConfig; | ||
import top.infsky.cheatdetector.impl.Module; | ||
import top.infsky.cheatdetector.impl.modules.common.Rotation; | ||
import top.infsky.cheatdetector.impl.utils.world.ContainerUtils; | ||
import top.infsky.cheatdetector.impl.utils.world.LevelUtils; | ||
import top.infsky.cheatdetector.impl.utils.world.PlayerRotation; | ||
import top.infsky.cheatdetector.utils.TRSelf; | ||
|
||
import java.util.NoSuchElementException; | ||
|
||
public class AutoCatch extends Module { | ||
@Getter | ||
@Nullable | ||
private static Module instance = null; | ||
public AutoCatch(@NotNull TRSelf player) { | ||
super("AutoCatch", player); | ||
instance = this; | ||
} | ||
|
||
@Override | ||
public void _onTick() { | ||
if (isDisabled()) return; | ||
if (!Advanced3Config.autoCatchAlways && player.fabricPlayer.isPassenger()) return; | ||
|
||
doCatch(); | ||
} | ||
|
||
private void doCatch() { | ||
try { | ||
AbstractClientPlayer target = LevelUtils.getClientLevel().players().stream() | ||
.filter(p -> p.getGameProfile().getName().equals(Advanced3Config.autoCatchName)) | ||
.findFirst() | ||
.orElseThrow(); | ||
|
||
double distance = target.distanceTo(player.fabricPlayer); | ||
if (distance > Advanced3Config.autoCatchDistance && !Advanced3Config.autoCatchAsPossible) return; | ||
if (distance > 6) { | ||
if (Advanced3Config.autoCatchAsPossible) { | ||
Vec3 targetPos = target.position().add(target.getDeltaMovement()); | ||
player.fabricPlayer.setDeltaMovement(getTeleportMotion(targetPos).add(target.getDeltaMovement())); | ||
return; | ||
} | ||
} | ||
player.fabricPlayer.setDeltaMovement(0, 0, 0); | ||
|
||
player.fabricPlayer.getInventory().selected = ContainerUtils.findItem(player.fabricPlayer.getInventory(), AirItem.class, ContainerUtils.SlotType.HOTBAR); | ||
if (Advanced3Config.autoCatchRotate) { | ||
float yaw = PlayerRotation.getYaw(target.getEyePosition()); | ||
float pitch = PlayerRotation.getPitch(target.getEyePosition()); | ||
if (Advanced3Config.autoCatchSilentRotate) { | ||
Rotation.silentRotate(yaw, pitch); | ||
} else { | ||
PlayerRotation.rotate(yaw, pitch); | ||
} | ||
} | ||
|
||
player.fabricPlayer.setSilent(false); | ||
player.fabricPlayer.connection.send(ServerboundInteractPacket.createInteractionPacket(target, false, InteractionHand.MAIN_HAND, player.fabricPlayer.position())); | ||
player.fabricPlayer.swing(InteractionHand.MAIN_HAND); | ||
} catch (NoSuchElementException ignored) { | ||
} | ||
} | ||
|
||
private @NotNull Vec3 getTeleportMotion(@NotNull final Vec3 targetPos) { | ||
Vec3 current = player.fabricPlayer.position(); | ||
final double step = Advanced3Config.autoCatchAsPossibleTeleportDistance; | ||
|
||
current = new Vec3( | ||
add(current.x(), step, targetPos.x()), | ||
add(current.y(), step, targetPos.y()), | ||
add(current.z(), step, targetPos.z()) | ||
); | ||
return current.subtract(player.fabricPlayer.position()); | ||
} | ||
|
||
private static double add(double current, double step, double target) { | ||
if (current < target) { | ||
return Math.min(current + step, target); | ||
} else { | ||
return Math.max(current - step, target); | ||
} | ||
} | ||
|
||
public void onStopRiding() { | ||
if (isDisabled()) return; | ||
if (!Advanced3Config.autoCatchFast) return; | ||
|
||
doCatch(); | ||
} | ||
|
||
@Override | ||
public boolean isDisabled() { | ||
return !ModuleConfig.autoCatchEnabled || !ModuleConfig.aaaPASModeEnabled; | ||
} | ||
} |
Oops, something went wrong.