Search in sources :

Example 1 with AntiCheatConfig

use of me.wallhacks.spark.systems.clientsetting.clientsettings.AntiCheatConfig in project Spark-Client by Spark-Client-Development.

the class CrystalAura method rotate.

// rotation methods
boolean rotate(RotateType type) {
    AntiCheatConfig cfg = AntiCheatConfig.getInstance();
    if (currentCrystalBlockPos == null && currentCrystalEntity == null)
        return true;
    Vec3d pos = CrystalUtil.getRotationPos((type != PLACE), currentCrystalBlockPos, currentCrystalEntity);
    boolean needsRotating = false;
    boolean needsRaytracebypass = false;
    switch(type) {
        case PLACE:
            needsRotating = cfg.placeRotate.getValue();
            needsRaytracebypass = true;
            break;
        case BREAK:
            needsRotating = cfg.attackRotate.getValue();
            break;
        case BOTH:
            needsRotating = cfg.attackRotate.getValue() || cfg.placeRotate.getValue();
            needsRaytracebypass = currentCrystalEntity == null;
            break;
    }
    float[] rot = Spark.rotationManager.getLegitRotations(pos);
    if (raytrace && needsRaytracebypass) {
        if (!Spark.rotationManager.isRaytraceBypassDone()) {
            float[] rotBypass = RaytraceUtil.getRotationForBypass(rot[0]);
            if (rotBypass == null)
                return false;
            Spark.rotationManager.rotate(rotBypass, isUpdate, false);
            return false;
        }
    }
    if (!needsRotating)
        return true;
    return Spark.rotationManager.rotate(rot, isUpdate, false);
}
Also used : AntiCheatConfig(me.wallhacks.spark.systems.clientsetting.clientsettings.AntiCheatConfig)

Example 2 with AntiCheatConfig

use of me.wallhacks.spark.systems.clientsetting.clientsettings.AntiCheatConfig in project Spark-Client by Spark-Client-Development.

the class ShulkerAura method onEnable.

@Override
public void onEnable() {
    windowId = -1;
    AntiCheatConfig cfg = AntiCheatConfig.getInstance();
    targetPos = null;
    targetFacing = null;
    String message = "Could not find target";
    for (EntityPlayer player : mc.world.playerEntities) {
        if (mc.player.getDistance(player) > 6)
            continue;
        if (mc.player == player)
            continue;
        if (Spark.socialManager.isFriend(player))
            continue;
        // i dont like this but its a really easy check for now
        if (!HoleUtil.isInHole(player))
            continue;
        BlockPos pos = new BlockPos(player.posX, player.posY + 2, player.posZ);
        // check every direction for shulker aura posibilitys
        EnumFacing face = EnumFacing.UP;
        for (EnumFacing facing : EnumFacing.HORIZONTALS) {
            // check places being possible to place at
            // blocks oppisite of the trap need to be air to prevent the shulker from being blown up
            BlockPos blockedCheck = pos.offset(facing.getOpposite());
            if (!(mc.world.getBlockState(blockedCheck).getBlock() instanceof BlockAir))
                continue;
            if (!(mc.world.getBlockState(blockedCheck.up()).getBlock() instanceof BlockAir))
                continue;
            boolean blocked = false;
            for (EnumFacing f : EnumFacing.HORIZONTALS) {
                if (f == facing || f == facing.getOpposite())
                    continue;
                if (!(mc.world.getBlockState(blockedCheck.offset(f)).getBlock() instanceof BlockAir) || !(mc.world.getBlockState(blockedCheck.offset(f).up()).getBlock() instanceof BlockAir)) {
                    blocked = true;
                    break;
                }
            }
            if (blocked)
                continue;
            // actual block needs to be air so we can place crystals
            if (!(mc.world.getBlockState(pos.offset(facing)).getBlock() instanceof BlockAir && BlockInteractUtil.blockCollisionCheck(pos.offset(facing), null)))
                continue;
            // block above it needs to be air too
            if (!(mc.world.getBlockState(pos.add(facing.getDirectionVec()).up()).getBlock() instanceof BlockAir))
                continue;
            // block underneath needs to be air bedrock or obby so we can actually place crystal there after trapping
            Block placeBlock = mc.world.getBlockState(pos.offset(facing).down()).getBlock();
            if (!BlockInteractUtil.blockCollisionCheck(pos.offset(facing).down(), true) || !BlockInteractUtil.blockCollisionCheck(pos.offset(facing), true) || !BlockInteractUtil.blockCollisionCheck(pos.offset(facing, 2).down(), true))
                continue;
            if (!(placeBlock instanceof BlockAir || placeBlock instanceof BlockObsidian || placeBlock == Blocks.BEDROCK) && BlockInteractUtil.blockCollisionCheck(pos.offset(facing).down(), null))
                continue;
            // the position 2 blocks out needs to be air for placing the shulk
            BlockPos shulkPos = pos.offset(facing, 2);
            BlockPos outerPos = pos.offset(facing, 3);
            Block shulkBlock = mc.world.getBlockState(shulkPos).getBlock();
            if (!(shulkBlock instanceof BlockShulkerBox)) {
                if (!shulkBlock.isReplaceable(mc.world, shulkPos) || !BlockInteractUtil.blockCollisionCheck(shulkPos, null))
                    continue;
            } else
                outerPos = shulkPos;
            message = "Found target to attack but its to far away";
            // raytrace and range checks
            RayTraceResult outer = mc.world.rayTraceBlocks(mc.player.getPositionEyes(mc.getRenderPartialTicks()), new Vec3d(outerPos).add(0.5, 0.5, 0.5));
            double distance = mc.player.getDistance(outerPos.getX() + 0.5, outerPos.getY() + 0.5, outerPos.getZ() + 0.5);
            if (distance < cfg.placeRange.getValue() && (AntiCheatConfig.getInstance().raytrace.getValue() || outer == null || outerPos.equals(outer.getBlockPos()) || distance < cfg.placeWallRange.getValue())) {
                face = facing;
                break;
            }
        }
        if (face != EnumFacing.UP) {
            targetPos = pos;
            targetFacing = face;
            PacketMine.instance.pos = null;
            return;
        }
    }
    Spark.sendInfo(message);
    disable();
}
Also used : BlockAir(net.minecraft.block.BlockAir) EnumFacing(net.minecraft.util.EnumFacing) RayTraceResult(net.minecraft.util.math.RayTraceResult) AntiCheatConfig(me.wallhacks.spark.systems.clientsetting.clientsettings.AntiCheatConfig) Vec3d(net.minecraft.util.math.Vec3d) BlockShulkerBox(net.minecraft.block.BlockShulkerBox) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Block(net.minecraft.block.Block) CPacketPlayerTryUseItemOnBlock(net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock) BlockPos(net.minecraft.util.math.BlockPos) BlockObsidian(net.minecraft.block.BlockObsidian)

Aggregations

AntiCheatConfig (me.wallhacks.spark.systems.clientsetting.clientsettings.AntiCheatConfig)2 Block (net.minecraft.block.Block)1 BlockAir (net.minecraft.block.BlockAir)1 BlockObsidian (net.minecraft.block.BlockObsidian)1 BlockShulkerBox (net.minecraft.block.BlockShulkerBox)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 CPacketPlayerTryUseItemOnBlock (net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 RayTraceResult (net.minecraft.util.math.RayTraceResult)1 Vec3d (net.minecraft.util.math.Vec3d)1