Overview#
AutoSwitch (AS) is a definitive utility mod designed to streamline gameplay by removing the need for manual tool management. By monitoring the player's interactions in real-time, the mod identifies the target block or entity and instantly swaps the active hotbar slot to the most appropriate tool available. Whether you are transitioning from mining stone to shoveling dirt, or from chopping wood to fighting off a zombie, AutoSwitch ensures you always have the right equipment in hand.
The mod is built on a robust, rule-driven engine that considers tool durability, enchantments, and material compatibility. It is fully compatible with both vanilla and modded content, provided the modded items are correctly tagged within the Fabric or NeoForge ecosystems.
Core Mechanics#
The fundamental behavior of AutoSwitch is governed by a selection hierarchy that prioritizes efficiency and item safety.
Tool Selection Logic
When an action is initiated, the mod scans the player's hotbar for a tool that satisfies the following conditions:
- Durability Safety: By default, the mod will not select a tool with 5 or fewer durability remaining. This threshold is fully configurable to prevent accidental breakage of high-value gear.
- Hotbar Presence: Only items currently on the active hotbar are eligible for automatic swapping.
- Mining Capability: For blocks, the tool must be technically capable of harvesting the block (e.g., a pickaxe for ore, an axe for wood).
- Efficiency Rating: If multiple valid tools are found, the mod selects the one with the highest mining speed or damage output.
Switchback Mechanic
One of the mod's most powerful features is the Switchback system. Once enabled, AutoSwitch will remember the item you were holding before the swap. As soon as the interaction ends (when the hand-swinging animation stops and, in combat, when the attack cooldown has passed), the mod automatically returns the player to their original hotbar slot. This allows for a seamless experience where the player can hold a torch or building block while mining, only switching to a pickaxe for the duration of the break.
Block Interaction#
When attacking or interacting with a block, AutoSwitch evaluates the block's material and matches it against the player's inventory. The mod uses Material Configuration to determine the best tool for every block type.
| Block Material | Preferred Tool |
|---|---|
| Stone, Ores, Metal | Pickaxe |
| Dirt, Sand, Gravel | Shovel |
| Wood, Logs, Planks | Axe |
| Leaves, Cobwebs, Wool | Shears / Hoe |
| Crops, Nether Wart | Hoe |
Advanced Block Logic
- Silk Touch & Fortune: AutoSwitch can be configured to recognize specific blocks that require Silk Touch (like Grass Blocks or Glass) or Fortune (like Diamond Ore). It will prioritize tools with these enchantments when interacting with the respective blocks.
- Creative Mode: Switching can be toggled independently for Creative mode to prevent unwanted swaps while building.
Combat and Entities#
AutoSwitch optimizes combat by selecting weapons based on the target's entity group and the enchantments available on your weapons. This ensures maximum damage per hit.
Entity Group Priorities
The mod recognizes specific Minecraft entity groups and applies the following logic:
| Target Entity Group | Preferred Tool / Enchantment |
|---|---|
| Undead (Zombies, Skeletons, Wither) | Weapon with Smite |
| Arthropods (Spiders, Silverfish, Bees) | Weapon with Bane of Arthropods |
| Aquatic (Fish, Guardians, Drowned) | Trident with Impaling |
| Boats | Axe (for quick breaking) |
| General Entities | Weapon with Sharpness |
If no specialized enchantment is found, the mod defaults to the weapon with the highest base damage or DPS (Damage Per Second). In combat scenarios, the switchback delay is synchronized with the weapon's attack speed to ensure the player does not lose damage potential by switching too early.
Configuration#
AutoSwitch is highly customizable through its configuration file (autoswitch.json or autoswitch.conf). Users can define custom rules for specific blocks or entities, or adjust global behavior settings.
General Settings
| Option | Default | Description |
|---|---|---|
enabled |
true | Toggles the entire mod functionality. |
switchback |
true | Returns to the previous slot after the action is complete. |
durabilityThreshold |
5 | The minimum durability required for a tool to be selected. |
useInCreative |
false | Whether to allow tool swapping in Creative mode. |
multiplayerAllowed |
true | Enables the mod on multiplayer servers. |
attackCooldownSwitchback |
true | Waits for the weapon cooldown to finish before switching back. |
Rule-Based System
Advanced users can create specific rules using the following parameters:
- Priority: An integer value where higher numbers take precedence.
- Target: Can be a specific
BLOCK,ENTITY, orSTAT(like using a Totem of Undying). - Tools: An ordered list of items or tags that should be used for the target.
Controls and Keybinds#
The mod provides several keybinds to control its behavior on the fly. These can be remapped in the standard Minecraft Controls menu.
- Toggle AutoSwitch (Default: R): Quickly enables or disables the mod. Useful if the mod is interfering with specific building tasks.
- Toggle Switchback: Toggles whether the mod should return to the previous slot.
- Toggle Use Worst Tool: When enabled, the mod will prioritize the tool with the lowest durability or lowest tier that can still mine the block, helping to clear out "junk" tools.
- Config Menu: If Cloth Config and Mod Menu are installed, the configuration can be accessed directly through the in-game UI.
Compatibility#
AutoSwitch is designed to be as compatible as possible with other mods.
- Fabric Tool Tags: The mod relies on standard Fabric API tool tags. If a modded tool (e.g., from Tinkers' Construct or Mekanism) is not being recognized, ensure it is correctly tagged by its author.
- Multiplayer: The mod is primarily client-side. It works on servers even if the server does not have the mod installed, as it simply automates the player's hotbar slot selection.
-
Requirements:
- Fabric API (for Fabric versions).
- Architectury API & Cloth Config (required for the in-game configuration screen).