Search in sources :

Example 1 with PlayerUtils

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

the class AutoTNT method onPostTick.

@EventHandler
private void onPostTick(TickEvent.Post event) {
    // Ignition
    if (ignite.get() && blocksToIgnite.size() > 0) {
        if (igniteTick > igniteDelay.get()) {
            // Sort based on closest tnt
            blocksToIgnite.sort(Comparator.comparingDouble(PlayerUtils::distanceTo));
            // Ignition
            FindItemResult itemResult = InvUtils.findInHotbar(item -> {
                if (item.getItem() instanceof FlintAndSteelItem) {
                    return (antiBreak.get() && (item.getMaxDamage() - item.getDamage()) > 10);
                } else if (item.getItem() instanceof FireChargeItem) {
                    return fireCharge.get();
                }
                return false;
            });
            if (!itemResult.found()) {
                error("No flint and steel in hotbar");
                toggle();
                return;
            }
            ignite(blocksToIgnite.get(0), itemResult);
            // Reset ticks
            igniteTick = 0;
        }
    }
    igniteTick++;
    // Placement
    if (place.get() && blocksToPlace.size() > 0) {
        if (placeTick > placeDelay.get()) {
            // Sort based on closest tnt
            blocksToPlace.sort(Comparator.comparingInt(o -> o.score));
            // Placement
            FindItemResult itemResult = InvUtils.findInHotbar(item -> item.getItem() == Items.TNT);
            if (!itemResult.found()) {
                error("No tnt in hotbar");
                toggle();
                return;
            }
            place(blocksToPlace.get(0).blockPos, itemResult);
            // Reset ticks
            placeTick = 0;
        }
    }
    placeTick++;
}
Also used : BlockIterator(meteordevelopment.meteorclient.utils.world.BlockIterator) BlockUtils(meteordevelopment.meteorclient.utils.world.BlockUtils) Setting(meteordevelopment.meteorclient.settings.Setting) TntDamage(anticope.rejects.utils.TntDamage) MeteorRejectsAddon(anticope.rejects.MeteorRejectsAddon) IntSetting(meteordevelopment.meteorclient.settings.IntSetting) 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) Vec3d(net.minecraft.util.math.Vec3d) BoolSetting(meteordevelopment.meteorclient.settings.BoolSetting) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) InvUtils(meteordevelopment.meteorclient.utils.player.InvUtils) TntBlock(net.minecraft.block.TntBlock) Hand(net.minecraft.util.Hand) Pool(meteordevelopment.meteorclient.utils.misc.Pool) BlockHitResult(net.minecraft.util.hit.BlockHitResult) SettingGroup(meteordevelopment.meteorclient.settings.SettingGroup) net.minecraft.item(net.minecraft.item) BlockPos(net.minecraft.util.math.BlockPos) List(java.util.List) Comparator(java.util.Comparator) EventHandler(meteordevelopment.orbit.EventHandler) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) EventHandler(meteordevelopment.orbit.EventHandler)

Aggregations

MeteorRejectsAddon (anticope.rejects.MeteorRejectsAddon)1 TntDamage (anticope.rejects.utils.TntDamage)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 List (java.util.List)1 TickEvent (meteordevelopment.meteorclient.events.world.TickEvent)1 BoolSetting (meteordevelopment.meteorclient.settings.BoolSetting)1 IntSetting (meteordevelopment.meteorclient.settings.IntSetting)1 Setting (meteordevelopment.meteorclient.settings.Setting)1 SettingGroup (meteordevelopment.meteorclient.settings.SettingGroup)1 Module (meteordevelopment.meteorclient.systems.modules.Module)1 Pool (meteordevelopment.meteorclient.utils.misc.Pool)1 FindItemResult (meteordevelopment.meteorclient.utils.player.FindItemResult)1 InvUtils (meteordevelopment.meteorclient.utils.player.InvUtils)1 PlayerUtils (meteordevelopment.meteorclient.utils.player.PlayerUtils)1 BlockIterator (meteordevelopment.meteorclient.utils.world.BlockIterator)1 BlockUtils (meteordevelopment.meteorclient.utils.world.BlockUtils)1 EventHandler (meteordevelopment.orbit.EventHandler)1 TntBlock (net.minecraft.block.TntBlock)1 net.minecraft.item (net.minecraft.item)1