Tool Definitions 1.16-1.18
This page is about the JSON defining a tool properties from 1.16 to 1.18.2. For the format since 1.19, see Tool Definitions. For the recipes defining tool crafting, see Tool Recipes.
Tool definitions are used to assign behaviors to a tool. Tool definitions are located under data/<domain>/tinkering/tool_definitions/<name>.json
for the tool definition ID <domain>:<name>
.
Format
A tool definition has the following format:
- stat provider).
IToolPart
and have a valid stat type for the tool’s stat provider. May not be set alongsidestat
.
Tool part item for the index, must implement - stat provider. May not be set alongside
part
.
Stat type for the index, must be valid for the tool’s - Weight of the part, used when there are multiple parts of the same type for a weighted average. If unset, defaults to 1.
A part requirement.
List of tool parts for each material index. Order determines the order of materials in all relevant contexts. If unset, tool will have no parts (which is either required or disallowed based on the tool’s - tool stat IDs to the value to set for that stat. If unset, tool uses default values for all base stats.
<tool_stat>
to the given value. JSON type is determined by the stat.
Sets the value for
Mapping from - numeric tool stat IDs to the multiplier value.
<tool_stat>
to the given value.
Sets the multiplier for
Mapping from
Sets the base stats and multipliers for the tool. If unset, tool uses default values for all base stats and 1.0 multipliers.
- tool stat IDs to the value to set for that stat. If unset, tool uses default values for all base stats.
- slot type
<slot>
.
Number of slots added of the
Starting modifier slots for this tool. If unset, the tool has no starting slots.
- slot type
- Modifier to apply as a trait.
- Level of the modifier to apply. If unset, defaults to 1.
A tool trait.
List of starting tool traits. If unset, defaults to an empty list.
- A tool action which may be performed by this tool.
Since 1.18, set of tool actions which may be performed by this tool. If unset, defaults to an empty list.
- harvest logic type. The
- Any other fields defined by the harvest logic type.
Determines the effective blocks for the tool along with additional mining speed bonuses. If unset, uses default harvest logic.
- AOE iterator type. The
- Any other fields defined by the AOE iterator type.
Determines the shape of AOE mining on the tool. If unset, the tool has no AOE mining.
Since 1.18, sets various properties related to using the tool has a harvest tool. If unset, the tool uses default harvest logic and no AOE iterator.
- weapon attack type. The
- Any other fields defined by the weapon attack type.
Since 1.18, determines the shape of AOE mining on the tool. If unset, the tool has no AOE mining.
- tool hook ID to a tool module implementing that hook. If unset, tool implements no additional hooks.
- tool hook
<tool_hook>
.- tool module type. The
- Any other fields defined by the tool module type.
Module implementing the
Since 1.18.2, map of additional - tool hook
The root tool definition object.
- stat provider).
Stat Providers
All tools must have a stat provider, which determines which tool parts are allowed and required, and how those parts are used to compute stats. Stat providers are defined in Java, meaning they cannot be configured for a given tool. The following stat providers are valid for tools requesting a stat provider:
tconstruct:no_parts
: Stat provider for a tool with no tool parts. Will cause the tool definition to error if the parts array has any values.tconstruct:melee_harvest
: Stat provider for melee weapons and harvest tools. Requires one or more parts of stat typetconstruct:head
, and also supports stat typestconstruct:handle
andtconstruct:extra
. See Melee/Harvest Stat Type for more info.tconstruct:ranged
: Since 1.18.2, stat provider for ranged weapons such as bows. Requires one or more parts of stat typetconstruct:limb
, and also supports stat typestconstruct:grip
andtconstruct:bowstring
. See Ranged Stat Type for more info.
In addition, the following stat providers are used but not registered (meaning they are not available to JSON Things):
- Skull Stats: Stat provider for slime skulls. Requires one or more parts of stat type
tconstruct:skull
. See Skull Stat Type for more info.
Harvest Logic
Harvest logic determines which blocks a tool is effective on, additional modifiers to tool mining speed, and the maximum tier a tool may harvest. Tool harvest logic has the following format:
- The harvest logic type.
- Any other fields defined by the harvest logic type.
A harvest logic object.
The following subsections describe the formats for specific harvest logic types.
Effective Tag
Tag harvest logic defines the most common form of harvest logic using a tag to describe effective blocks. It has the following format:
tconstruct:effective_tag
.
Always - Block tag containing the blocks this tool is effective on.
A harvest logic object.
Modified Tag
The modified tag harvest logic defines harvest logic that is effective on a given tag, but also has additional mining speed modifiers to specific blocks. It is notably used by the mattock to allow mining some blocks that are not marked as effective a bit faster. It has the following format:
tconstruct:modified_tag
.
Always - Block tag containing the blocks this tool is effective on.
- Multiplier to mining speed for any blocks matching the block predicate.
- Block predicate determining the blocks affected by this modifier. Uses the legacy Tinkers’ Construct block predicate.
List of mining speed modifiers to apply.
A harvest logic object.
Fixed Tier
The fixed tier harvest logic defines harvest logic that is effective on a given tag, but cannot mine above the listed mining tier. It is notably used by the pickadze to limit the mining tier to gold. It has the following format:
tconstruct:fixed_tier
.
Always - Block tag containing the blocks this tool is effective on.
- Maximum mining tier for this tool.
A harvest logic object.
AOE Iterators
AOE iterators implement different shapes of multi-block harvest on tools, including with how they expand when the expander modifier is applied. They have the following base format:
- The AOE iterator type.
- Any other fields defined by the AOE iterator type.
A AOE iterator object.
The following subsections describe the formats for specific AOE iterator types.
Box AOE Iterator
The box AOE iterator defines tool AOE in a cube, with the following format:
tconstruct:box
.
Always - Base box width radius, defaults to 0.
- Base box height radius, defaults to 0.
- Base box depth, defaults to 0.
Box size expansion applied when the tool has no expanders.
- Level box width radius, defaults to 0.
- Level box height radius, defaults to 0.
- Level box depth, defaults to 0.
Box size expansion for a level.
List of expansions to apply at each level. If the level exceeds the list size, will cycle through the list again. For example, if the list size is 2 and the level is 3, the first expansion is applied twice and the second once.
width
,height
, anddepth
are oriented with respect to the player’s position and targeted block. By default, the following options exist:tconstruct:side_hit
: Orients based on the targeted block face.width
is to the left/right of the target,height
is above/below the target, anddepth
back behind the target.tconstruct:pitch
: Orients based on the direction the player is facing.width
is to the left/right of the player view,height
is above/below the player view, anddepth
back behind the player view.tconstruct:height
: Orients height to the Y axis,width
to the left/right of the side hit, anddepth
behind the target. When targeting the top or bottom of a block,width
orients to the left/right of the player view, anddepth
behind the player view.
Determines how
A tool module object.
Circle AOE Iterator
The circle AOE iterator defines tool AOE in a radius around the targeted block, with the following format:
tconstruct:circle
.
Always - Base diameter, summed with the expander value for the total size.
- If true, AOE area will be a 3D half sphere. If false (default), will be a circle.
A tool module object.
Tree AOE Iterator
The tree AOE iterator defines tool AOE that targets all matching logs in a tree. It has the following format:
tconstruct:tree
.
Always - Bonus width radius applied at level 0, defaults to 0. Every other level starting with the first increases width by 1.
- Bonus depth applied at level 0, defaults to 0. Every other level starting with the second increases depth by 1.
A tool module object.
Veining AOE Iterator
The veining AOE iterator defines tool AOE that targets all matching connected blocks up to a given recursion depth.
tconstruct:vein
.
Always - Maximum distance from the targeted block through matching blocks to include, defaults to 0. Summed with the expander level.
A tool module object.
Fallback AOE Iterator
The fallback AOE iterator nests two AOE iterators, using the first if the targeted block matches the given predicate, or the fallback if it does not match the predicate. It has the following format:
tconstruct:fallback
.
Always - Block tag to check.
tag
matches the targeted block.
Iterator to run if tag
does not match the targeted block.
Iterator to run if
A tool module object.
Weapon Attacks
Weapon attacks implement additional behavior that runs after attacking with the tool. They have the following base format:
- The weapon attack type.
- Any other fields defined by the weapon attack type.
A weapon attack object.
The following subsections describe the formats for specific weapon attack types.
Particle Weapon Attack
The particle weapon attack module defines a particle to display whenever attacking with this weapon while fully charged. It has the following format:
tconstruct:particle
.
Always SimpleParticleType
.
Particle to display on fully charged attacks. Must be a
A tool module object.
Circle Weapon Attack
The circle weapon attack defines an AOE attack centered on the target when the weapon is fully charged. All targets will be targeted by a full attack, meaning modifiers will apply to each target separately but more durability is consumed.
The circle weapon attack has the following format:
tconstruct:circle
.
Always - Range from the original target to also hit with the attack, defaults to 0. The expander level will add to this range.
A tool module object.
Sweep Weapon Attack
The sweep weapon attack grants a tool a sweeping attack, similar to the vanilla sword’s sweep attack. The attack AOE is centered on the attacker, and all targets are dealt damage based damage dealt to the main target scaled by the level of sweeping edge. Modifiers are not applied to additional target, and conditional damage such a smite only considers the primary target.
The sweep weapon attack has the following format:
tconstruct:sweep
.
Always - Range from the attacker to perform the sweep attack, defaults to 0. The expander level will be added to this range.
A tool module object.
Tool Hooks
Tool hooks are used to define additional behaviors on a tool beyond those covered in the default serializer. The following tool hooks exist:
tconstruct:tool_interaction
: Hook defining whether a given interaction modifier is allowed to run on the tool. Used to control whether interaction modifiers run on “attack” or “interact” for tools that support multiple methods of interaction, or to ensure only blocking runs on “interact” on shields.
The reason there is only a single tool hook is because the system was implemented to allow flexability in addons, with the intention of eventually migrating tool type specific behaviors such as attack or harvest to tool hooks. This migration was ultimately completed in 1.19.
Tool Modules
Tool modules are used to implement tool hooks. Unlike the system that would eventually come to 1.19, tool modules in 1.18 may only implement a single hook. They have the following base format:
- The tool module type.
- Any other fields defined by the tool module type.
A tool module object.
The following subsections describe the format for specific tool modules.
Dual Interaction
The dual interaction module implements the tconstruct:tool_interaction
hook for a tool that can interact on both “attack” (left click) and “interact” (right click). By default, all interaction modifiers will run on “interact” with this hook, but any modifiers defined in the tool’s persistent data set tconstruct:attack_modifiers
will trigger on attack instead. Modifiers are added to that set using the modifier set recipe.
The dual interaction module has a type of tconstruct:dual_option_interaction
, and no additional fields.
Preference Set Interaction
The preference set interaction module implements the tconstruct:interaction
hook for a tool that can interact on both “attack” (left click) and “interact” (right click). This module defines a set of modifiers which interact on one source, and all modifiers outside that set interact on the other source. It is notably used on shields, which set “interact” to the blocking modifier, and run all other interaction modifiers on left click.
The preference set interaction module has the following format:
tconstruct:preference_set_interaction
.
Always preferred_source
. Any modifiers that don’t match the predicate will interact on the other source.
Predicate matching modifiers to put on preferred_modifiers
. May beright_click
(for interact) orleft_click
(for attack).
Interaction source to use for
A tool module object.