use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Client by MatHax.
the class AutoExtinguish method onTick.
@EventHandler
private void onTick(TickEvent.Pre event) {
if (mc.world.getDimension().isRespawnAnchorWorking()) {
if (doesWaterBucketWork) {
warning("Water Buckets don't work in this dimension!");
doesWaterBucketWork = false;
}
} else {
if (!doesWaterBucketWork) {
warning("Enabled Water Buckets!");
doesWaterBucketWork = true;
}
}
if (onGround.get() && !mc.player.isOnGround())
return;
if (waterBucket.get() && doesWaterBucketWork) {
if (hasPlacedWater) {
final int slot = findSlot(Items.BUCKET);
blockPos = mc.player.getBlockPos();
place(slot);
hasPlacedWater = false;
} else if (!mc.player.hasStatusEffect(FIRE_RESISTANCE) && mc.player.isOnFire()) {
blockPos = mc.player.getBlockPos();
final int slot = findSlot(Items.WATER_BUCKET);
if (mc.world.getBlockState(blockPos).getBlock() == Blocks.FIRE || mc.world.getBlockState(blockPos).getBlock() == Blocks.SOUL_FIRE) {
float yaw = mc.gameRenderer.getCamera().getYaw() % 360;
float pitch = mc.gameRenderer.getCamera().getPitch() % 360;
if (center.get()) {
PlayerUtils.centerPlayer();
}
Rotations.rotate(yaw, 90);
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));
Rotations.rotate(yaw, pitch);
}
place(slot);
hasPlacedWater = true;
}
}
if (extinguish.get()) {
AtomicInteger blocksPerTick = new AtomicInteger();
BlockIterator.register(horizontalRadius.get(), verticalRadius.get(), (blockPos, blockState) -> {
if (blocksPerTick.get() <= maxBlockPerTick.get()) {
if (blockState.getBlock() == Blocks.FIRE || mc.world.getBlockState(blockPos).getBlock() == Blocks.SOUL_FIRE) {
extinguishFire(blockPos);
blocksPerTick.getAndIncrement();
}
}
});
}
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket 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);
}
}
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Hypnotic-Client by Hypnotic-Development.
the class OffhandCrash method onTick.
@Override
public void onTick() {
if (crash.isEnabled()) {
Channel channel = ((ClientConnectionAccessor) mc.player.networkHandler.getConnection()).getChannel();
for (int i = 0; i < speed.getValue(); i++) {
channel.write(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.SWAP_ITEM_WITH_OFFHAND, new BlockPos(0, 0, 0), Direction.UP));
}
channel.flush();
}
super.onTick();
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Hypnotic-Client by Hypnotic-Development.
the class AutoCity 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));
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project orion by AntiCope.
the class AutomationUtils method doPacketMine.
public static void doPacketMine(BlockPos targetPos) {
mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, targetPos, Direction.UP));
Wrapper.swingHand(false);
mc.player.networkHandler.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, targetPos, Direction.UP));
}
Aggregations