Auto Combat Disconnect (Auto Leave)

Auto_Leave Inventory HIGH +8 score

🎮 Minecraft Gameplay Impact

Monitors player health, totem counts, or enemy proximity. When health drops below a configurable threshold (e.g. 4 hearts) or zero totems remain, the client instantly severs the network connection to avoid losing gear in hardcore/anarchy servers.

🔍 Functions & APIs Analyzed

ClientConnection.disconnect

Closes network channel immediately (method_10747).

PlayerEntity.getHealth

Queries current player health (method_6032).

💻 Mod Implementation (Dev Source / Mapped)

// Developer Source (Fabric / Yarn mappings)
public class AutoLeave {
    public static void checkHealth(MinecraftClient client, float threshold) {
        if (client.player != null && client.player.getHealth() <= threshold) {
            client.getNetworkHandler().getConnection().disconnect(Text.literal("[AutoLeave] Health below threshold!"));
        }
    }
}

⚙️ Decompiled Representation (Vineflower View)

// Decompiled with Vineflower 1.12 (Intermediary mappings)
public class AutoLeave {
    public static void checkHealth(class_310 client, float threshold) {
        if (client.field_1724 != null && client.field_1724.method_6032() <= threshold) {
            client.method_1562().method_2872().method_10747(class_2561.method_43470("[AutoLeave] Health below threshold!"));
        }
    }
}

🛡️ Bytecode Signature & Static Detection

Matches player health queries (getHealth / method_6032) combined with immediate network disconnect (ClientConnection.disconnect / method_10747).