Search in sources :

Example 1 with SpecItemSwitchItem

use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.

the class CevBreaker method placeCrystalOnBlock.

public boolean placeCrystalOnBlock(BlockPos bestPos) {
    Vec3d pos = CrystalUtil.getRotationPos(false, bestPos, null);
    final RayTraceResult result = mc.world.rayTraceBlocks(PlayerUtil.getEyePos(), pos, false, true, false);
    EnumFacing facing = (result == null || !bestPos.equals(result.getBlockPos()) || result.sideHit == null) ? EnumFacing.UP : result.sideHit;
    Vec3d v = new Vec3d(bestPos).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getDirectionVec()).scale(0.5));
    if (result != null && bestPos.equals(result.getBlockPos()) && result.hitVec != null)
        v = result.hitVec;
    if (bestPos.getY() >= 254)
        facing = EnumFacing.EAST;
    // offhand
    EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.END_CRYSTAL), ItemSwitcher.usedHand.Both, switchingMode.getValue());
    if (hand == null)
        return false;
    // rotate if needed
    if (!Spark.rotationManager.rotate(Spark.rotationManager.getLegitRotations(pos), AntiCheatConfig.getInstance().getCrystalRotStep(), 4, false, true))
        return false;
    // send packet
    mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(bestPos, facing, hand, (float) v.x, (float) v.y, (float) v.z));
    // swing
    switch(AntiCheatConfig.getInstance().crystalPlaceSwing.getValue()) {
        case "Normal":
            mc.player.swingArm(hand);
            break;
        case "Packet":
            mc.player.connection.sendPacket(new CPacketAnimation(hand));
            break;
    }
    if (render.getValue())
        new FadePos(bestPos, fill, true);
    return true;
}
Also used : FadePos(me.wallhacks.spark.util.objects.FadePos) SpecItemSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem) EnumFacing(net.minecraft.util.EnumFacing) EnumHand(net.minecraft.util.EnumHand) CPacketAnimation(net.minecraft.network.play.client.CPacketAnimation) CPacketPlayerTryUseItemOnBlock(net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)

Example 2 with SpecItemSwitchItem

use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.

the class AutoWither method onUpdate.

@SubscribeEvent
void onUpdate(PlayerUpdateEvent event) {
    if (autoName.isOn()) {
        for (Entity entity : mc.world.loadedEntityList) {
            if (entity instanceof EntityWither && mc.player.getDistance(entity) < 4) {
                EntityWither w = (EntityWither) entity;
                if (w.getDisplayName().getUnformattedComponentText().equalsIgnoreCase("Wither")) {
                    EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.NAME_TAG), ItemSwitcher.usedHand.Both, AntiCheatConfig.getInstance().getBlockPlaceSwitchType());
                    if (hand != null) {
                        Vec3d lookAt = RaytraceUtil.getPointToLookAtEntity(w);
                        if (lookAt == null)
                            lookAt = w.boundingBox.getCenter();
                        if (rotateForName.isOn())
                            if (!Spark.rotationManager.rotate(Spark.rotationManager.getLegitRotations(lookAt), 80, 2, false))
                                return;
                        mc.playerController.interactWithEntity(mc.player, w, hand);
                        return;
                    }
                }
            }
        }
    }
    if (placeWither != null) {
        int placed = 0;
        for (int i = 0; i < placeWither.size(); i++) {
            BlockPos p = placeWither.get(i);
            if (PlayerUtil.getDistance(p) > 5) {
                placeWither = null;
                return;
            }
            if (mc.world.getBlockState(p).getBlock().material.isReplaceable()) {
                isDone = 20;
                if (placed >= blocksPerTick.getValue())
                    return;
                BlockInteractUtil.BlockPlaceResult res = BlockInteractUtil.tryPlaceBlock(p, new SpecBlockSwitchItem(i < 4 ? Blocks.SOUL_SAND : Blocks.SKULL), true, true, 4, true);
                if (res == BlockInteractUtil.BlockPlaceResult.PLACED) {
                    if (render.getValue())
                        new FadePos(p, fill, true);
                    placed++;
                } else if (res == BlockInteractUtil.BlockPlaceResult.WAIT)
                    return;
            }
        }
        if (isDone <= 0) {
            placeWither = null;
            if (witherPlaceMode.isValueName("ClickSkull"))
                Spark.switchManager.Switch(new SpecItemSwitchItem(Items.SKULL), ItemSwitcher.usedHand.Both);
        } else
            isDone--;
    } else if (placeWither == null) {
        if (witherPlaceMode.isValueName("Toggle"))
            setEnabled(false);
        else if (witherPlaceMode.isValueName("Walk") && mc.player.onGround) {
            int x = (int) Math.round(Math.max(-1, Math.min(1, (mc.player.posX - mc.player.lastTickPosX) * 22)));
            int y = (int) Math.round(Math.max(-1, Math.min(1, (mc.player.posZ - mc.player.lastTickPosZ) * 22)));
            if (x != 0 || y != 0) {
                BlockPos pos = PlayerUtil.getPlayerPosFloored(mc.player).add(-x * 2, -1, -y * 2);
                PlaceWitherAtPos(pos);
            }
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) FadePos(me.wallhacks.spark.util.objects.FadePos) SpecItemSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem) BlockInteractUtil(me.wallhacks.spark.util.player.BlockInteractUtil) EnumHand(net.minecraft.util.EnumHand) BlockPos(net.minecraft.util.math.BlockPos) MBlockPos(com.github.lunatrius.core.util.math.MBlockPos) SpecBlockSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem) EntityWither(net.minecraft.entity.boss.EntityWither) Vec3d(net.minecraft.util.math.Vec3d) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with SpecItemSwitchItem

use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.

the class CrystalAura method doPlace.

boolean doPlace() {
    if (currentCrystalBlockPos == null || !CanPlaceOnBlock(currentCrystalBlockPos, true))
        return false;
    if (placePauseTimer <= 0) {
        // get point for rotations
        if (delayTimer < 10 && slowFacePlace.getValue() && facePlace) {
            return false;
        }
        Vec3d pos = CrystalUtil.getRotationPos(true, currentCrystalBlockPos, currentCrystalEntity);
        if (pos == null)
            pos = new Vec3d(currentCrystalBlockPos).add(0.5, 1, 0.5);
        final RayTraceResult result = mc.world.rayTraceBlocks(PlayerUtil.getEyePos(), pos, false, true, false);
        EnumFacing facing = (result == null || !currentCrystalBlockPos.equals(result.getBlockPos()) || result.sideHit == null) ? EnumFacing.UP : result.sideHit;
        Vec3d v = new Vec3d(currentCrystalBlockPos).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getDirectionVec()).scale(0.5));
        if (result != null && currentCrystalBlockPos.equals(result.getBlockPos()) && result.hitVec != null)
            v = result.hitVec;
        if (currentCrystalBlockPos.getY() >= 254)
            facing = EnumFacing.EAST;
        renderVec = facing;
        // update offhand
        Offhand.instance.update();
        // hand
        EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.END_CRYSTAL), ItemSwitcher.usedHand.Both, Spark.switchManager.getModeFromString(switchingMode.getValue()), 10);
        if (hand == null)
            return false;
        // rotate if needed
        if (!rotate(false))
            return true;
        // send packet
        mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(currentCrystalBlockPos, facing, hand, (float) v.x, (float) v.y, (float) v.z));
        // swing
        switch(AntiCheatConfig.getInstance().crystalPlaceSwing.getValue()) {
            case "Normal":
                mc.player.swingArm(hand);
                break;
            case "Packet":
                mc.player.connection.sendPacket(new CPacketAnimation(hand));
                break;
        }
        if (!isUpdate) {
            Spark.switchManager.OnLateUpdate();
        }
        // apply cooldown/timeout if failed xamount(2by default) places
        PlaceTries++;
        if (PlaceTries >= placeTries.getValue())
            placePauseTimer = placeCooldown.getValue();
        // reset delay to wait time before next action
        delayTimer = 0;
        if (Debug.isOn())
            Spark.sendInfo("Place packet sent!");
    }
    return true;
}
Also used : SpecItemSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem) EnumFacing(net.minecraft.util.EnumFacing) EnumHand(net.minecraft.util.EnumHand) RayTraceResult(net.minecraft.util.math.RayTraceResult) CPacketAnimation(net.minecraft.network.play.client.CPacketAnimation) Vec3d(net.minecraft.util.math.Vec3d) CPacketPlayerTryUseItemOnBlock(net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)

Example 4 with SpecItemSwitchItem

use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.

the class Quiver method onUpdateEvent.

@SubscribeEvent
public void onUpdateEvent(PlayerUpdateEvent event) {
    if (nullCheck())
        return;
    if (mc.currentScreen != null)
        return;
    if (stage != 0 && Spark.switchManager.Switch(new SpecItemSwitchItem(Items.BOW), ItemSwitcher.usedHand.Mainhand) == null) {
        this.disable();
        Spark.sendInfo("No bow found");
        return;
    }
    if (stage == 0) {
        if (!mapArrows()) {
            this.disable();
            return;
        }
        stage++;
    } else if (stage == 1) {
        this.stage++;
        timer++;
        return;
    } else if (stage == 2) {
        mc.gameSettings.keyBindUseItem.pressed = true;
        timer = 0;
        this.stage++;
    } else if (stage == 3) {
        if (timer > 4) {
            this.stage++;
        }
    } else if (stage == 4) {
        mc.player.connection.sendPacket(new CPacketPlayer.Rotation(mc.player.rotationYaw, -90, mc.player.onGround));
        mc.player.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, mc.player.getHorizontalFacing()));
        mc.player.resetActiveHand();
        mc.gameSettings.keyBindUseItem.pressed = false;
        timer = 0;
        this.stage++;
    } else if (stage == 5) {
        if (timer < 12) {
            timer++;
            return;
        }
        this.stage = 0;
        timer = 0;
    }
    timer++;
}
Also used : CPacketPlayerDigging(net.minecraft.network.play.client.CPacketPlayerDigging) SpecItemSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem) CPacketPlayer(net.minecraft.network.play.client.CPacketPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with SpecItemSwitchItem

use of me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem in project Spark-Client by Spark-Client-Development.

the class ShulkerAura method placeCrystal.

private boolean placeCrystal(BlockPos placePos) {
    Vec3d pos = CrystalUtil.getRotationPos(true, placePos, null);
    if (pos == null)
        pos = new Vec3d(placePos).add(0.5, 1, 0.5);
    final RayTraceResult result = mc.world.rayTraceBlocks(PlayerUtil.getEyePos(), pos, false, true, false);
    EnumFacing facing = (result == null || !placePos.equals(result.getBlockPos()) || result.sideHit == null) ? EnumFacing.UP : result.sideHit;
    Vec3d v = new Vec3d(placePos).add(0.5, 0.5, 0.5).add(new Vec3d(facing.getDirectionVec()).scale(0.5));
    if (result != null && placePos.equals(result.getBlockPos()) && result.hitVec != null)
        v = result.hitVec;
    // offhand
    EnumHand hand = Spark.switchManager.Switch(new SpecItemSwitchItem(Items.END_CRYSTAL), ItemSwitcher.usedHand.Both, ItemSwitcher.switchType.Normal);
    if (hand == null) {
        disable();
        return false;
    }
    // rotate if needed
    if (!Spark.rotationManager.rotate(RotationUtil.getViewRotations(pos, mc.player), AntiCheatConfig.INSTANCE.getCrystalRotStep(), 2, false)) {
        return true;
    }
    // send packet
    mc.player.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(placePos, facing, hand, (float) v.x, (float) v.y, (float) v.z));
    // swing da arms
    switch(AntiCheatConfig.getInstance().crystalPlaceSwing.getValue()) {
        case "Normal":
            mc.player.swingArm(hand);
            break;
        case "Packet":
            mc.player.connection.sendPacket(new CPacketAnimation(hand));
            break;
    }
    return true;
}
Also used : SpecItemSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem) EnumFacing(net.minecraft.util.EnumFacing) EnumHand(net.minecraft.util.EnumHand) RayTraceResult(net.minecraft.util.math.RayTraceResult) CPacketAnimation(net.minecraft.network.play.client.CPacketAnimation) Vec3d(net.minecraft.util.math.Vec3d) CPacketPlayerTryUseItemOnBlock(net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)

Aggregations

SpecItemSwitchItem (me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem)6 EnumHand (net.minecraft.util.EnumHand)4 CPacketAnimation (net.minecraft.network.play.client.CPacketAnimation)3 CPacketPlayerTryUseItemOnBlock (net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)3 EnumFacing (net.minecraft.util.EnumFacing)3 Vec3d (net.minecraft.util.math.Vec3d)3 FadePos (me.wallhacks.spark.util.objects.FadePos)2 RayTraceResult (net.minecraft.util.math.RayTraceResult)2 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)2 MBlockPos (com.github.lunatrius.core.util.math.MBlockPos)1 BlockInteractUtil (me.wallhacks.spark.util.player.BlockInteractUtil)1 ItemSwitcher (me.wallhacks.spark.util.player.itemswitcher.ItemSwitcher)1 SpecBlockSwitchItem (me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem)1 Entity (net.minecraft.entity.Entity)1 EntityWither (net.minecraft.entity.boss.EntityWither)1 CPacketPlayer (net.minecraft.network.play.client.CPacketPlayer)1 CPacketPlayerDigging (net.minecraft.network.play.client.CPacketPlayerDigging)1 CPacketPlayerTryUseItem (net.minecraft.network.play.client.CPacketPlayerTryUseItem)1 BlockPos (net.minecraft.util.math.BlockPos)1