Search in sources :

Example 6 with PlayerActionC2SPacket

use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project meteor-client by MeteorDevelopment.

the class AntiBed method sendStopPackets.

private void sendStopPackets(BlockPos blockPos) {
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, blockPos, Direction.UP));
    mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket) HandSwingC2SPacket(net.minecraft.network.packet.c2s.play.HandSwingC2SPacket)

Example 7 with PlayerActionC2SPacket

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

the class TNTAura method mine.

public void mine(BlockPos blockPos, FindItemResult item) {
    if (breakMode.get() == Mode.Normal) {
        InvUtils.swap(item.slot(), false);
        mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
        mc.player.swingHand(Hand.MAIN_HAND);
        mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP));
    }
    if (breakMode.get() == Mode.Instant) {
        InvUtils.swap(item.slot(), false);
        if (!startBreak) {
            mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
            startBreak = true;
        }
        if (rotate.get())
            Rotations.rotate(Rotations.getYaw(blockPos), Rotations.getPitch(blockPos), () -> mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, direction)));
        else
            mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, direction));
        mc.getNetworkHandler().sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
    }
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket) HandSwingC2SPacket(net.minecraft.network.packet.c2s.play.HandSwingC2SPacket)

Example 8 with PlayerActionC2SPacket

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

the class SelfProtect method sendMinePackets.

private void sendMinePackets(BlockPos blockPos) {
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP));
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)

Example 9 with PlayerActionC2SPacket

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

the class SelfProtect method mine.

private void mine(BlockPos blockPos) {
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, Direction.UP));
    mc.player.swingHand(Hand.MAIN_HAND);
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, Direction.UP));
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)

Example 10 with PlayerActionC2SPacket

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

the class AutoExtinguish method extinguishFire.

private void extinguishFire(BlockPos blockPos) {
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, blockPos, net.minecraft.util.math.Direction.UP));
    mc.player.swingHand(Hand.MAIN_HAND);
    mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, blockPos, net.minecraft.util.math.Direction.UP));
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)

Aggregations

PlayerActionC2SPacket (net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)32 BlockPos (net.minecraft.util.math.BlockPos)10 HandSwingC2SPacket (net.minecraft.network.packet.c2s.play.HandSwingC2SPacket)6 BleachSubscribe (org.bleachhack.eventbus.BleachSubscribe)4 EventTarget (dev.hypnotic.event.EventTarget)3 EventHandler (mathax.client.eventbus.EventHandler)3 ClientPlayNetworkHandler (net.minecraft.client.network.ClientPlayNetworkHandler)3 Items (net.minecraft.item.Items)3 Hand (net.minecraft.util.Hand)3 Direction (net.minecraft.util.math.Direction)3 Vec3d (net.minecraft.util.math.Vec3d)3 Comparator (java.util.Comparator)2 BlockState (net.minecraft.block.BlockState)2 LivingEntity (net.minecraft.entity.LivingEntity)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 ItemStack (net.minecraft.item.ItemStack)2 PlayerInteractBlockC2SPacket (net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket)2 UpdateSelectedSlotC2SPacket (net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket)2 BlockHitResult (net.minecraft.util.hit.BlockHitResult)2 Lists (com.google.common.collect.Lists)1