Search in sources :

Example 1 with FindItemResult

use of meteordevelopment.meteorclient.utils.player.FindItemResult 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 FindItemResult

use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.

the class AutoWither method onPostTick.

@EventHandler
private void onPostTick(TickEvent.Post event) {
    if (wither == null) {
        // Delay
        if (witherTicksWaited < witherDelay.get() - 1) {
            witherTicksWaited++;
            return;
        }
        if (withers.isEmpty())
            return;
        // Sorting
        switch(priority.get()) {
            case Closest:
                withers.sort(Comparator.comparingDouble(w -> PlayerUtils.distanceTo(w.foot)));
            case Furthest:
                withers.sort((w1, w2) -> {
                    int sort = Double.compare(PlayerUtils.distanceTo(w1.foot), PlayerUtils.distanceTo(w2.foot));
                    if (sort == 0)
                        return 0;
                    return sort > 0 ? -1 : 1;
                });
            case Random:
                Collections.shuffle(withers);
        }
        wither = withers.get(0);
    }
    // Soul sand/soil and skull slot
    FindItemResult findSoulSand = InvUtils.findInHotbar(Items.SOUL_SAND);
    if (!findSoulSand.found())
        findSoulSand = InvUtils.findInHotbar(Items.SOUL_SOIL);
    FindItemResult findWitherSkull = InvUtils.findInHotbar(Items.WITHER_SKELETON_SKULL);
    // Check for enough resources
    if (!findSoulSand.found() || !findWitherSkull.found()) {
        error("Not enough resources in hotbar");
        toggle();
        return;
    }
    // Build
    if (blockDelay.get() == 0) {
        // All in 1 tick
        // Body
        BlockUtils.place(wither.foot, findSoulSand, rotate.get(), -50);
        BlockUtils.place(wither.foot.up(), findSoulSand, rotate.get(), -50);
        BlockUtils.place(wither.foot.up().offset(wither.axis, -1), findSoulSand, rotate.get(), -50);
        BlockUtils.place(wither.foot.up().offset(wither.axis, 1), findSoulSand, rotate.get(), -50);
        // Head
        BlockUtils.place(wither.foot.up().up(), findWitherSkull, rotate.get(), -50);
        BlockUtils.place(wither.foot.up().up().offset(wither.axis, -1), findWitherSkull, rotate.get(), -50);
        BlockUtils.place(wither.foot.up().up().offset(wither.axis, 1), findWitherSkull, rotate.get(), -50);
        // Auto turnoff
        if (turnOff.get()) {
            wither = null;
            toggle();
        }
    } else {
        // Delay
        if (blockTicksWaited < blockDelay.get() - 1) {
            blockTicksWaited++;
            return;
        }
        switch(wither.stage) {
            case 0:
                if (BlockUtils.place(wither.foot, findSoulSand, rotate.get(), -50))
                    wither.stage++;
                break;
            case 1:
                if (BlockUtils.place(wither.foot.up(), findSoulSand, rotate.get(), -50))
                    wither.stage++;
                break;
            case 2:
                if (BlockUtils.place(wither.foot.up().offset(wither.axis, -1), findSoulSand, rotate.get(), -50))
                    wither.stage++;
                break;
            case 3:
                if (BlockUtils.place(wither.foot.up().offset(wither.axis, 1), findSoulSand, rotate.get(), -50))
                    wither.stage++;
                break;
            case 4:
                if (BlockUtils.place(wither.foot.up().up(), findWitherSkull, rotate.get(), -50))
                    wither.stage++;
                break;
            case 5:
                if (BlockUtils.place(wither.foot.up().up().offset(wither.axis, -1), findWitherSkull, rotate.get(), -50))
                    wither.stage++;
                break;
            case 6:
                if (BlockUtils.place(wither.foot.up().up().offset(wither.axis, 1), findWitherSkull, rotate.get(), -50))
                    wither.stage++;
                break;
            case 7:
                // Auto turnoff
                if (turnOff.get()) {
                    wither = null;
                    toggle();
                }
                break;
        }
    }
    witherTicksWaited = 0;
}
Also used : Rotations(meteordevelopment.meteorclient.utils.player.Rotations) BlockIterator(meteordevelopment.meteorclient.utils.world.BlockIterator) BlockUtils(meteordevelopment.meteorclient.utils.world.BlockUtils) ShapeContext(net.minecraft.block.ShapeContext) ShapeMode(meteordevelopment.meteorclient.renderer.ShapeMode) MeteorRejectsAddon(anticope.rejects.MeteorRejectsAddon) meteordevelopment.meteorclient.settings(meteordevelopment.meteorclient.settings) BlockPos(net.minecraft.util.math.BlockPos) SettingColor(meteordevelopment.meteorclient.utils.render.color.SettingColor) Items(net.minecraft.item.Items) Blocks(net.minecraft.block.Blocks) TickEvent(meteordevelopment.meteorclient.events.world.TickEvent) ArrayList(java.util.ArrayList) Direction(net.minecraft.util.math.Direction) Module(meteordevelopment.meteorclient.systems.modules.Module) PlayerUtils(meteordevelopment.meteorclient.utils.player.PlayerUtils) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) InvUtils(meteordevelopment.meteorclient.utils.player.InvUtils) Pool(meteordevelopment.meteorclient.utils.misc.Pool) Comparator(java.util.Comparator) EventHandler(meteordevelopment.orbit.EventHandler) Collections(java.util.Collections) Render3DEvent(meteordevelopment.meteorclient.events.render.Render3DEvent) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) EventHandler(meteordevelopment.orbit.EventHandler)

Example 3 with FindItemResult

use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.

the class BlockIn method place.

private boolean place(int x, int y, int z) {
    setBlockPos(x, y, z);
    FindItemResult findItemResult = InvUtils.findInHotbar(itemStack -> validItem(itemStack, bp));
    if (!BlockUtils.canPlace(bp))
        return true;
    if (BlockUtils.place(bp, findItemResult, rotate.get(), 100, true)) {
        return_ = true;
    }
    return false;
}
Also used : FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult)

Example 4 with FindItemResult

use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.

the class Lavacast method placeLava.

private void placeLava() {
    FindItemResult findItemResult = InvUtils.findInHotbar(Items.LAVA_BUCKET);
    if (!findItemResult.found()) {
        error("No lava bucket found.");
        toggle();
        return;
    }
    int prevSlot = mc.player.getInventory().selectedSlot;
    mc.player.getInventory().selectedSlot = findItemResult.slot();
    mc.interactionManager.interactItem(mc.player, mc.world, Hand.MAIN_HAND);
    mc.player.getInventory().selectedSlot = prevSlot;
}
Also used : FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult)

Example 5 with FindItemResult

use of meteordevelopment.meteorclient.utils.player.FindItemResult in project meteor-rejects by AntiCope.

the class Lavacast method pickupLiquid.

private void pickupLiquid() {
    FindItemResult findItemResult = InvUtils.findInHotbar(Items.BUCKET);
    if (!findItemResult.found()) {
        error("No bucket found.");
        toggle();
        return;
    }
    int prevSlot = mc.player.getInventory().selectedSlot;
    mc.player.getInventory().selectedSlot = findItemResult.slot();
    mc.interactionManager.interactItem(mc.player, mc.world, Hand.MAIN_HAND);
    mc.player.getInventory().selectedSlot = prevSlot;
}
Also used : FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult)

Aggregations

FindItemResult (meteordevelopment.meteorclient.utils.player.FindItemResult)40 EventHandler (meteordevelopment.orbit.EventHandler)27 BlockPos (net.minecraft.util.math.BlockPos)16 InvUtils (meteordevelopment.meteorclient.utils.player.InvUtils)8 ItemStack (net.minecraft.item.ItemStack)7 Items (net.minecraft.item.Items)7 TickEvent (meteordevelopment.meteorclient.events.world.TickEvent)6 Module (meteordevelopment.meteorclient.systems.modules.Module)6 BlockUtils (meteordevelopment.meteorclient.utils.world.BlockUtils)5 ArrayList (java.util.ArrayList)4 BoolSetting (meteordevelopment.meteorclient.settings.BoolSetting)4 Setting (meteordevelopment.meteorclient.settings.Setting)4 SettingGroup (meteordevelopment.meteorclient.settings.SettingGroup)4 PlayerUtils (meteordevelopment.meteorclient.utils.player.PlayerUtils)4 BlockItem (net.minecraft.item.BlockItem)4 Hand (net.minecraft.util.Hand)4 Direction (net.minecraft.util.math.Direction)4 Vec3d (net.minecraft.util.math.Vec3d)4 BaritoneAPI (baritone.api.BaritoneAPI)3 Comparator (java.util.Comparator)3