Search in sources :

Example 1 with FadePos

use of me.wallhacks.spark.util.objects.FadePos in project Spark-Client by Spark-Client-Development.

the class FadeManager method onRender.

@SubscribeEvent
public void onRender(RenderWorldLastEvent event) {
    ArrayList<BlockPos> remove = new ArrayList<>();
    int maxTime = (int) (ClientConfig.getInstance().getFadeTime() * 1000);
    for (FadePos pos : getPositions()) {
        int current = (int) pos.fadeTimer.getPassedTimeMs();
        if (current > maxTime) {
            remove.add(pos.pos);
            continue;
        }
        Color fill;
        if (pos.isFading()) {
            double percent = Math.min((double) (maxTime - current) / maxTime, 1);
            fill = new Color(pos.fill.getColor().getRed(), pos.fill.getColor().getGreen(), pos.fill.getColor().getBlue(), (int) (pos.fill.getColor().getAlpha() * percent));
        } else {
            fill = pos.fill.getColor();
            pos.fadeTimer.reset();
        }
        EspUtil.drawBox(pos.pos, fill);
        EspUtil.drawOutline(pos.pos, fill.brighter());
    }
    for (BlockPos r : remove) {
        positions.remove(r);
    }
}
Also used : FadePos(me.wallhacks.spark.util.objects.FadePos) ArrayList(java.util.ArrayList) BlockPos(net.minecraft.util.math.BlockPos) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 2 with FadePos

use of me.wallhacks.spark.util.objects.FadePos 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 3 with FadePos

use of me.wallhacks.spark.util.objects.FadePos in project Spark-Client by Spark-Client-Development.

the class CrystalAura method getCrystalPlacePos.

void getCrystalPlacePos() {
    BlockPos bestPos = null;
    targetEntity = null;
    float bestValue = 0;
    for (BlockPos pos : WorldUtils.getSphere(PlayerUtil.getPlayerPosFloored(mc.player), 7, 7, 1)) {
        if (CanPlaceOnBlock(pos, false)) {
            ValueForExplodingCrystalAtPoint Value = getValueForCrystalExplodingAtPoint(new Vec3d(pos.getX() + 0.5f, pos.getY() + 1, pos.getZ() + 0.5f), prePlace.getValue());
            if (pos.equals(currentCrystalBlockPos) && Value.value > 0)
                Value.value += switchThreshold.getValue();
            if (Value.value > bestValue) {
                bestValue = Value.value;
                if (Value.target != null)
                    targetEntity = Value.target.entity;
                bestPos = pos;
                facePlace = Value.facePlace;
            }
        }
    }
    currentCrystalBlockPos = bestPos;
    if (bestPos != null) {
        if (currentPos == null) {
            currentPos = new FadePos(bestPos, fill, false);
        } else if (currentPos.pos != bestPos) {
            currentPos.startFade();
            currentPos = new FadePos(bestPos, fill, false);
        }
    } else if (currentPos != null) {
        currentPos.startFade();
        currentPos = null;
    }
    if (currentPos != null)
        Spark.fadeManager.getPositions().removeIf(fadePos -> fadePos.pos.equals(currentPos.pos) && fadePos != currentPos);
}
Also used : WorldUtils(me.wallhacks.spark.util.WorldUtils) AttackUtil(me.wallhacks.spark.util.combat.AttackUtil) SpecItemSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem) Arrays(java.util.Arrays) Blocks(net.minecraft.init.Blocks) PlayerUtil(me.wallhacks.spark.util.player.PlayerUtil) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) EnumHand(net.minecraft.util.EnumHand) EspUtil(me.wallhacks.spark.util.render.EspUtil) RenderWorldLastEvent(net.minecraftforge.client.event.RenderWorldLastEvent) ArrayList(java.util.ArrayList) me.wallhacks.spark.systems.setting.settings(me.wallhacks.spark.systems.setting.settings) ItemStack(net.minecraft.item.ItemStack) RayTraceResult(net.minecraft.util.math.RayTraceResult) RaytraceUtil(me.wallhacks.spark.util.player.RaytraceUtil) CPacketPlayerTryUseItemOnBlock(net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock) Block(net.minecraft.block.Block) SPacketExplosion(net.minecraft.network.play.server.SPacketExplosion) Vec3d(net.minecraft.util.math.Vec3d) Side(net.minecraftforge.fml.relauncher.Side) ItemSwitcher(me.wallhacks.spark.util.player.itemswitcher.ItemSwitcher) CPacketAnimation(net.minecraft.network.play.client.CPacketAnimation) PredictedEntity(me.wallhacks.spark.util.objects.PredictedEntity) Spark(me.wallhacks.spark.Spark) ItemArmor(net.minecraft.item.ItemArmor) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Entity(net.minecraft.entity.Entity) Packet(net.minecraft.network.Packet) CrystalUtil(me.wallhacks.spark.util.combat.CrystalUtil) Iterator(java.util.Iterator) Items(net.minecraft.init.Items) PlayerUpdateEvent(me.wallhacks.spark.event.player.PlayerUpdateEvent) AntiCheatConfig(me.wallhacks.spark.systems.clientsetting.clientsettings.AntiCheatConfig) EnumFacing(net.minecraft.util.EnumFacing) ItemFood(net.minecraft.item.ItemFood) BlockPos(net.minecraft.util.math.BlockPos) Module(me.wallhacks.spark.systems.module.Module) FadePos(me.wallhacks.spark.util.objects.FadePos) TextComponentString(net.minecraft.util.text.TextComponentString) java.awt(java.awt) Offhand(me.wallhacks.spark.systems.module.modules.player.Offhand) EntityLivingBase(net.minecraft.entity.EntityLivingBase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent) EntityAddEvent(me.wallhacks.spark.event.player.EntityAddEvent) ConcurrentModificationException(java.util.ConcurrentModificationException) PacketReceiveEvent(me.wallhacks.spark.event.player.PacketReceiveEvent) FadePos(me.wallhacks.spark.util.objects.FadePos) BlockPos(net.minecraft.util.math.BlockPos) Vec3d(net.minecraft.util.math.Vec3d)

Example 4 with FadePos

use of me.wallhacks.spark.util.objects.FadePos in project Spark-Client by Spark-Client-Development.

the class Surround method OnUpdate.

@SubscribeEvent
void OnUpdate(PlayerUpdateEvent event) {
    isPlacing = false;
    // PlayerUtil.isInBlocks(mc.player) checks if we are in blocks
    if (disable.is("OffGround") && !PlayerUtil.isInBlocks(mc.player) && !mc.player.onGround) {
        disable();
        return;
    }
    BlockPos blockUnderPlayer = PlayerUtil.getPlayerPosFloored(mc.player, 0.2);
    if (!SnapToCenter.isValueName("Off"))
        if (!PlayerUtil.MoveCenter(blockUnderPlayer, SnapToCenter.isValueName("OnPlace")))
            return;
    ArrayList<BlockPos> aroundPlayer = new ArrayList<BlockPos>();
    List<BlockPos> occupiedByPlayer = WorldUtils.getBlocksOccupiedByBox(mc.player.boundingBox);
    for (BlockPos floored : occupiedByPlayer) {
        BlockPos[] poses = new BlockPos[] { floored.add(1, 0, 0), floored.add(0, 0, 1), floored.add(-1, 0, 0), floored.add(0, 0, -1) };
        for (BlockPos p : poses) if (!occupiedByPlayer.contains(p)) {
            aroundPlayer.add(p);
        }
        for (BlockPos p : poses) if (occupiedByPlayer.contains(p))
            aroundPlayer.add(p.add(0, -1, 0));
    }
    ArrayList<BlockPos> poses = new ArrayList<BlockPos>();
    if (bottomFill.isOn() && mc.player.isJumping) {
        if (!poses.contains(blockUnderPlayer.add(0, -1, 0)))
            poses.add(blockUnderPlayer.add(0, -1, 0));
    }
    for (BlockPos p : aroundPlayer) {
        if (!poses.contains(p))
            poses.add(p);
    }
    if (bottomFill.isOn() && !mc.player.isJumping) {
        if (!poses.contains(blockUnderPlayer.add(0, -1, 0)))
            poses.add(blockUnderPlayer.add(0, -1, 0));
    }
    int placed = 0;
    boolean done = true;
    for (BlockPos x : poses) {
        if (mc.world.getBlockState(x).getBlock().material.isReplaceable()) {
            BlockPos p = getBlockPosToPlaceAtBlock(x);
            if (p != null) {
                done = false;
                BlockInteractUtil.BlockPlaceResult res = Place(p);
                if (res != BlockInteractUtil.BlockPlaceResult.FAILED)
                    isPlacing = true;
                if (res == BlockInteractUtil.BlockPlaceResult.PLACED) {
                    if (render.getValue())
                        new FadePos(p, fill, true);
                    placed++;
                } else if (res == BlockInteractUtil.BlockPlaceResult.WAIT)
                    return;
                if (placed >= blocksPerTick.getValue())
                    return;
            }
        }
    }
    if (done && disable.is("Done"))
        this.disable();
}
Also used : FadePos(me.wallhacks.spark.util.objects.FadePos) BlockInteractUtil(me.wallhacks.spark.util.player.BlockInteractUtil) ArrayList(java.util.ArrayList) BlockPos(net.minecraft.util.math.BlockPos) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 5 with FadePos

use of me.wallhacks.spark.util.objects.FadePos 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)

Aggregations

FadePos (me.wallhacks.spark.util.objects.FadePos)11 BlockPos (net.minecraft.util.math.BlockPos)9 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)7 BlockInteractUtil (me.wallhacks.spark.util.player.BlockInteractUtil)5 Block (net.minecraft.block.Block)5 ArrayList (java.util.ArrayList)4 MBlockPos (com.github.lunatrius.core.util.math.MBlockPos)3 SpecBlockSwitchItem (me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem)3 SpecItemSwitchItem (me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecItemSwitchItem)3 EnumFacing (net.minecraft.util.EnumFacing)3 EnumHand (net.minecraft.util.EnumHand)3 Entity (net.minecraft.entity.Entity)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 CPacketAnimation (net.minecraft.network.play.client.CPacketAnimation)2 CPacketPlayerTryUseItemOnBlock (net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock)2 Vec3d (net.minecraft.util.math.Vec3d)2 java.awt (java.awt)1 Arrays (java.util.Arrays)1 ConcurrentModificationException (java.util.ConcurrentModificationException)1 Iterator (java.util.Iterator)1