@FieldDefaults(level = AccessLevel.PRIVATE)
public class ItemScroller extends ModuleStructure {
StopWatch dragTimer = new StopWatch();
SliderSettings scrollSpeed = new SliderSettings("Скорость", "Задержка (мс)")
.setValue(50).range(0, 200);
int lastSlot = -1;
public ItemScroller() {
super("ItemScroller", "Быстрое перемещение", ModuleCategory.PLAYER);
settings(scrollSpeed);
}
@EventHandler
@Native(type = Native.Type.VMProtectBeginUltra)
public void onHandledScreen(HandledScreenEvent e) {
if (mc.player == null || mc.currentScreen == null) return;
Slot slot = e.getSlotHover();
if (slot == null || !slot.hasStack()) {
lastSlot = -1;
return;
}
if (PlayerInteractionHelper.isKey(mc.options.sneakKey) &&
PlayerInteractionHelper.isKey(mc.options.attackKey)) {
if (slot.id != lastSlot && dragTimer.every(scrollSpeed.getValue())) {
mc.interactionManager.clickSlot(
mc.player.currentScreenHandler.syncId,
slot.id,
0,
SlotActionType.QUICK_MOVE,
mc.player
);
lastSlot = slot.id;
}
} else {
lastSlot = -1;
}
}
}