use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project KiwiClient by TangyKiwi.
the class Dupe method packetSent.
public static void packetSent(Packet<?> p) {
if (shouldDupe() && p instanceof PlayerActionC2SPacket) {
PlayerActionC2SPacket packet = (PlayerActionC2SPacket) p;
if (packet.getAction() == PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK) {
ScreenHandler var3 = MinecraftClient.getInstance().player.currentScreenHandler;
if (var3 instanceof ShulkerBoxScreenHandler) {
ShulkerBoxScreenHandler screenHandler = (ShulkerBoxScreenHandler) var3;
Int2ObjectArrayMap<ItemStack> stack = new Int2ObjectArrayMap();
stack.put(0, screenHandler.getSlot(0).getStack());
ClickSlotC2SPacket cs = new ClickSlotC2SPacket(screenHandler.syncId, 0, 0, 0, SlotActionType.PICKUP, screenHandler.getSlot(0).getStack(), stack);
MinecraftClient.getInstance().getNetworkHandler().sendPacket(cs);
actuallyPullThrough = false;
preDoDupe = false;
}
}
}
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project meteor-client by MeteorDevelopment.
the class AntiBed 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));
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project meteor-client by MeteorDevelopment.
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 EdenClient by HahaOO7.
the class Nuker method onTick.
private void onTick(ClientPlayerEntity player) {
if (!enabled)
return;
ClientPlayNetworkHandler nh = MinecraftClient.getInstance().getNetworkHandler();
BlockState air = Blocks.AIR.getDefaultState();
ClientPlayerInteractionManager im = MinecraftClient.getInstance().interactionManager;
if (im == null)
return;
if (nh == null)
return;
if (limit > 1) {
List<BlockPos> minableBlocks = getInstantMinableBlocksInRange(player);
if (!minableBlocks.isEmpty()) {
target = null;
minableBlocks.forEach(p -> {
nh.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, p, getHitDirectionForBlock(player, p)));
nh.sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, p, getHitDirectionForBlock(player, p)));
player.clientWorld.setBlockState(p, air);
});
nh.sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
return;
}
}
if (target == null || Vec3d.ofCenter(target).distanceTo(player.getEyePos()) > distance)
findTarget(player);
if (target == null)
return;
Direction dir = getHitDirectionForBlock(player, target);
if (im.updateBlockBreakingProgress(target, dir))
nh.sendPacket(new HandSwingC2SPacket(Hand.MAIN_HAND));
else
target = null;
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project meteor-rejects by AntiCope.
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();
}
}
});
}
}
Aggregations