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.
Importare la Classe
Link to importare-la-classe
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
Metodi
Link to metodi
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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro block | Tipo MCBlock | Descrizione 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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro blockTag | Tipo MCTag<MCBlock> | Descrizione 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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro costruttore | Tipo Consumer<NBTPredicate> | Descrizione 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
Parametro | Tipo | Descrizione |
---|---|---|
Parametro costruttore | Tipo Consumer<StatePropertiesPredicate> | Descrizione A consumer that will be used to configure the StatePropertiesPredicate. |