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.
Importing the class
Link to importing-the-class
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
Methods
Link to methods
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
Parameter | Type | Description |
---|---|---|
Parameter block | Type MCBlock | Description 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
Parameter | Type | Description |
---|---|---|
Parameter blockTag | Type MCTag<MCBlock> | Description 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
Parameter | Type | Description |
---|---|---|
Parameter builder | Type Consumer<NBTPredicate> | Description 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
Parameter | Type | Description |
---|---|---|
Parameter builder | Type Consumer<StatePropertiesPredicate> | Description A consumer that will be used to configure the StatePropertiesPredicate. |