StatePropertiesPredicate
Link to statepropertiespredicate
Represents a predicate for a MCBlock or MCFluid state properties.
This predicate can check an arbitrary amount of properties either for an exact match or a value that is within the range of allowed values. The predicate is not able to check for the absence of a state property, and requires all specified properties to be present on the targeted state.
By default, no properties are checked, effectively allowing any block or fluid state.
导入类
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.StatePropertiesPredicate;
Extending AnyDefaultingVanillaWrappingPredicate
Link to extending-anydefaultingvanillawrappingpredicate
StatePropertiesPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in StatePropertiesPredicate
使用方式
Link to 使用方式
Name: withExactProperty
Adds the property name
to the list of properties that should be matched, along with a boolean value that should be matched exactly.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing an integer with a boolean is allowed).
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withExactProperty(name as string, value as boolean) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 value | 类型 布尔值 | 描述 The boolean value the property must have. |
Name: withExactProperty
Adds the property name
to the list of properties that should be matched, along with an integer value that should be matched exactly.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing a string with an integer is allowed).
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withExactProperty(name as string, value as int) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 value | 类型 int | 描述 The integer value the property must have. |
Name: withExactProperty
Adds the property name
to the list of properties that should be matched, along with a string value that should be matched exactly.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing an integer with a string is allowed).
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withExactProperty(name as string, value as string) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 value | 类型 string | 描述 The string value the property must have. |
Name: withLowerBoundedProperty
Adds the property name
to the list of properties that should be matched, along with a lower limit on the integer values the property can assume, set to min
.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing a string with an integer is allowed).
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withLowerBoundedProperty(name as string, min as int) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 min | 类型 int | 描述 The minimum integer value the property must have. |
Name: withRangedProperty
Adds the property name
to the list of properties that should be matched, along with a range that goes from min
to max
in which the integer value should be.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing a string with an integer is allowed).
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withRangedProperty(name as string, min as int, max as int) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 min | 类型 int | 描述 The minimum integer value the property must have. |
参数 max | 类型 int | 描述 The maximum integer value the property must have. |
Name: withRangedProperty
Adds the property name
to the list of properties that should be matched, along with a range that goes from min
to max
in which the string value should be.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing an integer with a string is allowed).
A null value in either min
or max
is considered as an unbounded limit, effectively making the interval open on one side.
A null value in both min
and max
is treated as a simple presence check, without caring about the actual value of the property.
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withRangedProperty(name as string, min as string?, max as string?) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 min | 类型 string? | 描述 The minimum string value the property must have, or null to indicate no minimum value. |
参数 max | 类型 string? | 描述 The maximum string value the property must have, or null to indicate no maximum value. |
Name: withUpperBoundedProperty
Adds the property name
to the list of properties that should be matched, along with an upper limit on the integer values the property can assume, set to max
.
If the same property had already been specified, then the previous value is replaced, no matter the resulting type (i.e. replacing a string with an integer is allowed).
Returns: This predicate for chaining.
Return Type: StatePropertiesPredicate
ZenScript CopyStatePropertiesPredicate.withUpperBoundedProperty(name as string, max as int) as StatePropertiesPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 name(名称) | 类型 string | 描述 The name of the property to check. |
参数 max | 类型 int | 描述 The maximum integer value the property must have. |