NBTPredicate
Link to nbtpredicate
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.
导入类
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.NBTPredicate;
Extending AnyDefaultingVanillaWrappingPredicate
Link to extending-anydefaultingvanillawrappingpredicate
NBTPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in NBTPredicate
使用方式
Link to 使用方式
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 CopyNBTPredicate.withData(data as IData) as NBTPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 data | 类型 IData #数据 | 描述 A MapData representing the NBT to match. |