use of me.earth.earthhack.impl.modules.combat.autoarmor.util.WindowClick in project 3arthh4ck by 3arthqu4ke.
the class ListenerMotion method invoke.
@Override
public void invoke(MotionUpdateEvent event) {
if (module.action == null && !module.timer.passed(module.delay.getValue()) || !Managers.NCP.getClickTimer().passed(module.globalDelay.getValue()) || mc.player.isCreative() || !InventoryUtil.validScreen() || AUTO_ARMOR.returnIfPresent(AutoArmor::isActive, false) || !module.inInventory.getValue() && mc.currentScreen instanceof GuiInventory || !module.cleanInLoot.getValue() && !mc.world.getEntitiesWithinAABB(EntityItem.class, RotationUtil.getRotationPlayer().getEntityBoundingBox()).isEmpty() && (!module.cleanWithFull.getValue() || !isInvFull())) {
return;
}
if (event.getStage() == Stage.PRE) {
// TODO: use invalidate thingy to only calc when necessary?
if (module.stack.getValue() && stack() || module.xCarry.getValue() && doXCarry()) {
return;
}
Map<Item, ItemToDrop> items = new HashMap<>();
boolean prio = module.prioHotbar.getValue();
Item drag = null;
ItemStack draggedStack = mc.player.inventory.getItemStack();
if (check(draggedStack, -2, items)) {
drag = draggedStack.getItem();
} else if (!draggedStack.isEmpty()) {
return;
}
for (int i = prio ? 44 : 9; prio ? i > 8 : i <= 44; // noinspection ConstantConditions (??? am i stupid ???)
i = (prio ? --i : ++i)) {
ItemStack stack = InventoryUtil.get(i);
check(stack, i, items);
}
WindowClick action = null;
if (drag != null) {
ItemToDrop dragged = items.get(drag);
if (dragged != null && dragged.shouldDrop()) {
action = new WindowClick(-999, ItemStack.EMPTY, mc.player.inventory.getItemStack());
}
} else {
for (ItemToDrop toDrop : items.values()) {
if (toDrop.shouldDrop()) {
int s = toDrop.getSlot();
action = new WindowClick(-1, ItemStack.EMPTY, s, InventoryUtil.get(s), -1, p -> p.windowClick(0, s, 1, ClickType.THROW, mc.player));
break;
}
}
}
if (action != null) {
if (module.rotate.getValue()) {
if (MovementUtil.isMoving()) {
// behind us
event.setYaw(event.getYaw() - 180.0f);
} else {
event.setYaw(getYaw(event.getYaw()));
}
// slightly up so we throw further
event.setPitch(-5.0f);
module.action = action;
} else {
module.action = action;
module.runAction();
}
}
} else {
module.runAction();
}
}
use of me.earth.earthhack.impl.modules.combat.autoarmor.util.WindowClick in project 3arthh4ck by 3arthqu4ke.
the class AutoArmor method runClick.
/**
* Polls and runs the first WindowClick from the
* queued clicks if the timer has passed
* the delay.
*/
protected void runClick() {
if (InventoryUtil.validScreen() && mc.playerController != null) {
if (timer.passed(delay.getValue())) {
Locks.acquire(Locks.WINDOW_CLICK_LOCK, () -> {
Managers.NCP.startMultiClick();
WindowClick windowClick = windowClicks.poll();
while (windowClick != null) {
if (safe.getValue() && !windowClick.isValid()) {
windowClicks.clear();
queuedSlots.clear();
Managers.NCP.releaseMultiClick();
return;
}
windowClick.runClick(mc.playerController);
desyncMap.put(windowClick.getSlot(), new DesyncClick(windowClick));
timer.reset(delay.getValue());
if (!windowClick.isDoubleClick()) {
Managers.NCP.releaseMultiClick();
return;
}
windowClick = windowClicks.poll();
}
});
}
} else {
windowClicks.clear();
queuedSlots.clear();
}
}
use of me.earth.earthhack.impl.modules.combat.autoarmor.util.WindowClick in project 3arthh4ck by 3arthqu4ke.
the class AutoArmor method queueClick.
/**
* Creates a new {@link WindowClick} for the given parameters,
* queues it via {@link AutoArmor#queueClick(WindowClick)} and
* returns it.
*/
public WindowClick queueClick(int slot, ItemStack inSlot, ItemStack inDrag, int target) {
WindowClick click = new WindowClick(slot, inSlot, inDrag, target);
queueClick(click);
click.setFast(fast.getValue());
return click;
}
Aggregations