Search in sources :

Example 1 with OffhandMode

use of me.earth.earthhack.impl.modules.combat.offhand.modes.OffhandMode in project 3arthh4ck by 3arthqu4ke.

the class ListenerKeyboard method invoke.

@Override
public void invoke(KeyboardEvent event) {
    if (event.getEventState() && event.getKey() == module.switchBind.getValue().getKey()) {
        if (module.useAsOffhand.getValue() || module.isPingBypass()) {
            OffhandMode m = OFFHAND.returnIfPresent(Offhand::getMode, null);
            if (m != null) {
                if (m.equals(OffhandMode.CRYSTAL)) {
                    OFFHAND.computeIfPresent(o -> o.setMode(OffhandMode.TOTEM));
                } else {
                    OFFHAND.computeIfPresent(o -> o.setMode(OffhandMode.CRYSTAL));
                }
            }
            module.switching = false;
        } else if (module.autoSwitch.getValue() == AutoSwitch.Bind) {
            module.switching = !module.switching;
        }
    }
}
Also used : Offhand(me.earth.earthhack.impl.modules.combat.offhand.Offhand) OffhandMode(me.earth.earthhack.impl.modules.combat.offhand.modes.OffhandMode)

Example 2 with OffhandMode

use of me.earth.earthhack.impl.modules.combat.offhand.modes.OffhandMode in project 3arthh4ck by 3arthqu4ke.

the class ListenerSetSlot method invoke.

@Override
public void invoke(PacketEvent.Receive<SPacketSetSlot> event) {
    if (module.getParent().isEnabled() && mc.player != null) {
        SPacketSetSlot packet = event.getPacket();
        if (packet.getSlot() == -1337) {
            ((IContainer) mc.player.openContainer).setTransactionID((short) packet.getWindowId());
            // make NetHandlerPlayClient set mouse slot.
            ((ISPacketSetSlot) packet).setWindowId(-1);
        } else if (packet.getWindowId() == -128) {
            event.setCancelled(true);
            mc.addScheduledTask(() -> {
                OffhandMode recovery = OFFHAND.returnIfPresent(Offhand::getMode, null);
                OFFHAND.computeIfPresent(offhand -> {
                    offhand.setMode(OffhandMode.TOTEM);
                    offhand.postWindowClick();
                });
                OFFHAND.computeIfPresent(offhand -> offhand.setRecovery(recovery));
                Slot slot = mc.player.inventoryContainer.inventorySlots.get(packet.getSlot());
                slot.putStack(packet.getStack());
            });
        }
    }
}
Also used : ModuleListener(me.earth.earthhack.impl.event.listeners.ModuleListener) OffhandMode(me.earth.earthhack.impl.modules.combat.offhand.modes.OffhandMode) IContainer(me.earth.earthhack.impl.core.ducks.util.IContainer) Offhand(me.earth.earthhack.impl.modules.combat.offhand.Offhand) ModuleCache(me.earth.earthhack.api.cache.ModuleCache) Caches(me.earth.earthhack.impl.modules.Caches) Slot(net.minecraft.inventory.Slot) SPacketSetSlot(net.minecraft.network.play.server.SPacketSetSlot) PacketEvent(me.earth.earthhack.impl.event.events.network.PacketEvent) ISPacketSetSlot(me.earth.earthhack.impl.core.mixins.network.server.ISPacketSetSlot) ISPacketSetSlot(me.earth.earthhack.impl.core.mixins.network.server.ISPacketSetSlot) Slot(net.minecraft.inventory.Slot) SPacketSetSlot(net.minecraft.network.play.server.SPacketSetSlot) ISPacketSetSlot(me.earth.earthhack.impl.core.mixins.network.server.ISPacketSetSlot) SPacketSetSlot(net.minecraft.network.play.server.SPacketSetSlot) ISPacketSetSlot(me.earth.earthhack.impl.core.mixins.network.server.ISPacketSetSlot) IContainer(me.earth.earthhack.impl.core.ducks.util.IContainer) OffhandMode(me.earth.earthhack.impl.modules.combat.offhand.modes.OffhandMode)

Aggregations

Offhand (me.earth.earthhack.impl.modules.combat.offhand.Offhand)2 OffhandMode (me.earth.earthhack.impl.modules.combat.offhand.modes.OffhandMode)2 ModuleCache (me.earth.earthhack.api.cache.ModuleCache)1 IContainer (me.earth.earthhack.impl.core.ducks.util.IContainer)1 ISPacketSetSlot (me.earth.earthhack.impl.core.mixins.network.server.ISPacketSetSlot)1 PacketEvent (me.earth.earthhack.impl.event.events.network.PacketEvent)1 ModuleListener (me.earth.earthhack.impl.event.listeners.ModuleListener)1 Caches (me.earth.earthhack.impl.modules.Caches)1 Slot (net.minecraft.inventory.Slot)1 SPacketSetSlot (net.minecraft.network.play.server.SPacketSetSlot)1