Builder for the 'MatchTool' loot condition.

This condition checks the tool that the LootContext reports as having been used to break a block or perform any other action, leveraging the provided ItemPredicate.

The condition then passes if and only if the predicate used to build the condition reports the tool as valid.

If no predicate is specified, then the condition simply acts as a check of presence for the tool.

Импорт класса

Link to импорт-класса

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.loot.conditions.vanilla.MatchTool;

Implemented Interfaces

Link to implemented-interfaces

MatchTool implements the following interfaces. That means all methods defined in these interfaces are also available in MatchTool

Name: matching

Sets the tool that should be matched by this loot condition.

The check will ignore any damage, amount, and NBT data that may be attached to the tool.

This acts as a helper method that allows a more streamlined configuration of the condition instead of having to manually build the predicate.

If a tool has already been specified, then the newly given one will overwrite the previous check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: MatchTool

ZenScript
Copy
MatchTool.matching(tool as IItemStack) as MatchTool
ПараметрТипОписание
Параметр
tool
Тип
IItemStack
Описание
The tool that should be matched.

Name: matching

Sets the tool that should be matched by this loot condition, optionally ignoring damage.

The check will ignore any amount and NBT data that may be attached to the tool.

This acts as a helper method that allows a more streamlined configuration of the condition instead of having to manually build the predicate.

If a tool has already been specified, then the newly given one will overwrite the previous check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: MatchTool

ZenScript
Copy
MatchTool.matching(tool as IItemStack, matchDamage as boolean) as MatchTool
ПараметрТипОписание
Параметр
tool
Тип
IItemStack
Описание
The tool that should be matched.
Параметр
matchDamage
Тип
boolean
Описание
Whether damage should be taken into account when matching.

Name: matching

Sets the tool that should be matched by this loot condition, optionally ignoring damage or count.

The check will ignore any NBT data that may be attached to the tool.

This acts as a helper method that allows a more streamlined configuration of the condition instead of having to manually build the predicate.

If a tool has already been specified, then the newly given one will overwrite the previous check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: MatchTool

ZenScript
Copy
MatchTool.matching(tool as IItemStack, matchDamage as boolean, matchCount as boolean) as MatchTool
ПараметрТипОписание
Параметр
tool
Тип
IItemStack
Описание
The tool that should be matched
Параметр
matchDamage
Тип
boolean
Описание
Whether damage should be taken into account when matching.
Параметр
matchCount
Тип
boolean
Описание
Whether the amount should be taken into account when matching.

Name: matching

Sets the tool that should be matched by this loot condition, optionally ignoring damage, count, or NBT data.

This acts as a helper method that allows a more streamlined configuration of the condition instead of having to manually build the predicate.

If a tool has already been specified, then the newly given one will overwrite the previous check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: MatchTool

ZenScript
Copy
MatchTool.matching(tool as IItemStack, matchDamage as boolean, matchCount as boolean, matchNbt as boolean) as MatchTool
ПараметрТипОписание
Параметр
tool
Тип
IItemStack
Описание
The tool that should be matched
Параметр
matchDamage
Тип
boolean
Описание
Whether damage should be taken into account when matching.
Параметр
matchCount
Тип
boolean
Описание
Whether the amount should be taken into account when matching.
Параметр
matchNbt
Тип
boolean
Описание
Whether the NBT data should be taken into account when matching.

Name: withPredicate

Creates and sets the ItemPredicate that will be matched against the tool.

Any changes that have already been made to the predicate will be overwritten, effectively replacing the previous predicate, if any.

This parameter is optional.

Returns: This builder for chaining.
Return Type: MatchTool

ZenScript
Copy
MatchTool.withPredicate(builder as Consumer<ItemPredicate>) as MatchTool
ПараметрТипОписание
Параметр
конструктор
Тип
Consumer<ItemPredicate>
Описание
A consumer that will be used to configure the ItemPredicate.