Search in sources :

Example 16 with EventHandler

use of meteordevelopment.orbit.EventHandler in project vector-addon by cally72jhb.

the class BowBomb method onSendPacket.

@EventHandler
private void onSendPacket(PacketEvent.Send event) {
    if (event.packet == null)
        return;
    if (event.packet instanceof PlayerActionC2SPacket) {
        PlayerActionC2SPacket packet = (PlayerActionC2SPacket) event.packet;
        if (packet.getAction() == PlayerActionC2SPacket.Action.RELEASE_USE_ITEM) {
            if (isSpoofable()) {
                deactivate();
                spoofed = false;
                if (System.currentTimeMillis() - lastShoot >= timeout.get()) {
                    lastShoot = System.currentTimeMillis();
                    float value = (float) Math.pow(base.get(), -exponent.get());
                    if (sprint.get())
                        mc.player.networkHandler.sendPacket(new ClientCommandC2SPacket(mc.player, ClientCommandC2SPacket.Mode.START_SPRINTING));
                    for (int index = 0; index < spoofs.get(); ++index) {
                        if (bypass.get()) {
                            mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + value, mc.player.getZ(), false));
                            mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() - value, mc.player.getZ(), true));
                        } else {
                            mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() - value, mc.player.getZ(), true));
                            mc.player.networkHandler.sendPacket(new PlayerMoveC2SPacket.PositionAndOnGround(mc.player.getX(), mc.player.getY() + value, mc.player.getZ(), false));
                        }
                    }
                    spoofed = true;
                }
            }
        }
    }
}
Also used : ClientCommandC2SPacket(net.minecraft.network.packet.c2s.play.ClientCommandC2SPacket) PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket) PlayerMoveC2SPacket(net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket) EventHandler(meteordevelopment.orbit.EventHandler)

Example 17 with EventHandler

use of meteordevelopment.orbit.EventHandler in project banana-for-everyone by Bennooo.

the class AutoAuto method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    // Fields
    Modules modules = Modules.get();
    SurroundPlus SP = modules.get(SurroundPlus.class);
    AntiGhostBlock AGB = modules.get(AntiGhostBlock.class);
    AutoCityPlus AC = modules.get(AutoCityPlus.class);
    BurrowMiner BM = modules.get(BurrowMiner.class);
    if (surroundPlus.get()) {
        if ((onlyGround.get() && mc.player.isOnGround()) || !onlyGround.get()) {
            if (((BPlusEntityUtils.isInHole(mc.player, true, BPlusEntityUtils.BlastResistantType.Any) && allowDouble.get()) || (BPlusEntityUtils.isSurrounded(mc.player, BPlusEntityUtils.BlastResistantType.Any))) && !SP.isActive()) {
                SP.toggle();
            }
        }
    }
    if (antiGhost.get()) {
        if (SP.isActive() && BPlusEntityUtils.isSurrounded(mc.player, BPlusEntityUtils.BlastResistantType.Any) && !mc.player.getAbilities().creativeMode) {
            shouldAntiGhost = true;
            if (!AGB.isActive() && AGB.autoToggle.get() && shouldAntiGhost && !didAntiGhost) {
                AGB.toggle();
                shouldAntiGhost = false;
                didAntiGhost = true;
            }
            if (!AGB.autoToggle.get() && AGB.isActive() && shouldAntiGhost && !didAntiGhost) {
                AGB.toggle();
                AGB.toggle();
                shouldAntiGhost = false;
                didAntiGhost = true;
            }
        } else {
            shouldAntiGhost = false;
            didAntiGhost = false;
        }
    }
    if (autoCity.get()) {
        if ((AConlyinHole.get() && (BPlusEntityUtils.isSurrounded(mc.player, BPlusEntityUtils.BlastResistantType.Any) || (BPlusEntityUtils.isInHole(mc.player, true, BPlusEntityUtils.BlastResistantType.Any) && ACallowDoubleHole.get()))) || !AConlyinHole.get()) {
            if (!AC.isActive()) {
                PlayerEntity ACtarget = TargetUtils.getPlayerTarget(ACtargetRange.get(), SortPriority.LowestDistance);
                if (ACtarget == null)
                    return;
                else {
                    if (BPlusEntityUtils.isBurrowed(ACtarget, BPlusEntityUtils.BlastResistantType.Mineable) || (BPlusEntityUtils.isSurrounded(ACtarget, BPlusEntityUtils.BlastResistantType.Mineable))) {
                        AC.toggle();
                    }
                }
            }
        }
    }
    if (burrowMiner.get()) {
        if ((BMonlyinHole.get() && BPlusEntityUtils.isSurrounded(mc.player, BPlusEntityUtils.BlastResistantType.Any) || (BPlusEntityUtils.isInHole(mc.player, true, BPlusEntityUtils.BlastResistantType.Any) && BMallowDoubleHole.get())) || !BMonlyinHole.get()) {
            if (!BM.isActive()) {
                PlayerEntity BMtarget = TargetUtils.getPlayerTarget(BMtargetRange.get(), SortPriority.LowestDistance);
                if (BMtarget == null)
                    return;
                else {
                    if (BPlusEntityUtils.isBurrowed(BMtarget, BPlusEntityUtils.BlastResistantType.Any)) {
                        BM.toggle();
                    }
                }
            }
        }
    }
}
Also used : Modules(meteordevelopment.meteorclient.systems.modules.Modules) AntiGhostBlock(bananaplus.modules.misc.AntiGhostBlock) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EventHandler(meteordevelopment.orbit.EventHandler)

Example 18 with EventHandler

use of meteordevelopment.orbit.EventHandler in project banana-for-everyone by Bennooo.

the class AutoCityPlus method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    if (mode.get() == Mode.Normal) {
        if (TargetUtils.isBadTarget(target, targetRange.get())) {
            PlayerEntity search = TargetUtils.getPlayerTarget(targetRange.get(), SortPriority.LowestDistance);
            if (search != target)
                sentMessage = false;
            target = search;
        }
        if (TargetUtils.isBadTarget(target, targetRange.get())) {
            target = null;
            blockPosTarget = null;
            toggle();
            return;
        }
        if (prioBurrowed.get() && BPlusEntityUtils.isBurrowed(target, BPlusEntityUtils.BlastResistantType.Mineable)) {
            blockPosTarget = target.getBlockPos();
            if (!burrowMessage && chatInfo.get()) {
                warning("Mining %s's burrow.", target.getEntityName());
                burrowMessage = true;
            }
        } else if (noCitySurrounded.get() && !BPlusEntityUtils.isSurrounded(target, BPlusEntityUtils.BlastResistantType.Any)) {
            warning("%s is not surrounded... disabling", target.getEntityName());
            blockPosTarget = null;
            toggle();
            return;
        } else if (avoidSelf.get()) {
            blockPosTarget = BPlusEntityUtils.getTargetBlock(target);
            if (blockPosTarget == null && lastResort.get())
                blockPosTarget = BPlusEntityUtils.getCityBlock(target);
        } else
            blockPosTarget = BPlusEntityUtils.getCityBlock(target);
    }
    if (blockPosTarget == null) {
        error("No target block found... disabling.");
        toggle();
        target = null;
        return;
    } else if (!sentMessage && chatInfo.get() && blockPosTarget != target.getBlockPos()) {
        warning("Attempting to city %s.", target.getEntityName());
        sentMessage = true;
    }
    if (BPlusPlayerUtils.distanceFromEye(blockPosTarget) > mineRange.get()) {
        error("Target block out of reach... disabling.");
        toggle();
        return;
    }
    Modules modules = Modules.get();
    if (turnOnBBomber.get() && blockPosTarget != null && !modules.get(BananaBomber.class).isActive())
        modules.get(BananaBomber.class).toggle();
    if (turnOnButtonTrap.get() && blockPosTarget != null && !modules.get(AntiSurround.class).isActive())
        modules.get(AntiSurround.class).toggle();
    if (turnOffInstaMine.get() && blockPosTarget != null && modules.get(InstaMine.class).isActive())
        modules.get(InstaMine.class).toggle();
    FindItemResult pickaxe = InvUtils.find(itemStack -> itemStack.getItem() == Items.DIAMOND_PICKAXE || itemStack.getItem() == Items.NETHERITE_PICKAXE);
    if (!pickaxe.isHotbar()) {
        error("No pickaxe found... disabling.");
        toggle();
        return;
    }
    if (support.get() && !BPlusEntityUtils.isBurrowed(target, BPlusEntityUtils.BlastResistantType.Any)) {
        if (BPlusPlayerUtils.distanceFromEye(blockPosTarget.down(1)) < supportRange.get()) {
            BlockUtils.place(blockPosTarget.down(1), InvUtils.findInHotbar(Items.OBSIDIAN), rotate.get(), 0, true);
        } else if (!supportMessage && blockPosTarget != target.getBlockPos()) {
            warning("Unable to support %s... mining anyway.", target.getEntityName());
            supportMessage = true;
        }
    }
    if (autoSwitch.get())
        InvUtils.swap(pickaxe.slot(), false);
    if (mode.get() == Mode.Normal) {
        if (rotate.get())
            Rotations.rotate(Rotations.getYaw(blockPosTarget), Rotations.getPitch(blockPosTarget), () -> mine(blockPosTarget));
        else
            mine(blockPosTarget);
    }
    if (mode.get() == Mode.Instant) {
        if (target == null || !target.isAlive() || count >= instaToggle.get()) {
            toggle();
        }
        direction = BPlusEntityUtils.rayTraceCheck(blockPosTarget, true);
        if (!mc.world.isAir(blockPosTarget)) {
            instamine(blockPosTarget);
        } else
            ++count;
    }
}
Also used : Modules(meteordevelopment.meteorclient.systems.modules.Modules) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) PlayerEntity(net.minecraft.entity.player.PlayerEntity) EventHandler(meteordevelopment.orbit.EventHandler)

Example 19 with EventHandler

use of meteordevelopment.orbit.EventHandler in project banana-for-everyone by Bennooo.

the class BurrowESP method onTick.

@EventHandler
private void onTick(TickEvent.Post event) {
    PlayerEntity targetEntity = TargetUtils.getPlayerTarget(mc.interactionManager.getReachDistance() + 2, SortPriority.LowestDistance);
    if (TargetUtils.isBadTarget(targetEntity, mc.interactionManager.getReachDistance() + 2)) {
        target = null;
    } else if (renderWebbed.get() && BPlusEntityUtils.isWebbed(targetEntity)) {
        target = targetEntity.getBlockPos();
    } else if (BPlusEntityUtils.isBurrowed(targetEntity, BPlusEntityUtils.BlastResistantType.Any)) {
        target = targetEntity.getBlockPos();
    } else
        target = null;
    isTargetWebbed = (target != null && BPlusEntityUtils.isWebbed(targetEntity));
    isTargetBurrowed = (target != null && BPlusEntityUtils.isBurrowed(targetEntity, BPlusEntityUtils.BlastResistantType.Any));
}
Also used : PlayerEntity(net.minecraft.entity.player.PlayerEntity) EventHandler(meteordevelopment.orbit.EventHandler)

Example 20 with EventHandler

use of meteordevelopment.orbit.EventHandler in project banana-for-everyone by Bennooo.

the class Monkhand method onTick.

@EventHandler
private void onTick(TickEvent.Pre event) {
    net.minecraft.item.Item mainHand = mc.player.getMainHandStack().getItem();
    Modules modules = Modules.get();
    AutoTotem autoTotem = modules.get(AutoTotem.class);
    MonkeTotem monkeTotem = modules.get(MonkeTotem.class);
    // Gap
    if (mainHand instanceof SwordItem && swordGap.get() && allowGap())
        currentItem = Item.EGap;
    else if (mainHand instanceof AxeItem && axeGap.get() && allowGap())
        currentItem = Item.EGap;
    else // Ca, mining, cev
    if ((modules.isActive(CrystalAura.class) && crystalCa.get() || modules.isActive(BananaBomber.class) && crystalCa.get()) || mc.interactionManager.isBreakingBlock() && crystalMine.get() || modules.isActive(CevBreaker.class) && crystalCev.get())
        currentItem = Item.Crystal;
    else // Xp
    if (modules.isActive(AutoXP.class) && modules.get(AutoXP.class).isOnStandby && modules.get(AutoXP.class).isRepairing && AutoXP.get())
        currentItem = Item.Exp;
    else // Rocket
    if ((mc.player.getMainHandStack().getItem() instanceof CrossbowItem) && RocketBow.get())
        currentItem = Item.Firework;
    else
        currentItem = item.get();
    // Checking offhand item
    if (mc.player.getOffHandStack().getItem() != currentItem.item) {
        FindItemResult item = InvUtils.find(itemStack -> itemStack.getItem() == currentItem.item, hotbar.get() ? 0 : 9, 35);
        // No offhand item
        if (!item.found())
            item = InvUtils.find(itemStack -> itemStack.getItem() == fallbackItem.get().item, hotbar.get() ? 0 : 9, 35);
        if (currentItem == Item.EGap && allowCrapples.get()) {
            if (!item.found())
                item = InvUtils.find(itemStack -> itemStack.getItem() == Items.GOLDEN_APPLE, hotbar.get() ? 0 : 9, 35);
        }
        if (!item.found()) {
            if (!sentMessage) {
                warning("Chosen item not found.");
                sentMessage = true;
            }
        } else // Swap to offhand
        if ((isClicking || !rightClick.get()) && (!autoTotem.isLocked() && !monkeTotem.isLocked()) && !item.isOffhand()) {
            InvUtils.move().from(item.slot()).toOffhand();
            sentMessage = false;
        }
    } else // If not clicking, set to totem if auto totem is on
    if (!isClicking && rightClick.get()) {
        if (autoTotem.isActive() || monkeTotem.isActive()) {
            FindItemResult totem = InvUtils.find(itemStack -> itemStack.getItem() == Items.TOTEM_OF_UNDYING, hotbar.get() ? 0 : 9, 35);
            if (totem.found() && !totem.isOffhand()) {
                InvUtils.move().from(totem.slot()).toOffhand();
            }
        } else {
            FindItemResult empty = InvUtils.find(ItemStack::isEmpty, hotbar.get() ? 0 : 9, 35);
            if (empty.found())
                InvUtils.move().fromOffhand().to(empty.slot());
        }
    }
}
Also used : BPlusEntityUtils(bananaplus.utils.BPlusEntityUtils) Setting(meteordevelopment.meteorclient.settings.Setting) AutoTotem(meteordevelopment.meteorclient.systems.modules.combat.AutoTotem) CrystalAura(meteordevelopment.meteorclient.systems.modules.combat.CrystalAura) SettingGroup(meteordevelopment.meteorclient.settings.SettingGroup) net.minecraft.item(net.minecraft.item) KeyAction(meteordevelopment.meteorclient.utils.misc.input.KeyAction) TickEvent(meteordevelopment.meteorclient.events.world.TickEvent) BananaPlus(bananaplus.modules.BananaPlus) MouseButtonEvent(meteordevelopment.meteorclient.events.meteor.MouseButtonEvent) Module(meteordevelopment.meteorclient.systems.modules.Module) GLFW_MOUSE_BUTTON_RIGHT(org.lwjgl.glfw.GLFW.GLFW_MOUSE_BUTTON_RIGHT) BoolSetting(meteordevelopment.meteorclient.settings.BoolSetting) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) InvUtils(meteordevelopment.meteorclient.utils.player.InvUtils) Modules(meteordevelopment.meteorclient.systems.modules.Modules) EnumSetting(meteordevelopment.meteorclient.settings.EnumSetting) EventHandler(meteordevelopment.orbit.EventHandler) CrystalAura(meteordevelopment.meteorclient.systems.modules.combat.CrystalAura) net.minecraft.item(net.minecraft.item) Modules(meteordevelopment.meteorclient.systems.modules.Modules) AutoTotem(meteordevelopment.meteorclient.systems.modules.combat.AutoTotem) FindItemResult(meteordevelopment.meteorclient.utils.player.FindItemResult) EventHandler(meteordevelopment.orbit.EventHandler)

Aggregations

EventHandler (meteordevelopment.orbit.EventHandler)142 BlockPos (net.minecraft.util.math.BlockPos)44 Vec3d (net.minecraft.util.math.Vec3d)33 FindItemResult (meteordevelopment.meteorclient.utils.player.FindItemResult)31 PlayerEntity (net.minecraft.entity.player.PlayerEntity)14 ItemStack (net.minecraft.item.ItemStack)14 TickEvent (meteordevelopment.meteorclient.events.world.TickEvent)13 Module (meteordevelopment.meteorclient.systems.modules.Module)13 BlockState (net.minecraft.block.BlockState)13 Entity (net.minecraft.entity.Entity)13 Direction (net.minecraft.util.math.Direction)12 SettingColor (meteordevelopment.meteorclient.utils.render.color.SettingColor)11 BlockHitResult (net.minecraft.util.hit.BlockHitResult)11 BlockUtils (meteordevelopment.meteorclient.utils.world.BlockUtils)10 PlayerMoveC2SPacket (net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket)10 ArrayList (java.util.ArrayList)9 Box (net.minecraft.util.math.Box)9 IVec3d (meteordevelopment.meteorclient.mixininterface.IVec3d)8 InvUtils (meteordevelopment.meteorclient.utils.player.InvUtils)8 Comparator (java.util.Comparator)7