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:

  • (Object): A tool context predicate object.
    • type (Resource Location): Always tconstruct:has_modifier.
    • modifier (Modifier Predicate): Predicate matching the modifier expected on the tool.
    • level (Integer Range): 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.
    • check (String): 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.

Has Material

The has material tool context predicate matches tools that contain the given material. It has the following format:

  • (Object): A tool context predicate object.
    • type (Resource Location): Always tconstruct:has_material.
    • material (Material Variant): Material variant expected on the tool.
    • index (Integer): Index expected to contain the tool material. If unset, will check the entire material list.

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:

  • (Object): A tool context predicate object.
    • type (Resource Location): Always tconstruct:has_stat_type.
    • stat_type (Stat Type): Stat type that must be used by the tool.
    • material (Material Variant): If set, the stat type must contain the passed material variant.
    • index (Integer): Index expected to contain the tool material. If unset, will check the entire material list.

Has Persistent Key

Since 1.20

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:

Has Hook

Since 1.20

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:

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:

  • (Object): A tool stack predicate object.
    • type (Resource Location): Always tconstruct:stat_in_range.
    • stat (Tool Stat): Numeric tool stat to match.
    • min (Number): Minimum allowed value. If unset, there is no minimum.
    • max (Number): Maximum allowed value. If unset, there is no maximum.

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:

  • (Object): A tool stack predicate object.
    • type (Resource Location): Always tconstruct:stat_in_set.
    • stat (Tool Stat): Tool stat to match.
    • values (Array): List of allowed values for the stat.
      • (Any): Allowed stat value. JSON type varies based on the tool stat.

Has Volatile Key

Since 1.20

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:

Tool Action

Since 1.20

The has tool action tool stack predicate matches tools that can perform the given tool action. It has the following format:

  • (Object): A tool stack predicate object.

Tool Variable

Since 1.20

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.