Represents a predicate for all kinds of NBT data.

The predicate will match the given NBT exactly, making partial matches not possible with this predicate. Nevertheless, a predicate without any NBT specified will be considered effectively as a way of matching any NBT data construct.

By default, the predicate allows any NBT, without checking it.

Diese Klasse importieren

Link to diese-klasse-importieren

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.predicate.NBTPredicate;

Extending AnyDefaultingVanillaWrappingPredicate

Link to extending-anydefaultingvanillawrappingpredicate

NBTPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in NBTPredicate

Name: withData

Sets the NBT data that should be matched by this predicate.

The given IData instance is required to be an instance of MapData. Any other type of data cannot be checked by this predicate.

If the NBT data had already been set, then the data is replaced with the new instance.

Returns: This predicate for chaining.
Return Type: NBTPredicate

ZenScript
Copy
NBTPredicate.withData(data as IData) as NBTPredicate
ParameterTypeBeschreibung
Parameter
data
Type
IData
Beschreibung
A MapData representing the NBT to match.