Tool Predicates
Tool predicates are a predicate type added by Tinkers’ Construct, matching tool instances. There are two variants of tool predicates: tool stack predicates, which are used in most contexts, and tool context predicates, which are used during tool building when tools have more limited data (notably lacking access to tool durability).
The following sections discuss supported serializers.
Fallback Predicates
Tool predicates support fallback behavior; if a predicate serializer ID does not exist in the tool stack registry, it will fallback to a tool context predicate serializer with that ID. If a predicate serializer ID does not exist in the tool context predicate registry, it will fallback to the item predicate registry.
This allows both types of predicate support all common predicate serializers, along with item tag predicates matching the tool item.
Simple Predicates
Tool context predicates support the following serializers which have no extra fields:
tconstruct:has_upgrades: Matches any tools which have at least 1 modifier added via recipes.
Tool stack predicates support the following serializers which have no extra fields:
tconstruct:not_broken: Matches tools which are not broken.
Tool Context Predicates
The following predicates are supported in modules using tool context predicates.
Has Modifier
The has modifier tool context predicate matches tools that contain the given modifier. It has the following format:
- A tool context predicate object.
- Always
tconstruct:has_modifier. - Predicate matching the modifier expected on the tool.
- Range of expected levels of the modifier on the tool. Minimum level is 0, indicating the tool lacks the given modifier. If unset, defaults to 1 or more, indicating the tool has the modifier at any level.
- Modifier list to check, may be one of the following:
upgrades: Checks the list of modifiers applied using recipes.all: Checks the full list of modifiers on the tool, which includes modifiers from recipes and traits.
- Always
Has Material
The has material tool context predicate matches tools that contain the given material. It has the following format:
- A tool context predicate object.
- Always
tconstruct:has_material. - Material variant expected on the tool.
- Index expected to contain the tool material. If unset, will check the entire material list.
- Always
Has Stat Type
The has stat type tool context predicate matches tools that require a particular stat type for one of their tool parts. It has the following format:
- A tool context predicate object.
- Always
tconstruct:has_stat_type. - Stat type that must be used by the tool.
- If set, the stat type must contain the passed material variant.
- Index expected to contain the tool material. If unset, will check the entire material list.
- Always
Has Persistent Key
See also: Has Volatile Key
The has persistent key tool context predicate matches tools that have the given key set in their persistent data in NBT. It has the following format:
- A tool context predicate object.
- Always
tconstruct:has_persistent_key. - Key to check for in data.
- Always
Has Hook
The has hool tool context predicate matches tools that expose the given Tool Hook ID in any of their modules in their tool definition. It has the following format:
- A tool context predicate object.
- Always
tconstruct:has_hook. - Hook to check for on the tool definition.
- Always
Tool Stack Predicates
The following predicates are supported in modules using tool stack or tool context predicates.
Stat in Range
The stat in range tool stack predicate matches tools that have a given numeric tool stat with a value within the passed range. It has the following format:
- A tool stack predicate object.
- Always
tconstruct:stat_in_range. - Numeric tool stat to match.
- Minimum allowed value. If unset, there is no minimum.
- Maximum allowed value. If unset, there is no maximum.
- Always
Stat in Set
The stat in set tool stack predicate matches tools that have a given tool stat within the set of values. It has the following format:
- A tool stack predicate object.
- Always
tconstruct:stat_in_set. - Tool stat to match.
- List of allowed values for the stat.
- Allowed stat value. JSON type varies based on the tool stat.
- Always
Has Volatile Key
See also: Has Persistent Key
The has volatile key tool stack predicate matches tools that have the given key set in their volatile data in NBT. It has the following format:
- A tool stack predicate object.
- Always
tconstruct:has_volatile_key. - Key to check for in data.
- Always
Tool Action
The has tool action tool stack predicate matches tools that can perform the given tool action. It has the following format:
- A tool stack predicate object.
- Always
tconstruct:tool_action. - Tool action to check.
- Always
Tool Variable
The tool variable predicate is a tool stacks variable predicate that matches using Tool Variable. See that section for more information on the JSON format.