AutoDrop module

AutoDrop: Minecraft 26.3 cheat module, full source for every implementation (1 client: OfflineClient).

1 implementationPLAYER

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

OfflineClientPLAYERsrc/main/java/com/jellypudding/offlineclient/modules/player/AutoDrop.javaJava · 114 lines · 4.7 KB

Throws away junk items as they enter your inventory.

SettingsItemsHotbar tooWorn tooFull stacks onlyDelayGuard itemsGuardedGuard framesOverride key
AutoDrop.javaJava · Minecraft 26.2 · 114 lines · 4.7 KB · complete file, verbatimOriginal ↗
1
package com.jellypudding.offlineclient.modules.player;
2
3
import com.jellypudding.offlineclient.event.Subscribe;
4
import com.jellypudding.offlineclient.event.events.TickEvent;
5
import com.jellypudding.offlineclient.module.Category;
6
import com.jellypudding.offlineclient.module.Module;
7
import com.jellypudding.offlineclient.setting.BoolSetting;
8
import com.jellypudding.offlineclient.setting.KeybindSetting;
9
import com.jellypudding.offlineclient.setting.NumberSetting;
10
import com.jellypudding.offlineclient.setting.RegistryListSetting;
11
import com.jellypudding.offlineclient.util.InventoryUtil;
12
import com.jellypudding.offlineclient.util.ItemUtil;
13
import net.minecraft.core.registries.BuiltInRegistries;
14
import net.minecraft.world.inventory.ContainerInput;
15
import net.minecraft.world.inventory.Slot;
16
import net.minecraft.world.item.Item;
17
import net.minecraft.world.item.ItemStack;
18
19
import java.util.List;
20
21
public final class AutoDrop extends Module {
22
23
    // Where the main grid and the hotbar start in network slot order.
24
    private static final int MAIN_START = 9;
25
    private static final int HOTBAR_START = 36;
26
27
    private final RegistryListSetting<Item> items = new RegistryListSetting<>("Items",
28
        "The items to throw away. Click to pick them.", BuiltInRegistries.ITEM, ItemUtil.JUNK);
29
    private final BoolSetting hotbar = new BoolSetting("Hotbar too",
30
        "Also throw junk that lands in your hotbar.", true);
31
    private final BoolSetting worn = new BoolSetting("Worn too",
32
        "Also throw junk you are wearing or holding in the offhand.", false);
33
    private final BoolSetting fullStacksOnly = new BoolSetting("Full stacks only",
34
        "Only throw a stack once it has filled up.", false);
35
    private final NumberSetting delay = new NumberSetting("Delay",
36
        "Ticks between each throw.", 2, 0, 20, 1, " ticks");
37
38
    private final BoolSetting guard = new BoolSetting("Guard items",
39
        "Stops you throwing away the items below by hand.", false);
40
    private final RegistryListSetting<Item> guarded = new RegistryListSetting<>("Guarded",
41
        "Items you are never allowed to throw. Click to pick them.", BuiltInRegistries.ITEM,
42
        List.of())
43
        .under(guard);
44
    private final BoolSetting guardFrames = new BoolSetting("Guard frames",
45
        "Also stops a guarded item going into an item frame or a pot.", true)
46
        .under(guard);
47
    private final KeybindSetting overrideKey = new KeybindSetting("Override key",
48
        "Holding this key lets a guarded item through.", KeybindSetting.UNBOUND)
49
        .under(guard);
50
51
    private int timer;
52
53
    public AutoDrop() {
54
        super("AutoDrop", "Throws away junk items as they enter your inventory.", Category.PLAYER);
55
        addSettings(items, hotbar, worn, fullStacksOnly, delay, guard, guarded, guardFrames,
56
            overrideKey);
57
        searchTags("inventory cleaner", "junk", "throw", "anti drop");
58
    }
59
60
    // True when the game must refuse to throw this stack away.
61
    public boolean guards(ItemStack stack) {
62
        return isEnabled() && guard.isOn() && !stack.isEmpty()
63
            && guarded.contains(stack.getItem()) && !overrideKey.isHeld();
64
    }
65
66
    public boolean guardsFrames() {
67
        return guardFrames.isOn();
68
    }
69
70
    @Subscribe
71
    private void onTick(TickEvent event) {
72
        if (!inGame() || mc.player.isSpectator()) {
73
            return;
74
        }
75
        if (!InventoryUtil.canClick() || !InventoryUtil.carried().isEmpty()) {
76
            return;
77
        }
78
        if (timer > 0) {
79
            timer--;
80
            return;
81
        }
82
83
        List<Slot> slots = mc.player.inventoryMenu.slots;
84
        for (int netSlot = 0; netSlot < slots.size(); netSlot++) {
85
            if (!scans(netSlot)) {
86
                continue;
87
            }
88
            ItemStack stack = slots.get(netSlot).getItem();
89
            if (stack.isEmpty() || !items.contains(stack.getItem())) {
90
                continue;
91
            }
92
            if (fullStacksOnly.isOn() && stack.getCount() < stack.getMaxStackSize()) {
93
                continue;
94
            }
95
            // Button 1 throws the whole stack in one click.
96
            mc.gameMode.handleContainerInput(0, netSlot, 1, ContainerInput.THROW, mc.player);
97
            timer = delay.getInt();
98
            return;
99
        }
100
    }
101
102
    // Network slots nine to thirty five are the main grid and the rest are named.
103
    private boolean scans(int netSlot) {
104
        if (netSlot >= MAIN_START && netSlot < HOTBAR_START) {
105
            return true;
106
        }
107
        if (netSlot >= HOTBAR_START && netSlot < InventoryUtil.OFFHAND_SLOT) {
108
            return hotbar.isOn();
109
        }
110
        boolean armour = netSlot >= InventoryUtil.ARMOR_START && netSlot < MAIN_START;
111
        return worn.isOn() && (armour || netSlot == InventoryUtil.OFFHAND_SLOT);
112
    }
113
}
114