Search in sources :

Example 1 with PlayerInputC2SPacketAccessor

use of dev.hypnotic.mixin.PlayerInputC2SPacketAccessor in project Hypnotic-Client by Hypnotic-Development.

the class Disabler method onSendPacket.

@EventTarget
public void onSendPacket(EventSendPacket event) {
    if (mode.is("Verus")) {
        if (event.getPacket() instanceof PlayerInteractEntityC2SPacket) {
            event.setCancelled(true);
        }
        if (event.getPacket() instanceof PlayerActionC2SPacket) {
            mc.player.networkHandler.sendPacket(new PlayerInputC2SPacket(0, 0, false, false));
        }
        if (event.getPacket() instanceof PlayerInputC2SPacket) {
            final PlayerInputC2SPacket packet = (PlayerInputC2SPacket) event.getPacket();
            // mc.player.networkHandler.sendPacket(new PlayerInputC2SPacket(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, mc.player.age % 2 == 0, mc.player.age % 2 != 0));
            ((PlayerInputC2SPacketAccessor) packet).setForward(Float.POSITIVE_INFINITY);
            ((PlayerInputC2SPacketAccessor) packet).setSideways(Float.POSITIVE_INFINITY);
            ((PlayerInputC2SPacketAccessor) packet).setJumping(mc.player.age % 2 == 0);
            ((PlayerInputC2SPacketAccessor) packet).setSneaking(mc.player.age % 2 != 0);
        }
    }
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket) PlayerInputC2SPacketAccessor(dev.hypnotic.mixin.PlayerInputC2SPacketAccessor) PlayerInputC2SPacket(net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket) PlayerInteractEntityC2SPacket(net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket) EventTarget(dev.hypnotic.event.EventTarget)

Aggregations

EventTarget (dev.hypnotic.event.EventTarget)1 PlayerInputC2SPacketAccessor (dev.hypnotic.mixin.PlayerInputC2SPacketAccessor)1 PlayerActionC2SPacket (net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)1 PlayerInputC2SPacket (net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket)1 PlayerInteractEntityC2SPacket (net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket)1