public static void breakBlockPacketSpam(BlockPos pos) { Vec3d eyesPos = RotationUtils.getEyesPos(); Vec3d posVec = new Vec3d(pos).addVector(0.5, 0.5, 0.5); double distanceSqPosVec = eyesPos.squareDistanceTo(posVec); for(EnumFacing side : EnumFacing.values()) { Vec3d hitVec = posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5)); // check if side is facing towards player if(eyesPos.squareDistanceTo(hitVec) >= distanceSqPosVec) continue; // break block WConnection.sendPacket(new CPacketPlayerDigging( Action.START_DESTROY_BLOCK, pos, side)); WConnection.sendPacket( new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side)); return; } }
@Override public void onUpdate() { BlockPos var1 = mc.objectMouseOver.getBlockPos(); if (mc.theWorld.getBlockState(var1).getMaterial() == Material.air) return; if (mc.playerController.isHittingBlock) if (ncp && mc.gameSettings.keyBindAttack.isKeyDown()) PacketUtils.sendPacket(new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK, mc.objectMouseOver.getBlockPos(), EnumFacing.getHorizontal(-1))); else { PacketUtils.sendPacket(new CPacketPlayerDigging(Action.START_DESTROY_BLOCK, mc.objectMouseOver.getBlockPos(), EnumFacing.getHorizontal(-1))); PacketUtils.sendPacket(new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK, mc.objectMouseOver.getBlockPos(), EnumFacing.getHorizontal(-1))); } }
public static void breakBlocksPacketSpam(Iterable<BlockPos> blocks) { Vec3d eyesPos = RotationUtils.getEyesPos(); for(BlockPos pos : blocks) { Vec3d posVec = new Vec3d(pos).addVector(0.5, 0.5, 0.5); double distanceSqPosVec = eyesPos.squareDistanceTo(posVec); for(EnumFacing side : EnumFacing.values()) { Vec3d hitVec = posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5)); // check if side is facing towards player if(eyesPos.squareDistanceTo(hitVec) >= distanceSqPosVec) continue; // break block WConnection.sendPacket(new CPacketPlayerDigging( Action.START_DESTROY_BLOCK, pos, side)); WConnection.sendPacket(new CPacketPlayerDigging( Action.STOP_DESTROY_BLOCK, pos, side)); break; } } }