BlockPredicate
Link to blockpredicate
Represents a predicate for a MCBlock.
This predicate will match a block state with either the given MCBlock or block tag (MCTag<T>), with the second check taking precedence over the first if they are both present. If this comparison succeeds, then the predicate may also verify additional block state properties via the supplied StatePropertiesPredicate or specific parts of the NBT data of the block entity associated to the state via a NBTPredicate.
By default, this predicate allows any block state to pass the checks without restrictions.
导入类
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.predicate.BlockPredicate;
Extending AnyDefaultingVanillaWrappingPredicate
Link to extending-anydefaultingvanillawrappingpredicate
BlockPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in BlockPredicate
使用方式
Link to 使用方式
Name: withBlock
Sets the block that this predicate should match.
If a tag to match against has already been set, then the tag check will take precedence over this check.
Returns: This predicate for chaining.
Return Type: BlockPredicate
ZenScript CopyBlockPredicate.withBlock(block as MCBlock) as BlockPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 block #方块 | 类型 MCBlock #MC方块 | 描述 The block the predicate should match. |
Name: withBlockTag
Sets the tag that this predicate should use for matching.
The predicate will successfully match only if the supplied block state's block is contained within the given tag.
Specifying both a tag and a block to match against will make the tag take precedence over the block.
Returns: This predicate for chaining.
Return Type: BlockPredicate
ZenScript CopyBlockPredicate.withBlockTag(blockTag as MCTag<MCBlock>) as BlockPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 blockTag | 类型 MCTag<MCBlock> | 描述 The tag the predicate should use for matching. |
Name: withDataPredicate
Creates and sets the NBTPredicate that will be matched against the block entity's data.
Any changes that have already been made to the NBT predicate will be overwritten, effectively replacing the previous one, if any.
Returns: This predicate for chaining.
Return Type: BlockPredicate
ZenScript CopyBlockPredicate.withDataPredicate(builder as Consumer<NBTPredicate>) as BlockPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 生成器 | 类型 Consumer<NBTPredicate> | 描述 A consumer that will be used to configure the NBTPredicate. |
Name: withStatePropertiesPredicate
Creates and sets the StatePropertiesPredicate that will be matched against the block state's properties.
Any changes that have already been made to the state properties predicate will be overwritten, effectively replacing the previous one, if any.
Returns: This predicate for chaining.
Return Type: BlockPredicate
ZenScript CopyBlockPredicate.withStatePropertiesPredicate(builder as Consumer<StatePropertiesPredicate>) as BlockPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 生成器 | 类型 Consumer<StatePropertiesPredicate> | 描述 A consumer that will be used to configure the StatePropertiesPredicate. |