Fabric Autoswitch

Mods
3,322 Downloads Last Updated: Jan 16, 2020 Game Version: 1.15.1

What Autoswitch Does

Autoswitch (AS) reads the player's hotbar, from left to right, and finds the best tool for the job currently available. (ie. you hit a stone block with your fist, it will switch to a pickaxe). These tools have some conditions that need to be satisfied:

  • Have more than 5 durability remaining configurable
  • Have the tool on your hotbar
  • Planned: be capable of mining the block (awaiting changes to Fabric)

Blocks

When attacking a block, AS checks a couple of things to see if it should proceed:

  1. 1. AS is toggled on
  2. 2. Mowing Control
  3. 3. AS is allowed based on the player's current state and the configuration
    • creative mode
    • in multiplayer
    • allowed to switch for blocks
  4. 4. Found relevant tools in the player's hotbar
  5. 5. A relevant tool (in the order of left to right on the hotbar) targets that block's material based on the Material Configuration
  6. 6. Then the tool is switched, and if switchback is enabled it will return to the previous slot when the player's hand is no longer swinging

AS is aware of both Silk Touch and Fortune enchantments. No other enchantments are considered for blocks.

Entities

When attacking an entity, AS will check for a few things:

  1. 1. AS is toggled on
  2. 2. AS is allowed based on the player's current state and the configuration
    • creative mode
    • in multiplayer
    • allowed to switch for entities
  3. 3. Found relevant tools in the player's hotbar
  4. 4. A relevant tool (in the order of left to right on the hotbar) targets that entity's group* based on:
    • Boat -> Axe
    • Arthropods -> Weapons enchanted with Bane of Arthropods
    • Undead -> Weapons enchanted with Smite
    • Aquatic -> Tridents enchanted with Impaling If none of the above are satisfied, it will prefer weapons enchanted with Sharpness, if that is configured to be the case.
  5. 5. Then the tool is switched, and if switchback is enabled it will return to the previous slot when the player's hand is no longer swinging, and (if enabled) the item's attack cooldown has passed. It is highly recommended you leave this enabled as otherwise would prevent weapons from doing full damage against an entity.

AS has no knowledge of enchantments not listed above.

*Note

See Minecraft Wiki for details on entity groups. Group names are not exactly the same between the wiki and what Fabric uses.

Other

AS has no knowledge of an item's "use" action, and therefore will do nothing to switch when the player tries to use something. If a mod's tools do not work automatically, tell the mod author of that mod to add their tools to the proper FabricToolTags.

Find out more information here.

Comments

Posts Quoted: