Skip to content

Commit

Permalink
Remove some anti-cheat checks
Browse files Browse the repository at this point in the history
  • Loading branch information
totorewa committed Sep 11, 2022
1 parent d54dd1c commit 0282a99
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package github.totorewa.rugserver.mixin.feature.anticheat;

import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket;
import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ServerPlayNetworkHandler.class)
public class ServerPlayNetworkHandlerMixin {
@Shadow
private int field_8932;

@Shadow
private int messageCooldown;

@ModifyConstant(method = "onPlayerAction", constant = @Constant(doubleValue = 36.0))
private double overrideReachLimit(double constant) {
return Double.MAX_VALUE;
}

@ModifyConstant(method = "onPlayerMove", constant = @Constant(doubleValue = 0.0625))
private double overrideMovementLimit(double constant) {
return Double.MAX_VALUE;
}

@Redirect(method = "onPlayerMove", at = @At(
value = "FIELD",
target = "Lnet/minecraft/entity/player/ServerPlayerEntity;noClip:Z",
opcode = Opcodes.GETFIELD))
private boolean allowClipping(ServerPlayerEntity instance) {
return true;
}

@Inject(method = "onPlayerMove", at = @At("HEAD"))
private void relaxMovement(PlayerMoveC2SPacket packet, CallbackInfo ci) {
if (field_8932 > 79) field_8932--;
}

@Inject(method = "onChatMessage", at = @At("TAIL"))
private void relaxChatSpam(ChatMessageC2SPacket packet, CallbackInfo ci) {
messageCooldown = 0;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package github.totorewa.rugserver.mixin.feature.anticheat;

import net.minecraft.server.network.ServerPlayerInteractionManager;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.Constant;
import org.spongepowered.asm.mixin.injection.ModifyConstant;

@Mixin(ServerPlayerInteractionManager.class)
public class ServerPlayerInteractionManagerMixin {
@ModifyConstant(method = "method_10764", constant = @Constant(floatValue = 0.7f))
private float relaxBlockBreakTime(float constant) {
return 0.0f;
}
}
2 changes: 2 additions & 0 deletions src/main/resources/rugserver.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"server": [
"commands.CommandManagerMixin",
"commands.ServerPlayerEntityMixin",
"feature.anticheat.ServerPlayerInteractionManagerMixin",
"feature.anticheat.ServerPlayNetworkHandlerMixin",
"feature.cameramode.ServerPlayerEntityMixin",
"feature.carefulbreak.BlockMixin",
"feature.carefulbreak.ServerPlayerInteractionManagerMixin",
Expand Down

0 comments on commit 0282a99

Please sign in to comment.