Search in sources :

Example 6 with PlayerMoveC2SPacket

use of net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket in project BleachHack by BleachDrinker420.

the class ElytraFly method onSendPacket.

@BleachSubscribe
public void onSendPacket(EventPacket.Send event) {
    if (getSetting(0).asMode().getMode() == 4 && shouldPacketFly()) {
        if (event.getPacket() instanceof PlayerMoveC2SPacket.LookAndOnGround) {
            event.setCancelled(true);
            return;
        }
        if (event.getPacket() instanceof PlayerMoveC2SPacket.Full) {
            event.setCancelled(true);
            PlayerMoveC2SPacket p = (PlayerMoveC2SPacket) event.getPacket();
            mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(p.getX(0), p.getY(0), p.getZ(0), p.isOnGround()));
        }
    }
}
Also used : PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) BleachSubscribe(org.bleachhack.eventbus.BleachSubscribe)

Example 7 with PlayerMoveC2SPacket

use of net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket in project Client by MatHax.

the class Blink method onSendPacket.

@EventHandler
private void onSendPacket(PacketEvent.Send event) {
    if (!(event.packet instanceof PlayerMoveC2SPacket))
        return;
    event.cancel();
    synchronized (packets) {
        PlayerMoveC2SPacket p = (PlayerMoveC2SPacket) event.packet;
        PlayerMoveC2SPacket prev = packets.size() == 0 ? null : packets.get(packets.size() - 1);
        if (prev != null && p.isOnGround() == prev.isOnGround() && p.getYaw(-1) == prev.getYaw(-1) && p.getPitch(-1) == prev.getPitch(-1) && p.getX(-1) == prev.getX(-1) && p.getY(-1) == prev.getY(-1) && p.getZ(-1) == prev.getZ(-1))
            return;
        packets.add(p);
    }
}
Also used : PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) EventHandler(mathax.client.eventbus.EventHandler)

Aggregations

PlayerMoveC2SPacket (net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket)7 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)4 EventHandler (meteordevelopment.orbit.EventHandler)2 VehicleMoveC2SPacket (net.minecraft.network.packet.c2s.play.VehicleMoveC2SPacket)2 EventHandler (mathax.client.eventbus.EventHandler)1 PlayerMoveC2SPacketAccessor (meteordevelopment.meteorclient.mixin.PlayerMoveC2SPacketAccessor)1