use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Client by MatHax.
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 Client by MatHax.
the class Sniper method onPacketSend.
@EventHandler
public void onPacketSend(PacketEvent.Send event) {
if (event.packet == null)
return;
if (event.packet instanceof PlayerActionC2SPacket) {
PlayerActionC2SPacket packet = (PlayerActionC2SPacket) event.packet;
if (packet.getAction() == PlayerActionC2SPacket.Action.RELEASE_USE_ITEM) {
if ((isBow() && bows.get()) || (isTrident() && tridents.get())) {
spoofed = false;
doSpoofs();
}
}
}
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Client by MatHax.
the class CEVBreaker method onTick.
@EventHandler
public void onTick(TickEvent.Pre pre) {
if (mc.world != null && mc.player != null) {
if (pause > 0)
--pause;
else {
pause = delay.get();
SortPriority sortPriority = SortPriority.Lowest_Distance;
PlayerEntity target = TargetUtils.getPlayerTarget(7.0, sortPriority);
if (target != null) {
BlockPos blockPos;
BlockPos blockPos1 = new BlockPos(target.getBlockPos().getX(), target.getBlockPos().getY() + 2, target.getBlockPos().getZ());
if (mc.player.distanceTo(target) <= targetRange.get() && mc.world.getBlockState(blockPos = new BlockPos(target.getBlockPos().getX(), target.getBlockPos().getY() + 1, target.getBlockPos().getZ())).getBlock() != Blocks.OBSIDIAN && mc.world.getBlockState(blockPos).getBlock() != Blocks.BEDROCK) {
BlockPos blockPos2 = new BlockPos(target.getBlockPos().getX(), target.getBlockPos().getY() + 3, target.getBlockPos().getZ());
if (mc.world.getBlockState(blockPos1).getBlock() == Blocks.BEDROCK && !mc.player.isCreative()) {
error("Can't break bedrock, disabling...");
toggle();
return;
}
if (mc.world.getBlockState(blockPos1).isAir() || mc.world.getBlockState(blockPos1).getBlock() == Blocks.OBSIDIAN) {
int slot = InvUtils.findItemInHotbar(Items.IRON_PICKAXE);
if (slot == -1)
slot = InvUtils.findItemInHotbar(Items.NETHERITE_PICKAXE);
if (slot == -1)
slot = InvUtils.findItemInHotbar(Items.DIAMOND_PICKAXE);
if (slot == -1 && !mc.player.isCreative()) {
error("Can't find any pickaxe in your hotbar, disabling...");
toggle();
} else {
EndCrystalEntity endCrystalEntity = null;
for (Object object : mc.world.getEntities()) {
if (!(object instanceof EndCrystalEntity) || !equalsBlockPos(((EndCrystalEntity) object).getBlockPos(), blockPos2))
continue;
endCrystalEntity = (EndCrystalEntity) object;
break;
}
if (!equalsBlockPos(pos, blockPos1))
pos = blockPos1;
if (mc.world.getBlockState(blockPos1).getBlock() != Blocks.OBSIDIAN && endCrystalEntity == null)
placeBlock(pos, InvUtils.findItemInHotbar(Items.OBSIDIAN), rotate.get());
if (mc.world.getBlockState(blockPos1).getBlock() != Blocks.OBSIDIAN && mc.world.getBlockState(blockPos1).getBlock() != Blocks.BEDROCK && endCrystalEntity != null)
isDone = true;
if (mc.world.getBlockState(blockPos1).getBlock() == Blocks.OBSIDIAN && endCrystalEntity == null) {
place(target, blockPos1);
isDone = false;
}
if (endCrystalEntity != null) {
double selfDamage = DamageUtils.crystalDamage(mc.player, endCrystalEntity.getPos(), false, endCrystalEntity.getBlockPos(), true);
if (selfDamage > maxDamage.get() || (antiSuicide.get() && selfDamage >= EntityUtils.getTotalPlayerHealth(mc.player)))
return;
}
if (canPlace(pos, endCrystalEntity)) {
InvUtils.swap2(slot);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, pos, Direction.UP));
if (swing.get())
mc.player.swingHand(Hand.MAIN_HAND);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, pos, Direction.UP));
isDone = true;
} else if (canAttack(endCrystalEntity)) {
if (rotate.get())
Rotations.rotate(Rotations.getYaw(endCrystalEntity), Rotations.getPitch(endCrystalEntity));
int oldSlot = mc.player.getInventory().selectedSlot;
InvUtils.swap2(slot);
mc.getNetworkHandler().sendPacket(new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.STOP_DESTROY_BLOCK, pos, Direction.UP));
InvUtils.swap2(oldSlot);
attack(endCrystalEntity);
isDone = false;
}
}
}
}
}
}
}
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Client by MatHax.
the class GhostCommand method execute.
private void execute(int radius) {
ClientPlayNetworkHandler conn = mc.getNetworkHandler();
if (conn == null)
return;
BlockPos pos = mc.player.getBlockPos();
for (int dx = -radius; dx <= radius; dx++) for (int dy = -radius; dy <= radius; dy++) for (int dz = -radius; dz <= radius; dz++) {
PlayerActionC2SPacket packet = new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, new BlockPos(pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz), Direction.UP);
conn.sendPacket(packet);
}
}
use of net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket in project Client by MatHax.
the class AntiGhostBlock method onActivate.
@Override
public void onActivate() {
if (mc.getNetworkHandler() == null)
return;
BlockPos pos = mc.player.getBlockPos();
for (int dz = -horizontalRange.get(); dz <= horizontalRange.get(); dz++) {
for (int dx = -horizontalRange.get(); dx <= horizontalRange.get(); dx++) {
for (int dy = -verticalRange.get(); dy <= verticalRange.get(); dy++) {
blockPos.set(pos.getX() + dx, (pos.getY() + underFeet.get()) + dy, pos.getZ() + dz);
BlockState blockState = mc.world.getBlockState(blockPos);
if (!blockState.isAir() && !blockState.isOf(Blocks.BEDROCK) && ((blockState.getBlock().getBlastResistance() >= 600 && onlyBlastProof.get()) || !onlyBlastProof.get())) {
PlayerActionC2SPacket packet = new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.START_DESTROY_BLOCK, new BlockPos(pos.getX() + dx, (pos.getY() + underFeet.get()) + dy, pos.getZ() + dz), Direction.UP);
mc.getNetworkHandler().sendPacket(packet);
}
}
}
}
toggle();
}
Aggregations