Code Monkey home page Code Monkey logo

fabric-autoswitch's Introduction

AutoSwitch Java CI

AutoSwitch is a mod for Minecraft using the Fabric mod loader. It is designed to automatically change the player's tool to the correct one when it is being used.

Configuration

All provided config entries are documented in-place by the preceding lines that begin with a #. The default values of those entries are also provided there. The config files are reloaded upon being saved, allowing for quick testing and modification.

All files may be found in the config folder.

Features (autoswitch.cfg)

This config controls AutoSwitch's behavior in various aspects outside of simple tool selection. These options are available for in-game modification via the client commands, try with /autoswitch in-game.

Tool Selection (autoswitchAttackAction.cfg and autoswitchUseAction.cfg)

These are config entries defined in the format of Target = List of ToolSelectors.

The list of ToolSelectors is comma-separated and ordered. Leave blank/empty to disable switching for that target.

In placed where an id (Identifier) is needed, all colons (:) must be replaced with an exclamation mark (!) for targets, and may be done for ToolSelectors.

Target

A target can be one of three things:

  • a provided named target or target group, such as a Material or EntityGroup,
  • a specific Identifier of a block or entity, such as minecraft:stone, or
  • a TagSelector.

All colons (:) must be replaced with an exclamation mark (!) for targets.

Tool Selector

A ToolSelector has 2 parts: an ItemSelector, and a list of EnchantmentSelectors. This two are separated by a semicolon (;).

The list of EnchantmentSelectors is optional. When excluded, no enchantments are required to select the accompanying item. The list of EnchantmentSelectors is ampersand-separated (&).

Note: tools will perform a check if they are effective for the target. You can disable this behavior in the features config via miningLevelCheck.

Item Selector

An ItemSelector is what matches an item in for selection. An ItemSelector may be one of three things:

  • a provided named tool group, such as pickaxe or any,
  • a specific Identifier that matches the tools id, or
  • a TagSelector.
Enchantment Selector

An EnchantmentSelector allows for only items with matching enchantments to be selected. An EnchantmentSelector may be one of three things:

  • a provided named tool group, such as pickaxe or any,
  • a specific Identifier that matches the tools id, or
  • a TagSelector. See toolEnchantmentsStack in the features config for differing enchantment behavior.

Tag Selector

TagSelectors rely on Minecraft's tags to function. While playing, these tags are provided by the server and are and can vary by world. As such, these selectors are inherently unreliable and are not expected to work on vanilla servers, and are therefor not provided in any default capacity by AutoSwitch.

A TagSelector has the form of type@tag_id. The available types are: block, entity, item, and enchantment. The latter of which are only useful for ToolSelectors. The required type should be self explanatory.

The tag_id is the Identifier of the tag. For blocks, you can see this in the F3 menu when looking at one.

You may control these per-world via datapacks. See the Minecraft Wiki for more information.

It is the responsibility of mod authors to correctly add their additions to the conventional tags.

Why is type required?

A couple of reasons:

  • Allows for it to be differentiated from selectors matching a particular id, and
  • Internally, Minecraft stores the game objects (eg. blocks) in a Registry, which maps an Identifier to the object. These Identifiers are only guaranteed to be unique within their Registry.

Examples

To target normal stone with silk touch pickaxes: minecraft!stone = pickaxe;minecraft!silk_touch or minecraft!stone = item@c:pickaxes;minecraft!silk_touch

To target all ores with fortune pickaxes: block@c:ores = pickaxe;minecraft!fortune or block@c:ores = pickaxe;enchantment@fortune.

Bundled Dependency License Notice

This mod makes use of the OWNER library for its configuration. OWNER is licensed under the BSD license. A copy of this license can be found under assets/aswitch/OWNER-license.txt

fabric-autoswitch's People

Contributors

dexman545 avatar gralp-1 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.