-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- 修复NoSlowA, SpeedA在速度buff下的误判。 - 同步cheat detector更新。
- Loading branch information
Showing
9 changed files
with
70 additions
and
8 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
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
34 changes: 34 additions & 0 deletions
34
src/main/java/top/infsky/timerecorder/anticheat/checks/ScaffoldA.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.timerecorder.anticheat.checks; | ||
|
||
import net.minecraft.network.protocol.Packet; | ||
import net.minecraft.network.protocol.game.ServerGamePacketListener; | ||
import net.minecraft.network.protocol.game.ServerboundUseItemOnPacket; | ||
import net.minecraft.world.phys.BlockHitResult; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
import top.infsky.timerecorder.anticheat.Check; | ||
import top.infsky.timerecorder.anticheat.TRPlayer; | ||
|
||
public class ScaffoldA extends Check { | ||
public ScaffoldA(TRPlayer player) { | ||
super("ScaffoldA", player); | ||
} | ||
|
||
@Override | ||
public void _onPacketReceive(Packet<ServerGamePacketListener> basePacket, CallbackInfo ci) { | ||
if (basePacket instanceof ServerboundUseItemOnPacket packet) { | ||
final BlockHitResult hitResult = packet.getHitResult(); | ||
|
||
if (hitResult.getBlockPos().getX() == player.fabricPlayer.getBlockX() | ||
&& hitResult.getBlockPos().getZ() == player.fabricPlayer.getBlockZ() | ||
&& hitResult.getBlockPos().getY() < player.fabricPlayer.getBlockY() | ||
&& player.fabricPlayer.onGround() | ||
) { // is scaffolding | ||
if (Math.abs(player.fabricPlayer.getYHeadRot()) > 60) { | ||
flag(); | ||
setback(player.lastPos); | ||
setback(ci); | ||
} | ||
} | ||
} | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
src/main/java/top/infsky/timerecorder/anticheat/utils/PlayerRotation.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,22 @@ | ||
package top.infsky.timerecorder.anticheat.utils; | ||
|
||
import net.minecraft.core.BlockPos; | ||
import net.minecraft.server.level.ServerPlayer; | ||
import org.jetbrains.annotations.NotNull; | ||
import oshi.util.tuples.Pair; | ||
|
||
public class PlayerRotation { | ||
/** | ||
* 无法使用 | ||
*/ | ||
@SuppressWarnings("unused") | ||
public static @NotNull Pair<Float, Float> getLookAt(@NotNull ServerPlayer player, @NotNull BlockPos blockPos) { | ||
double dx = (blockPos.getX() + 0.5) - player.getX(); | ||
double dy = (blockPos.getY() + 0.5) - (player.getY() + player.getEyeHeight()); | ||
double dz = (blockPos.getZ() + 0.5) - player.getZ(); | ||
double dh = Math.sqrt(dx * dx + dz * dz); | ||
float yaw = (float) Math.toDegrees(Math.atan2(dz, dx)) - 90; | ||
float pitch = (float) -Math.toDegrees(Math.atan2(dy, dh)); | ||
return new Pair<>(yaw, pitch); | ||
} | ||
} |