Search in sources :

Example 1 with TargetResult

use of me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult in project 3arthh4ck by 3arthqu4ke.

the class ObbyListener method update.

protected boolean update() {
    if (updatePlaced()) {
        return false;
    }
    module.slot = getSlot();
    if (module.slot == -1) {
        disableModule();
        return false;
    }
    if (hasTimerNotPassed()) {
        return false;
    }
    TargetResult result = getTargets(new TargetResult());
    targets = result.getTargets();
    return result.isValid();
}
Also used : TargetResult(me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult)

Example 2 with TargetResult

use of me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult in project 3arthh4ck by 3arthqu4ke.

the class ListenerWebAura method getTargets.

@Override
protected TargetResult getTargets(TargetResult result) {
    switch(module.target.getValue()) {
        case Closest:
            module.currentTarget = EntityUtil.getClosestEnemy();
            if (module.currentTarget == null || module.currentTarget.getDistanceSq(mc.player) > MathUtil.square(module.targetRange.getValue())) {
                return result.setValid(false);
            }
            return trap(module.currentTarget, result);
        case Untrapped:
            module.currentTarget = null;
            List<EntityPlayer> players = new ArrayList<>();
            for (EntityPlayer player : mc.world.playerEntities) {
                if (player == null || EntityUtil.isDead(player) || Managers.FRIENDS.contains(player) || player.equals(mc.player)) {
                    continue;
                }
                BlockPos pos = new BlockPos(player);
                if (mc.world.getBlockState(pos).getBlock() == Blocks.WEB || mc.world.getBlockState(pos.up()).getBlock() == Blocks.WEB) {
                    continue;
                }
                if (mc.player.getDistanceSq(player) < MathUtil.square(module.targetRange.getValue())) {
                    players.add(player);
                }
            }
            players.sort(Comparator.comparingDouble(p -> p.getDistanceSq(mc.player)));
            for (EntityPlayer player : players) {
                trap(player, result);
            }
            return result;
        default:
            return result.setValid(false);
    }
}
Also used : Entity(net.minecraft.entity.Entity) Blocks(net.minecraft.init.Blocks) Managers(me.earth.earthhack.impl.managers.Managers) TargetResult(me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult) BlockPos(net.minecraft.util.math.BlockPos) ArrayList(java.util.ArrayList) IBlockState(net.minecraft.block.state.IBlockState) MathUtil(me.earth.earthhack.impl.util.math.MathUtil) List(java.util.List) EntityPlayer(net.minecraft.entity.player.EntityPlayer) NoAttackObbyListener(me.earth.earthhack.impl.util.helpers.blocks.noattack.NoAttackObbyListener) InventoryUtil(me.earth.earthhack.impl.util.minecraft.InventoryUtil) Comparator(java.util.Comparator) EntityUtil(me.earth.earthhack.impl.util.minecraft.entity.EntityUtil) ArrayList(java.util.ArrayList) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos)

Example 3 with TargetResult

use of me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult in project 3arthh4ck by 3arthqu4ke.

the class ListenerObby method getTargets.

@Override
protected TargetResult getTargets(TargetResult result) {
    if (module.calcTimer.passed(module.calcDelay.getValue())) {
        HoleRunnable runnable = new HoleRunnable(module, module);
        runnable.run();
        module.calcTimer.reset();
    }
    List<BlockPos> targets = new ArrayList<>(module.safes.size() + module.unsafes.size() + module.longs.size() + module.bigs.size());
    targets.addAll(module.safes);
    targets.addAll(module.unsafes);
    if (module.longHoles.getValue()) {
        targets.addAll(module.longs);
    }
    if (module.bigHoles.getValue()) {
        targets.addAll(module.bigs);
    }
    BlockPos playerPos = PositionUtil.getPosition();
    if (!HoleUtil.isHole(playerPos, false)[0] && !HoleUtil.is2x1(playerPos) && !HoleUtil.is2x2(playerPos) && (!module.safety.getValue() || !Managers.SAFETY.isSafe())) {
        EntityPlayer p = RotationUtil.getRotationPlayer();
        Vec3d v = p.getPositionVector().add(p.motionX, p.motionY, p.motionZ);
        targets.removeIf(pos -> pos.distanceSq(v.x, v.y, v.z) < MathUtil.square(module.minSelf.getValue()));
        // place furthest first
        targets.sort(Comparator.comparingDouble(pos -> -BlockUtil.getDistanceSq(pos)));
    }
    module.target = EntityUtil.getClosestEnemy();
    if (module.target != null) {
        targets.removeIf(p -> BlockUtil.getDistanceSq(module.target, p) > MathUtil.square(module.targetDistance.getValue()));
        targets.sort(Comparator.comparingDouble(p -> BlockUtil.getDistanceSq(module.target, p)));
    }
    result.setTargets(targets);
    return result;
}
Also used : ObbyListener(me.earth.earthhack.impl.util.helpers.blocks.ObbyListener) Managers(me.earth.earthhack.impl.managers.Managers) TargetResult(me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult) RotationUtil(me.earth.earthhack.impl.util.math.rotation.RotationUtil) BlockUtil(me.earth.earthhack.impl.util.minecraft.blocks.BlockUtil) HoleUtil(me.earth.earthhack.impl.util.minecraft.blocks.HoleUtil) BlockPos(net.minecraft.util.math.BlockPos) MotionUpdateEvent(me.earth.earthhack.impl.event.events.network.MotionUpdateEvent) ArrayList(java.util.ArrayList) MathUtil(me.earth.earthhack.impl.util.math.MathUtil) PositionUtil(me.earth.earthhack.impl.util.math.position.PositionUtil) List(java.util.List) Vec3d(net.minecraft.util.math.Vec3d) HoleRunnable(me.earth.earthhack.impl.managers.thread.holes.HoleRunnable) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EventBus(me.earth.earthhack.api.event.bus.api.EventBus) Comparator(java.util.Comparator) EntityUtil(me.earth.earthhack.impl.util.minecraft.entity.EntityUtil) HoleRunnable(me.earth.earthhack.impl.managers.thread.holes.HoleRunnable) ArrayList(java.util.ArrayList) EntityPlayer(net.minecraft.entity.player.EntityPlayer) BlockPos(net.minecraft.util.math.BlockPos) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

TargetResult (me.earth.earthhack.impl.util.helpers.blocks.util.TargetResult)3 ArrayList (java.util.ArrayList)2 Comparator (java.util.Comparator)2 List (java.util.List)2 Managers (me.earth.earthhack.impl.managers.Managers)2 MathUtil (me.earth.earthhack.impl.util.math.MathUtil)2 EntityUtil (me.earth.earthhack.impl.util.minecraft.entity.EntityUtil)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 BlockPos (net.minecraft.util.math.BlockPos)2 EventBus (me.earth.earthhack.api.event.bus.api.EventBus)1 MotionUpdateEvent (me.earth.earthhack.impl.event.events.network.MotionUpdateEvent)1 HoleRunnable (me.earth.earthhack.impl.managers.thread.holes.HoleRunnable)1 ObbyListener (me.earth.earthhack.impl.util.helpers.blocks.ObbyListener)1 NoAttackObbyListener (me.earth.earthhack.impl.util.helpers.blocks.noattack.NoAttackObbyListener)1 PositionUtil (me.earth.earthhack.impl.util.math.position.PositionUtil)1 RotationUtil (me.earth.earthhack.impl.util.math.rotation.RotationUtil)1 InventoryUtil (me.earth.earthhack.impl.util.minecraft.InventoryUtil)1 BlockUtil (me.earth.earthhack.impl.util.minecraft.blocks.BlockUtil)1 HoleUtil (me.earth.earthhack.impl.util.minecraft.blocks.HoleUtil)1 IBlockState (net.minecraft.block.state.IBlockState)1