Search in sources :

Example 1 with HardSolidBlockSwitchItem

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

the class Surround method Place.

BlockInteractUtil.BlockPlaceResult Place(BlockPos x) {
    ArrayList<EntityEnderCrystal> crystals = new ArrayList<EntityEnderCrystal>();
    boolean isblocked = false;
    List<Entity> l = mc.world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(x));
    for (Entity e : l) {
        if (!(e instanceof EntityItem) && !(e instanceof EntityXPOrb) && !e.isDead) {
            isblocked = true;
            if (e instanceof EntityEnderCrystal && (IgnoreCrystals.isOn() || BreakCrystals.isOn())) {
                crystals.add((EntityEnderCrystal) e);
            } else
                return BlockInteractUtil.BlockPlaceResult.FAILED;
        }
    }
    if (BreakCrystals.isOn())
        for (EntityEnderCrystal entity : crystals) {
            mc.player.connection.sendPacket(new CPacketUseEntity(entity));
            mc.player.swingArm(EnumHand.MAIN_HAND);
        }
    BlockInteractUtil.BlockPlaceResult res = (BlockInteractUtil.tryPlaceBlock(x, allowNonObi.isOn() ? new HardSolidBlockSwitchItem() : new SpecBlockSwitchItem(Blocks.OBSIDIAN), Spark.switchManager.getModeFromString(switchingMode.getValue()), false, false, 4, blocksPerTick.getValue() > 1));
    return res;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) CPacketUseEntity(net.minecraft.network.play.client.CPacketUseEntity) Entity(net.minecraft.entity.Entity) EntityEnderCrystal(net.minecraft.entity.item.EntityEnderCrystal) ArrayList(java.util.ArrayList) SpecBlockSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem) CPacketUseEntity(net.minecraft.network.play.client.CPacketUseEntity) BlockInteractUtil(me.wallhacks.spark.util.player.BlockInteractUtil) HardSolidBlockSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.HardSolidBlockSwitchItem) EntityItem(net.minecraft.entity.item.EntityItem) EntityXPOrb(net.minecraft.entity.item.EntityXPOrb)

Example 2 with HardSolidBlockSwitchItem

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

the class Burrow method OnUpdate.

@SubscribeEvent
void OnUpdate(PlayerUpdateEvent event) {
    BlockPos floored = PlayerUtil.getPlayerPosFloored(mc.player, 0.2);
    BlockPos pos = floored.add(0, -1, 0);
    if (mc.world.getBlockState(floored).getBlock().material.isSolid() && !mc.world.getBlockState(floored.add(0, 1, 0)).getBlock().material.isSolid()) {
        if (bypass.isOn()) {
            mc.player.motionY = 0;
        } else if (KeepPlayer.isOn()) {
            Vec3d Center = new Vec3d(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            double l_XDiff = Math.abs(Center.x - mc.player.posX);
            double l_ZDiff = Math.abs(Center.z - mc.player.posZ);
            if (l_XDiff <= 0.1 && l_ZDiff <= 0.1) {
                Center = Vec3d.ZERO;
            } else {
                double l_MotionX = Center.x - mc.player.posX;
                double l_MotionZ = Center.z - mc.player.posZ;
                mc.player.motionX = l_MotionX * 0.6f;
                mc.player.motionZ = l_MotionZ * 0.6f;
            }
        }
    } else if (status > 20)
        this.setEnabled(false);
    if (status == 0) {
        if (!mc.player.onGround) {
            this.setEnabled(false);
            return;
        } else {
            List<Entity> l = mc.world.getEntitiesWithinAABBExcludingEntity(mc.player, new AxisAlignedBB(floored));
            for (Entity e : l) {
                if (!(e instanceof EntityItem) && !e.isDead) {
                    this.setEnabled(false);
                    return;
                }
            }
        }
        if (Surround.instance.isPlacing())
            return;
        if (center.isOn()) {
            Vec3d Center = new Vec3d(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
            double l_XDiff = Math.abs(Center.x - mc.player.posX);
            double l_ZDiff = Math.abs(Center.z - mc.player.posZ);
            if (l_XDiff <= 0.1 && l_ZDiff <= 0.1) {
            } else {
                double l_MotionX = Center.x - mc.player.posX;
                double l_MotionZ = Center.z - mc.player.posZ;
                mc.player.motionX = l_MotionX / 2;
                mc.player.motionZ = l_MotionZ / 2;
                return;
            }
        }
        EnumHand hand = Spark.switchManager.Switch(new SpecBlockSwitchItem(getUse()), ItemSwitcher.usedHand.Both);
        if (UseOtherBlocks.isOn() && hand == null)
            hand = Spark.switchManager.Switch(new HardSolidBlockSwitchItem(), ItemSwitcher.usedHand.Both);
        if (hand == null) {
            this.setEnabled(false);
            return;
        }
        if (Rotate.isOn()) {
            sendPlayerRot(90, 90, true);
        }
        if (OneTick.isOn())
            status = 1;
    }
    if (status == 1) {
        Spark.rotationManager.setCancelNextWalkingUpdate();
        sendPlayerPos(mc.player.posX, mc.player.posY + 0.41999998688698, mc.player.posZ, false);
        sendPlayerPos(mc.player.posX, mc.player.posY + 0.7531999805212, mc.player.posZ, false);
        sendPlayerPos(mc.player.posX, mc.player.posY + 1.001335979, mc.player.posZ, false);
        sendPlayerPos(mc.player.posX, mc.player.posY + 1.16610926, mc.player.posZ, false);
        EnumHand hand = Spark.switchManager.Switch(new SpecBlockSwitchItem(getUse()), ItemSwitcher.usedHand.Both);
        if (UseOtherBlocks.isOn() && hand == null)
            hand = Spark.switchManager.Switch(new HardSolidBlockSwitchItem(), ItemSwitcher.usedHand.Both);
        if (hand == null) {
            this.setEnabled(false);
            return;
        }
        if (!BlockInteractUtil.processRightClickBlock(pos, EnumFacing.UP, false, hand, new Vec3d(mc.player.posX, pos.getY() + 0.5, mc.player.posZ)))
            return;
        Spark.sendInfo("placing burrow block");
        if (OneTick.isOn())
            status = 2;
    }
    if (status == 2) {
        Vec3i clip = getClip();
        sendPlayerPos(mc.player.posX + clip.getX(), mc.player.posY + clip.getY(), mc.player.posZ + clip.getZ(), true);
    }
    status++;
}
Also used : AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) Entity(net.minecraft.entity.Entity) Vec3i(net.minecraft.util.math.Vec3i) EnumHand(net.minecraft.util.EnumHand) BlockPos(net.minecraft.util.math.BlockPos) SpecBlockSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem) HardSolidBlockSwitchItem(me.wallhacks.spark.util.player.itemswitcher.itemswitchers.HardSolidBlockSwitchItem) Vec3d(net.minecraft.util.math.Vec3d) EntityItem(net.minecraft.entity.item.EntityItem) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

HardSolidBlockSwitchItem (me.wallhacks.spark.util.player.itemswitcher.itemswitchers.HardSolidBlockSwitchItem)2 SpecBlockSwitchItem (me.wallhacks.spark.util.player.itemswitcher.itemswitchers.SpecBlockSwitchItem)2 Entity (net.minecraft.entity.Entity)2 EntityItem (net.minecraft.entity.item.EntityItem)2 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)2 ArrayList (java.util.ArrayList)1 BlockInteractUtil (me.wallhacks.spark.util.player.BlockInteractUtil)1 EntityEnderCrystal (net.minecraft.entity.item.EntityEnderCrystal)1 EntityXPOrb (net.minecraft.entity.item.EntityXPOrb)1 CPacketUseEntity (net.minecraft.network.play.client.CPacketUseEntity)1 EnumHand (net.minecraft.util.EnumHand)1 BlockPos (net.minecraft.util.math.BlockPos)1 Vec3d (net.minecraft.util.math.Vec3d)1 Vec3i (net.minecraft.util.math.Vec3i)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1