MatchTool
Link to matchtool
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 Copyimport crafttweaker.api.loot.conditions.vanilla.MatchTool;
已实现的接口
Link to 已实现的接口
MatchTool implements the following interfaces. That means all methods defined in these interfaces are also available in MatchTool
使用方式
Link to 使用方式
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 CopyMatchTool.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 CopyMatchTool.matching(tool as IItemStack, matchDamage as boolean) as MatchTool
参数 | 类型 | 描述 |
---|---|---|
参数 tool | 类型 IItemstack | 描述 The tool that should be matched. |
参数 matchDamage | 类型 布尔值 | 描述 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 CopyMatchTool.matching(tool as IItemStack, matchDamage as boolean, matchCount as boolean) as MatchTool
参数 | 类型 | 描述 |
---|---|---|
参数 tool | 类型 IItemstack | 描述 The tool that should be matched |
参数 matchDamage | 类型 布尔值 | 描述 Whether damage should be taken into account when matching. |
参数 matchCount | 类型 布尔值 | 描述 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 CopyMatchTool.matching(tool as IItemStack, matchDamage as boolean, matchCount as boolean, matchNbt as boolean) as MatchTool
参数 | 类型 | 描述 |
---|---|---|
参数 tool | 类型 IItemstack | 描述 The tool that should be matched |
参数 matchDamage | 类型 布尔值 | 描述 Whether damage should be taken into account when matching. |
参数 matchCount | 类型 布尔值 | 描述 Whether the amount should be taken into account when matching. |
参数 matchNbt | 类型 布尔值 | 描述 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 CopyMatchTool.withPredicate(builder as Consumer<ItemPredicate>) as MatchTool
参数 | 类型 | 描述 |
---|---|---|
参数 生成器 | 类型 Consumer<ItemPredicate> | 描述 A consumer that will be used to configure the ItemPredicate. |