Combat Inventory Hotbar Auto-Swap

Combat_Auto_Swap Inventory HIGH +8 score

🎮 Minecraft Gameplay Impact

Automatically swaps utility items (Ender Pearls, Golden Apples, Potions, Obsidian) into hotbar slots the instant a keybind or health condition is triggered.

🔍 Functions & APIs Analyzed

ScreenHandler.onSlotClick

Interacts with container slots.

PlayerInventory.swapSlotWithHotbar

Swaps main inventory items into active hotbar.

💻 Mod Implementation (Dev Source / Mapped)

// Developer Source (Fabric / Yarn mappings)
public class AutoSwap {
    public static void quickSwap(MinecraftClient client, Item item) {
        int slot = findItem(client.player.getInventory(), item);
        if (slot != -1) {
            client.interactionManager.clickSlot(0, slot, client.player.getInventory().selectedSlot, SlotActionType.SWAP, client.player);
        }
    }
}

⚙️ Decompiled Representation (Vineflower View)

// Decompiled with Vineflower 1.12 (Intermediary mappings)
public class AutoSwap {
    public static void quickSwap(class_310 client, class_1792 item) {
        int slot = findItem(client.field_1724.method_31548(), item);
        if (slot != -1) {
            client.field_1761.method_2906(0, slot, client.field_1724.method_31548().field_7545, class_1713.field_7791, client.field_1724);
        }
    }
}

🛡️ Bytecode Signature & Static Detection

Identifies SlotActionType.SWAP (field_7791) usage with ClientPlayerInteractionManager.clickSlot.