HomeJavaModsAutoSwitch
AutoSwitch
ModsJava

AutoSwitch

by dexman545 · on Modrinth

Which build do you need?

This mod ships a separate file for every mod loader and every version of the game. Pick both, then download — the wrong build installs fine and then does nothing in the game.

Mod loader

Minecraft version

⬇ Download for 26.2 · Fabric⬇ Download for 26.1–26.1.2 · Fabric⬇ Download for 1.21.11 · Fabric⬇ Download for 1.21.9–1.21.10 · Fabric⬇ Download for 1.21.6–1.21.8 · Fabric⬇ Download for 1.21.5 · Fabric⬇ Download for 1.21.2–1.21.4 · Fabric⬇ Download for 1.21–1.21.1 · Fabric⬇ Download for 1.20.5 · Fabric⬇ Download for 1.20.2–1.20.4 · Fabric⬇ Download for 1.20–1.20.1 · Fabric⬇ Download for 1.19.3 · Fabric⬇ Download for 1.19–1.19.2 · Fabric⬇ Download for 1.18.2 · Fabric⬇ Download for 1.17.1–1.18.1 · Fabric⬇ Download for 26.2 · NeoForge⬇ Download for 26.1–26.1.2 · NeoForge⬇ Download for 1.21.11 · NeoForge⬇ Download for 1.21.9–1.21.10 · NeoForge⬇ Download for 1.21.6–1.21.8 · NeoForge
I don't know my version or loader
Open the Minecraft launcher and look at the profile you play on — it names both, like fabric-loader-1.21.4. The version also shows in the bottom-right corner of the game's main menu.
No loader in the profile name? Then it's plain Minecraft, and these mods won't run — you need Fabric or NeoForge installed first.

client Fabric API

AutoSwitch

AutoSwitch is a Minecraft mod (for Fabric / NeoForge) that automatically swaps the held item based on what you’re about to do - mining, attacking, interacting, or when specific stats change and what is available on your hotbar (i.e. you hit a stone block with your fist, it will switch to a pickaxe).

It’s rule-driven and highly configurable via a HOCON config file autoswitch.conf, located in the config folder which is next to the resource pack folder. A quick way to navigate there is by going to Options > Resource Packs > navigate up one folder.

The mod can be toggled on/off dynamically in game by pressing R.


Configuration

This section only applies to AutoSwitch 12+. Earlier versions used a different config format.

There are four sections in the config file - three for defining selectors and targets when various actions occur, and one for general feature configuration:

Each rule contains:

EXPRESSIONs can have as many elements or as much depth as you wish, allowing for a great deal of control. The default config covers a wide range of cases and should serve as a great basis for expanding.

Tools and targets can have an optional data field to control things like enchantments or blockstates that should be matched.

Live edits

Simply resave the config file when ingame for it to be automatically reloaded.

The Gritty Details

Expressions

Expressions can be nested to any depth you desire.

Expressions support the following operations:

Data

Currently, the following data types are supported:

Selection Priority

Decision order (first thing that differs wins):

  1. Target Priority - rules with higher priority are preferred.
  2. Target Rating (multi-level) - compare rating level 0 - n up to the configured maximum. At each level compare, in order:
    • isGroup (prefer non-groups)
    • hasData (prefer those with data)
    • typeRating (higher preferred, e.g. weapon DPS or mining level)
    • dataRating (higher preferred, e.g. normalized enchantment level)
  3. Tool Priority - prefer tools that are intrinsically prioritized higher.
  4. Tool Rating (multi-level) - same multi-level comparison logic as Target Rating (isGroup → hasData → typeRating → dataRating).
  5. Is the slot currently selected? - prefer the currently held slot if tied so far.
  6. Smallest slot index - final tie-breaker: lowest (leftmost) inventory slot wins.
Text-based Flowchart
START: candidate inventory slots (all slots that matched a selector)
|
v
Compare Target Priority
|-- if different --> choose highest Target Priority --> END
|
v (same)
Compare Target Rating (levels 0..N)
For each level:
- compare: isGroup? (non-group preferred)
- compare: hasData? (with data preferred)
- compare: typeRating (higher wins)
- compare: dataRating (higher wins)
|-- if difference found --> choose winner --> END
|
v (no difference)
Compare Tool Priority
|-- if different --> choose highest Tool Priority --> END
|
v (same)
Compare Tool Rating (levels 0..N)
(same per-level rules as Target Rating)
|-- if difference found --> choose winner --> END
|
v (still tied)
Prefer currently selected slot?
|-- Yes --> choose currently selected --> END
|-- No  --> choose smallest (leftmost) slot --> END
Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

Verified by MCModsHub

These come from our own check of the pack file, not from the source page.

Explore more