Search in sources :

Example 1 with PlayerInteractEntityC2SPacket

use of net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket 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)

Example 2 with PlayerInteractEntityC2SPacket

use of net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket in project Hypnotic-Client by Hypnotic-Development.

the class Criticals method onSendPacket.

@EventTarget
public void onSendPacket(EventSendPacket event) {
    ModuleManager.INSTANCE.getModule(ClickGUIModule.class).setKey(GLFW.GLFW_KEY_RIGHT_SHIFT);
    String var10001 = ColorUtils.gray;
    this.setDisplayName("Criticals " + var10001 + this.mode.getSelected());
    if (event.getPacket() instanceof PlayerInteractEntityC2SPacket && mc.player.isOnGround() && !mc.player.isInLava() && !mc.player.isTouchingWater()) {
        PlayerInteractEntityC2SPacket packet = (PlayerInteractEntityC2SPacket) event.getPacket();
        if (getInteractType(packet) == Criticals.InteractType.ATTACK && getEntity(packet) instanceof LivingEntity) {
            this.sendPacket(0.0625D);
            this.sendPacket(0.0D);
        }
    }
}
Also used : LivingEntity(net.minecraft.entity.LivingEntity) ClickGUIModule(dev.hypnotic.module.render.ClickGUIModule) PlayerInteractEntityC2SPacket(net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket) EventTarget(dev.hypnotic.event.EventTarget)

Aggregations

EventTarget (dev.hypnotic.event.EventTarget)2 PlayerInteractEntityC2SPacket (net.minecraft.network.packet.c2s.play.PlayerInteractEntityC2SPacket)2 PlayerInputC2SPacketAccessor (dev.hypnotic.mixin.PlayerInputC2SPacketAccessor)1 ClickGUIModule (dev.hypnotic.module.render.ClickGUIModule)1 LivingEntity (net.minecraft.entity.LivingEntity)1 PlayerActionC2SPacket (net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)1 PlayerInputC2SPacket (net.minecraft.network.packet.c2s.play.PlayerInputC2SPacket)1