-
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.
- Loading branch information
Showing
3 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
...java/github/totorewa/rugserver/mixin/feature/anticheat/ServerPlayNetworkHandlerMixin.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,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; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...ithub/totorewa/rugserver/mixin/feature/anticheat/ServerPlayerInteractionManagerMixin.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,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; | ||
} | ||
} |
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