AutoRefill module

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

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.

NicotinePlayersrc/client/java/nicotine/mod/mods/player/AutoRefill.javaJava · 38 lines · 1.2 KB

Refills the stack in your hand from your inventory

AutoRefill.javaJava · Minecraft 26.3 · 38 lines · 1.2 KB · complete file, verbatimOriginal ↗
1
package nicotine.mod.mods.player;
2
3
import net.minecraft.world.item.ItemStack;
4
import nicotine.events.ClientLevelTickEvent;
5
import nicotine.mod.Mod;
6
import nicotine.mod.ModCategory;
7
import nicotine.util.EventBus;
8
import nicotine.util.Inventory;
9
10
import static nicotine.util.Common.mc;
11
12
public class AutoRefill extends Mod {
13
14
    public AutoRefill() {
15
        super(ModCategory.Player, "AutoRefill", "Refills the stack in your hand from your inventory");
16
    }
17
18
    @Override
19
    protected void init() {
20
        EventBus.register(ClientLevelTickEvent.class, event -> {
21
            if (!this.enabled || mc.gui.screen() != null)
22
                return true;
23
24
            if (mc.player.getMainHandItem().getCount() == mc.player.getMainHandItem().getMaxStackSize() || mc.player.getMainHandItem() == ItemStack.EMPTY)
25
                return true;
26
27
            for (int i = 9; i <= 35; i++) {
28
                if (mc.player.getMainHandItem().getHoverName().getString().equals(mc.player.getInventory().getItem(i).getHoverName().getString())) {
29
                    Inventory.swap(i, 36 + mc.player.getInventory().getSelectedSlot());
30
                }
31
            }
32
33
            return true;
34
        });
35
36
    }
37
}
38