Search in sources :

Example 1 with EventHandler

use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.

the class Painter method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    // Tick delay
    if (delay.get() != 0 && ticksWaited < delay.get() - 1) {
        ticksWaited++;
        return;
    } else
        ticksWaited = 0;
    // Get slot
    FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> block.get() == Block.getBlockFromItem(itemStack.getItem()));
    if (!findItemResult.found()) {
        error("No selected blocks in hotbar");
        toggle();
        return;
    }
    // Find spots
    for (BlockPos blockPos : WorldUtils.getSphere(mc.player.getBlockPos(), range.get(), range.get())) {
        if (shouldPlace(blockPos, block.get()))
            positions.add(blockPos);
    }
    // Place
    for (BlockPos blockPos : positions) {
        BlockUtils.place(blockPos, findItemResult, rotate.get(), -100, false);
        // Delay 0
        if (delay.get() != 0)
            break;
    }
}
Also used : FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) BlockPos(net.minecraft.util.math.BlockPos) EventHandler(meteordevelopment.orbit.EventHandler)

Example 2 with EventHandler

use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.

the class BoatPhase method onBoatMove.

@EventHandler
private void onBoatMove(BoatMoveEvent event) {
    if (mc.player.getVehicle() != null && mc.player.getVehicle().getType().equals(EntityType.BOAT)) {
        if (boat != mc.player.getVehicle()) {
            if (boat != null) {
                boat.noClip = false;
            }
            boat = (BoatEntity) mc.player.getVehicle();
        }
    } else
        boat = null;
    if (boat != null) {
        boat.noClip = true;
        if (lockYaw.get()) {
            boat.setYaw(mc.player.getYaw());
        }
        Vec3d vel;
        if (adjustHorizontalSpeed.get()) {
            vel = PlayerUtils.getHorizontalVelocity(horizontalSpeed.get());
        } else {
            vel = boat.getVelocity();
        }
        double velX = vel.x;
        double velY = 0;
        double velZ = vel.z;
        if (verticalControl.get()) {
            if (mc.options.jumpKey.isPressed())
                velY += verticalSpeed.get() / 20;
            if (mc.options.sprintKey.isPressed())
                velY -= verticalSpeed.get() / 20;
            else if (fall.get())
                velY -= fallSpeed.get() / 20;
        } else if (fall.get())
            velY -= fallSpeed.get() / 20;
        ((IVec3d) boat.getVelocity()).set(velX, velY, velZ);
    }
}
Also used : IVec3d(meteordevelopment.meteorclient.mixininterface.IVec3d) Vec3d(net.minecraft.util.math.Vec3d) IVec3d(meteordevelopment.meteorclient.mixininterface.IVec3d) EventHandler(meteordevelopment.orbit.EventHandler)

Example 3 with EventHandler

use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.

the class ColorSigns method onPacketSend.

@EventHandler
private void onPacketSend(PacketEvent.Send event) {
    if (event.packet instanceof GameJoinS2CPacket) {
        checkWarning();
        return;
    }
    if (!(event.packet instanceof UpdateSignC2SPacket))
        return;
    UpdateSignC2SPacket p = (UpdateSignC2SPacket) event.packet;
    for (int l = 0; l < p.getText().length; l++) {
        String newText = p.getText()[l].replaceAll("(?i)\u00a7|&([0-9A-FK-OR])", "\u00a7\u00a7$1$1");
        p.getText()[l] = newText;
    }
    event.packet = p;
}
Also used : GameJoinS2CPacket(net.minecraft.network.packet.s2c.play.GameJoinS2CPacket) UpdateSignC2SPacket(net.minecraft.network.packet.c2s.play.UpdateSignC2SPacket) EventHandler(meteordevelopment.orbit.EventHandler)

Example 4 with EventHandler

use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.

the class Confuse method onRender.

@EventHandler
private void onRender(Render3DEvent event) {
    if (target == null)
        return;
    boolean flag = budgetGraphics.get();
    Vec3d last = null;
    addition += flag ? 0 : 1.0;
    if (addition > 360)
        addition = 0;
    for (int i = 0; i < 360; i += flag ? 7 : 1) {
        Color c1;
        if (flag)
            c1 = circleColor.get();
        else {
            double rot = (255.0 * 3) * (((((double) i) + addition) % 360) / 360.0);
            int seed = (int) Math.floor(rot / 255.0);
            double current = rot % 255;
            double red = seed == 0 ? current : (seed == 1 ? Math.abs(current - 255) : 0);
            double green = seed == 1 ? current : (seed == 2 ? Math.abs(current - 255) : 0);
            double blue = seed == 2 ? current : (seed == 0 ? Math.abs(current - 255) : 0);
            c1 = new Color((int) red, (int) green, (int) blue);
        }
        Vec3d tp = target.getPos();
        double rad = Math.toRadians(i);
        double sin = Math.sin(rad) * 3;
        double cos = Math.cos(rad) * 3;
        Vec3d c = new Vec3d(tp.x + sin, tp.y + target.getHeight() / 2, tp.z + cos);
        if (last != null)
            event.renderer.line(last.x, last.y, last.z, c.x, c.y, c.z, c1);
        last = c;
    }
}
Also used : Color(meteordevelopment.meteorclient.utils.render.color.Color) SettingColor(meteordevelopment.meteorclient.utils.render.color.SettingColor) Vec3d(net.minecraft.util.math.Vec3d) EventHandler(meteordevelopment.orbit.EventHandler)

Example 5 with EventHandler

use of meteordevelopment.orbit.EventHandler in project meteor-rejects by AntiCope.

the class Confuse method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    // Delay
    delayWaited++;
    if (delayWaited < delay.get())
        return;
    delayWaited = 0;
    // Targetting
    target = TargetUtils.getPlayerTarget(range.get(), priority.get());
    if (target == null)
        return;
    Vec3d entityPos = target.getPos();
    Vec3d playerPos = mc.player.getPos();
    Random r = new Random();
    BlockHitResult hit;
    int halfRange = range.get() / 2;
    switch(mode.get()) {
        case RandomTP:
            double x = r.nextDouble() * range.get() - halfRange;
            double y = 0;
            double z = r.nextDouble() * range.get() - halfRange;
            Vec3d addend = new Vec3d(x, y, z);
            Vec3d goal = entityPos.add(addend);
            if (mc.world.getBlockState(new BlockPos(goal.x, goal.y, goal.z)).getBlock() != Blocks.AIR) {
                goal = new Vec3d(x, playerPos.y, z);
            }
            if (mc.world.getBlockState(new BlockPos(goal.x, goal.y, goal.z)).getBlock() == Blocks.AIR) {
                hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
                if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
                    delayWaited = (int) (delay.get() - 1);
                    break;
                }
                mc.player.updatePosition(goal.x, goal.y, goal.z);
            } else {
                delayWaited = (int) (delay.get() - 1);
            }
            break;
        case Switch:
            Vec3d diff = entityPos.subtract(playerPos);
            Vec3d diff1 = new Vec3d(Utils.clamp(diff.x, -halfRange, halfRange), Utils.clamp(diff.y, -halfRange, halfRange), Utils.clamp(diff.z, -halfRange, halfRange));
            Vec3d goal2 = entityPos.add(diff1);
            hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), goal2, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
            if (!moveThroughBlocks.get() && hit.isInsideBlock()) {
                delayWaited = (int) (delay.get() - 1);
                break;
            }
            mc.player.updatePosition(goal2.x, goal2.y, goal2.z);
            break;
        case Circle:
            delay.set(0);
            circleProgress += circleSpeed.get();
            if (circleProgress > 360)
                circleProgress -= 360;
            double rad = Math.toRadians(circleProgress);
            double sin = Math.sin(rad) * 3;
            double cos = Math.cos(rad) * 3;
            Vec3d current = new Vec3d(entityPos.x + sin, playerPos.y, entityPos.z + cos);
            hit = mc.world.raycast(new RaycastContext(mc.player.getPos(), current, RaycastContext.ShapeType.COLLIDER, RaycastContext.FluidHandling.ANY, mc.player));
            if (!moveThroughBlocks.get() && hit.isInsideBlock())
                break;
            mc.player.updatePosition(current.x, current.y, current.z);
            break;
    }
}
Also used : Random(java.util.Random) RaycastContext(net.minecraft.world.RaycastContext) BlockPos(net.minecraft.util.math.BlockPos) BlockHitResult(net.minecraft.util.hit.BlockHitResult) Vec3d(net.minecraft.util.math.Vec3d) EventHandler(meteordevelopment.orbit.EventHandler)

Aggregations

EventHandler (meteordevelopment.orbit.EventHandler)103 BlockPos (net.minecraft.util.math.BlockPos)29 FindItemResult (meteordevelopment.meteorclient.utils.player.FindItemResult)25 Vec3d (net.minecraft.util.math.Vec3d)25 TickEvent (meteordevelopment.meteorclient.events.world.TickEvent)11 Module (meteordevelopment.meteorclient.systems.modules.Module)11 Entity (net.minecraft.entity.Entity)10 PlayerEntity (net.minecraft.entity.player.PlayerEntity)10 BlockUtils (meteordevelopment.meteorclient.utils.world.BlockUtils)9 BlockHitResult (net.minecraft.util.hit.BlockHitResult)9 SettingColor (meteordevelopment.meteorclient.utils.render.color.SettingColor)8 Direction (net.minecraft.util.math.Direction)8 ArrayList (java.util.ArrayList)7 InvUtils (meteordevelopment.meteorclient.utils.player.InvUtils)7 ItemStack (net.minecraft.item.ItemStack)7 PlayerMoveC2SPacket (net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket)7 Comparator (java.util.Comparator)6 meteordevelopment.meteorclient.settings (meteordevelopment.meteorclient.settings)6 SettingGroup (meteordevelopment.meteorclient.settings.SettingGroup)6 BlockState (net.minecraft.block.BlockState)6