Auto Shield Breaker

Auto_Shield_Breaker Combat HIGH +8 score

🎮 Minecraft Gameplay Impact

Instantly swaps the player's active hotbar slot to an axe the moment an opponent begins blocking with a shield, executes an attack that triggers vanilla shield disabling mechanics (5 seconds lockout), and switches back to a sword in 1 game tick.

🔍 Functions & APIs Analyzed

PlayerInventory.setSelectedSlot

Modifies hotbar selected index (method_7376) and sends UpdateSelectedSlotC2SPacket.

LivingEntity.isBlocking

Checks if the opponent is actively holding right-click with a shield (method_6039).

ClientPlayerInteractionManager.attackEntity

Executes attack with axe to disable shield.

💻 Mod Implementation (Dev Source / Mapped)

// Developer Source (Fabric / Yarn mappings)
public class AutoShieldBreak {
    public static void onAttackTarget(MinecraftClient client, LivingEntity target) {
        if (target.isBlocking()) {
            int axeSlot = findAxeSlot(client.player.getInventory());
            if (axeSlot != -1) {
                int prevSlot = client.player.getInventory().selectedSlot;
                client.player.getInventory().selectedSlot = axeSlot;
                client.interactionManager.attackEntity(client.player, target);
                client.player.getInventory().selectedSlot = prevSlot;
            }
        }
    }
}

⚙️ Decompiled Representation (Vineflower View)

// Decompiled with Vineflower 1.12 (Intermediary mappings)
public class AutoShieldBreak {
    public static void onAttackTarget(class_310 client, class_1309 target) {
        if (target.method_6039()) {
            int axeSlot = findAxeSlot(client.field_1724.method_31548());
            if (axeSlot != -1) {
                int prevSlot = client.field_1724.method_31548().field_7545;
                client.field_1724.method_31548().field_7545 = axeSlot;
                client.field_1761.method_2918(client.field_1724, target);
                client.field_1724.method_31548().field_7545 = prevSlot;
            }
        }
    }
}

🛡️ Bytecode Signature & Static Detection

Matches detection of shield blocking state (isBlocking / method_6039 or isTargetShielding) combined with hotbar slot changes (setSelectedSlot / method_7376) and attackEntity.