Перейти к содержимому
Mineforgian

AutoSwitch

Automatic switching of tools when you perform an action.

157K загрузок368 подписчиковLGPL-3.0-onlyfabricneoforge

Обновлён 16 июня 2026 г. · опубликован 14 декабря 2020 г.

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:

  • attack-action - rules used when attacking (entities or blocks).
  • interact-action - rules used when interacting (right-click-like actions).
  • stat-change-action - rules triggered by stat events (e.g., using a totem of undying).
  • feature-config - Controls the overall behaviour of the mod.

Each rule contains:

  • priority - integer; higher values are given precedence what multiple targets match.
  • target - what this rule matches (types: BLOCK, ENTITY, STAT, or an EXPRESSION allowing the combination of other targets). Targets can reference tags or specific explicit IDs (minecraft:ender_chest, sugar_cane).
  • tools - ordered array of candidates to switch to. Each must be an ITEM or an EXPRESSION of ITEMs, or be an empty list (to disable switching for that target).

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:

  • OR - Match any one of its children
  • AND - Match all of its children
  • NOT - Match none of its children
  • XOR - Match only one of its children

Data

Currently, the following data types are supported:

  • BlockState - The block state to match
  • Component - Currently only supports POTION_CONTENTS on items
  • Enchantment - The enchantments an item has
  • EntityEquipment - The equipment an entity is wearing, such as a pig with a saddle

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

Версии

ВерсияКаналИграЗагрузчикиДатаСкачать
16.0.0Релиз26.2-pre-6, 26.2-rc-1, 26.2-rc-2, 26.2neoforge16 июня 2026 г..jar (985 КБ)
16.0.0Релиз26.2-pre-6, 26.2-rc-1, 26.2-rc-2, 26.2fabric16 июня 2026 г..jar (972 КБ)
16.0.0-alpha.1Альфа26.2-pre-4, 26.2-pre-5, 26.2-pre-6, 26.2-rc-1fabric11 июня 2026 г..jar (972 КБ)
15.0.1Релиз26.2-snapshot-1, 26.1.2-rc-1, 26.1.2, 26.2-snapshot-2neoforge11 апреля 2026 г..jar (985 КБ)
15.0.1Релиз26.2-snapshot-1, 26.1.2-rc-1, 26.1.2, 26.2-snapshot-2fabric11 апреля 2026 г..jar (972 КБ)
15.0.0Релиз26.1-rc-2, 26.1-rc-3, 26.1, 26.1.1neoforge24 марта 2026 г..jar (985 КБ)
15.0.0Релиз26.1-rc-2, 26.1-rc-3, 26.1, 26.1.1fabric24 марта 2026 г..jar (973 КБ)
15.0.0-alpha.3Альфа26.1-snapshot-1, 26.1-snapshot-2, 26.1-snapshot-3fabric18 января 2026 г..jar (972 КБ)
13.3.0Релиз1.21.11-pre5, 1.21.11-rc1, 1.21.11-rc2, 1.21.11-rc3neoforge18 января 2026 г..jar (985 КБ)
13.3.0Релиз1.21.11-pre5, 1.21.11-rc1, 1.21.11-rc2, 1.21.11-rc3fabric18 января 2026 г..jar (982 КБ)
14.1.0Релиз1.21.11neoforge18 января 2026 г..jar (985 КБ)
14.1.0Релиз1.21.11fabric18 января 2026 г..jar (981 КБ)
12.3.0Релиз25w33a, 25w34a, 25w34b, 25w35aneoforge18 января 2026 г..jar (966 КБ)
12.3.0Релиз25w33a, 25w34a, 25w34b, 25w35afabric18 января 2026 г..jar (963 КБ)
15.0.0-alpha.2Альфа26.1-snapshot-1fabric30 декабря 2025 г..jar (973 КБ)

Показаны последние 15 из 140 версий. Все версии — на Modrinth.

Ченджлог

16.0.0Релиз26.2-rc-1, 26.2-rc-2, 26.2 · 16 июня 2026 г.
  • Update for 26.2
16.0.0Релиз26.2-rc-1, 26.2-rc-2, 26.2 · 16 июня 2026 г.
  • Update for 26.2
16.0.0-alpha.1Альфа26.2-pre-5, 26.2-pre-6, 26.2-rc-1 · 11 июня 2026 г.
  • Fix crash on joining world
15.0.1Релиз26.1.2-rc-1, 26.1.2, 26.2-snapshot-2 · 11 апреля 2026 г.
  • Fix crash on joining world
15.0.1Релиз26.1.2-rc-1, 26.1.2, 26.2-snapshot-2 · 11 апреля 2026 г.
  • Fix crash on joining world
15.0.0Релиз26.1-rc-3, 26.1, 26.1.1 · 24 марта 2026 г.
  • Update for 26.1 and unobfuscated Minecraft
  • Fix an error when writing an ExpressionTree to the config file
  • Fix an error when writing data to the config file
  • Add support for "exploded data" - that is, the outer data {} tag is now optional. If present, it will take precedence over the implicitly defined data.
  • Improve the maintainability of the ToolSorter
  • Remove unnecessary OR statements from the default config
  • Allow eliding type=<enchantment|item> in tools list, offhand selectors, and enchantments definitions
  • Fix usage of neoforge-replaced way of getting item enchantments
  • Add a default target for ores
    • By default, prefers pickaxes with fortune over those with silk touch, unless the player is crouching, in which case the opposite occurs with silk touch being preferred.
  • Ported Fabric API's "Client Tags" module to Neoforge
    • Now conventional tags (eg c:ores) will work when connecting to a vanilla server from a Neoforge client
  • Fix more complicated data structures not being written correctly
  • Fix Neoforge update url
  • Separate preserve-damaged-items out from skip-depleted-items to allow these behaviors to be controlled independently
  • Add Player data type, mostly to support things like the mace
    • Usable in any IdSelector (anywhere you can have a data entry)

    • Supports the same sort of value comparison as Enchantment Levels

    • Example

      target {
        type=BLOCK
        id="obsidian"
        data {
          player {
            isCrouching = true
            distance {
              GREATER = 2
            }
          }
        }
      }
      
    • Currently Available Entries

      Type Description Type
      isFlying If the player is flying Boolean
      isCrouching If the player is crouching Boolean
      isPassenger If the player is riding something Boolean
      isOnGround If the player is on the ground Boolean
      isSprinting If the player is sprinting Boolean
      distance The distance between the player and target Number
      fallDistance The distance the player has fallen Number
      hasItem If the player has the given item ExpressionTree
      hasHotbarItem If the player has the given item on their hotbar ExpressionTree
15.0.0Релиз26.1-rc-3, 26.1, 26.1.1 · 24 марта 2026 г.
  • Update for 26.1 and unobfuscated Minecraft
  • Fix an error when writing an ExpressionTree to the config file
  • Fix an error when writing data to the config file
  • Add support for "exploded data" - that is, the outer data {} tag is now optional. If present, it will take precedence over the implicitly defined data.
  • Improve the maintainability of the ToolSorter
  • Remove unnecessary OR statements from the default config
  • Allow eliding type=<enchantment|item> in tools list, offhand selectors, and enchantments definitions
  • Fix usage of neoforge-replaced way of getting item enchantments
  • Add a default target for ores
    • By default, prefers pickaxes with fortune over those with silk touch, unless the player is crouching, in which case the opposite occurs with silk touch being preferred.
  • Ported Fabric API's "Client Tags" module to Neoforge
    • Now conventional tags (eg c:ores) will work when connecting to a vanilla server from a Neoforge client
  • Fix more complicated data structures not being written correctly
  • Fix Neoforge update url
  • Separate preserve-damaged-items out from skip-depleted-items to allow these behaviors to be controlled independently
  • Add Player data type, mostly to support things like the mace
    • Usable in any IdSelector (anywhere you can have a data entry)

    • Supports the same sort of value comparison as Enchantment Levels

    • Example

      target {
        type=BLOCK
        id="obsidian"
        data {
          player {
            isCrouching = true
            distance {
              GREATER = 2
            }
          }
        }
      }
      
    • Currently Available Entries

      Type Description Type
      isFlying If the player is flying Boolean
      isCrouching If the player is crouching Boolean
      isPassenger If the player is riding something Boolean
      isOnGround If the player is on the ground Boolean
      isSprinting If the player is sprinting Boolean
      distance The distance between the player and target Number
      fallDistance The distance the player has fallen Number
      hasItem If the player has the given item ExpressionTree
      hasHotbarItem If the player has the given item on their hotbar ExpressionTree
15.0.0-alpha.3Альфа26.1-snapshot-1, 26.1-snapshot-2, 26.1-snapshot-3 · 18 января 2026 г.
  • Update for 26.1 and unobfuscated Minecraft
  • Fix an error when writing an ExpressionTree to the config file
  • Fix an error when writing data to the config file
  • Add support for "exploded data" - that is, the outer data {} tag is now optional. If present, it will take precedence over the implicitly defined data.
  • Improve the maintainability of the ToolSorter
  • Remove unnecessary OR statements from the default config
  • Allow eliding type=<enchantment|item> in tools list, offhand selectors, and enchantments definitions
  • Fix usage of neoforge-replaced way of getting item enchantments
  • Add a default target for ores
    • By default, prefers pickaxes with fortune over those with silk touch, unless the player is crouching, in which case the opposite occurs with silk touch being preferred.
  • Ported Fabric API's "Client Tags" module to Neoforge
    • Now conventional tags (eg c:ores) will work when connecting to a vanilla server from a Neoforge client
  • Fix more complicated data structures not being written correctly
  • Fix Neoforge update url
  • Add Player data type, mostly to support things like the mace
    • Usable in any IdSelector (anywhere you can have a data entry)

    • Supports the same sort of value comparison as Enchantment Levels

    • Example

      target {
        type=BLOCK
        id="obsidian"
        data {
          player {
            isCrouching = true
            distance {
              GREATER = 2
            }
          }
        }
      }
      
    • Currently Available Entries

      Type Description Type
      isFlying If the player is flying Boolean
      isCrouching If the player is crouching Boolean
      isPassenger If the player is riding something Boolean
      isOnGround If the player is on the ground Boolean
      isSprinting If the player is sprinting Boolean
      distance The distance between the player and target Number
      fallDistance The distance the player has fallen Number
      hasItem If the player has the given item ExpressionTree
      hasHotbarItem If the player has the given item on their hotbar ExpressionTree

Полная история изменений — на Modrinth.

Комментарии

Загружаем…