DistancePredicate
Link to distancepredicate
Represents a predicate for distance.
The predicate can effectively be used to check the distance between two coordinates in 3D-space. The distance will firstly be checked separately against the x, y, and z bounds that have been specified. If those checks succeed, then horizontal distance will be taken into consideration, measuring the distance between the two points only along the X and Z axis. Lastly, the absolute distance considering all axis will be checked.
Any of the above checks will be skipped if no value has been specified for any of them. By default, the predicate will not add any restrictions on the distance between two points.
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.DistancePredicate;
Extending AnyDefaultingVanillaWrappingPredicate
Link to extending-anydefaultingvanillawrappingpredicate
DistancePredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in DistancePredicate
Methods
Link to methods
Name: withMaximumAbsoluteDistance
Sets the maximum value the absolute distance should be to max
.
If the absolute distance had already some bounds specified, then the maximum value of the bound will be
overwritten with the value specified in max
. On the other hand, if the absolute distance didn't have
any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMaximumAbsoluteDistance(max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the absolute distance should be. |
Name: withMaximumHorizontalDistance
Sets the maximum value the horizontal distance should be to max
.
If the horizontal distance had already some bounds specified, then the maximum value of the bound will be
overwritten with the value specified in max
. On the other hand, if the horizontal distance didn't
have any bounds set, the maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMaximumHorizontalDistance(max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the horizontal distance should be. |
Name: withMaximumX
Sets the maximum value the distance along the X axis should be to max
.
If the distance had already some bounds specified, then the maximum value of the bound will be overwritten with
the value specified in max
. On the other hand, if the distance didn't have any bounds set, the
maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMaximumX(max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the distance along the X axis should be. |
Name: withMaximumY
Sets the maximum value the distance along the Y axis should be to max
.
If the distance had already some bounds specified, then the maximum value of the bound will be overwritten with
the value specified in max
. On the other hand, if the distance didn't have any bounds set, the
maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMaximumY(max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the distance along the Y axis should be. |
Name: withMaximumZ
Sets the maximum value the distance along the Z axis should be to max
.
If the distance had already some bounds specified, then the maximum value of the bound will be overwritten with
the value specified in max
. On the other hand, if the distance didn't have any bounds set, the
maximum is set, leaving the lower end unbounded.
The maximum value is inclusive, meaning that a value that is equal to max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMaximumZ(max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the distance along the Z axis should be. |
Name: withMinimumAbsoluteDistance
Sets the minimum value the absolute distance should be to min
.
If the absolute distance had already some bounds specified, then the minimum value of the bound will be
overwritten with the value specified in min
. On the other hand, if the absolute distance didn't have
any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMinimumAbsoluteDistance(min as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the absolute distance should be. |
Name: withMinimumHorizontalDistance
Sets the minimum value the horizontal distance should be to min
.
If the horizontal distance had already some bounds specified, then the minimum value of the bound will be
overwritten with the value specified in min
. On the other hand, if the horizontal distance didn't
have any bounds set, the minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMinimumHorizontalDistance(min as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the horizontal distance should be. |
Name: withMinimumX
Sets the minimum value the distance along the X axis should be to min
.
If the distance had already some bounds specified, then the minimum value of the bound will be overwritten with
the value specified in min
. On the other hand, if the distance didn't have any bounds set, the
minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMinimumX(min as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the distance along the X axis should be. |
Name: withMinimumY
Sets the minimum value the distance along the Y axis should be to min
.
If the distance had already some bounds specified, then the minimum value of the bound will be overwritten with
the value specified in min
. On the other hand, if the distance didn't have any bounds set, the
minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMinimumY(min as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the distance along the Y axis should be. |
Name: withMinimumZ
Sets the minimum value the distance along the Z axis should be to min
.
If the distance had already some bounds specified, then the minimum value of the bound will be overwritten with
the value specified in min
. On the other hand, if the distance didn't have any bounds set, the
minimum is set, leaving the upper end unbounded.
The minimum value is inclusive, meaning that a value that is equal to min
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withMinimumZ(min as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the distance along the Z axis should be. |
Name: withRangedAbsoluteDistance
Sets both the minimum and maximum value the absolute distance should be to min
and max
respectively.
If the absolute distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withRangedAbsoluteDistance(min as float, max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the absolute distance should be. |
Parameter max | Type float | Description The maximum value the absolute distance should be. |
Name: withRangedHorizontalDistance
Sets both the minimum and maximum value the horizontal distance should be to min
and
max
respectively.
If the horizontal distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withRangedHorizontalDistance(min as float, max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the horizontal distance should be. |
Parameter max | Type float | Description The maximum value the horizontal distance should be. |
Name: withRangedX
Sets both the minimum and maximum value the distance along the X axis should be to min
and
max
respectively.
If the distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withRangedX(min as float, max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the distance along the X axis should be. |
Parameter max | Type float | Description The maximum value the distance along the X axis should be. |
Name: withRangedY
Sets both the minimum and maximum value the distance along the Y axis should be to min
and
max
respectively.
If the distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withRangedY(min as float, max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the distance along the Y axis should be. |
Parameter max | Type float | Description The maximum value the distance along the Y axis should be. |
Name: withRangedZ
Sets both the minimum and maximum value the distance along the Z axis should be to min
and
max
respectively.
If the distance had already some bounds specified, then they will be overwritten with the new values.
Both minimum and maximum values are inclusive, meaning that a value that is equal to either min
or
max
will pass the check.
Returns: This predicate for chaining.
Return Type: DistancePredicate
ZenScript CopyDistancePredicate.withRangedZ(min as float, max as float) as DistancePredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the distance along the Z axis should be. |
Parameter max | Type float | Description The maximum value the distance along the Z axis should be. |