LocationPredicate
Represents a predicate for a location an entity or a block may be in.
This predicate firstly ensures that the given location is inside the coordinate bounds. If the check passes, then the predicate ensures that the dimension, biome, and feature that are at the specified coordinates correctly match the values that have been specified if any. Moreover, the predicate is also able to check if the block is situated above a campfire, or validate either the block or fluid at the current location, using respectively either a BlockPredicate or a FluidPredicate. It is also able to check the light level of the current location with a LightPredicate.
By default, any location is valid for this predicate.
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.
Extending AnyDefaultingVanillaWrappingPredicate
LocationPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in LocationPredicate
Methods
Sets the biome in which the location should be.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter biome | Type MCResourceLocation | Description The name of the biome. |
Creates and sets the BlockPredicate that will be used to match the block at the location.
Any changes that have been made previously to the block predicate will be discarded, if any.
Returns: The predicate itself for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter builder | Type Consumer<BlockPredicate> | Description A consumer that will be used to configure the BlockPredicate. |
Indicates that the location must be on top of a campfire.
If the predicate had already been set to check the opposite condition, the setting will be overwritten.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Sets the dimension where the location should be located in.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter dimension | Type MCResourceLocation | Description The name of the dimension. |
Sets the value of the X position to exactly match the given value
.
If the position had already some bounds specified, then they will be overwritten with the new value.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter x | Type float | Description The exact value the X position should assume. |
Sets the value of the Y position to exactly match the given value
.
If the position had already some bounds specified, then they will be overwritten with the new value.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter y | Type int | Description The exact value the Y position should assume. |
Sets the value of the Z position to exactly match the given value
.
If the position had already some bounds specified, then they will be overwritten with the new value.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter z | Type int | Description The exact value the Z position should assume. |
Sets the name of the feature this location should be located in.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter feature | Type string | Description The name of the feature. |
Creates and sets the FluidPredicate that will be used to match the block at the location, if present.
Any changes that have been made previously to the fluid predicate will be discarded, if any.
Returns: The predicate itself for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter builder | Type Consumer<FluidPredicate> | Description A consumer that will be used to configure the FluidPredicate. |
Creates and sets the LightPredicate that will be used to match the light level at the location.
Any changes that have been made previously to the light level predicate will be discarded, if any.
Returns: The predicate itself for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter builder | Type Consumer<LightPredicate> | Description A consumer that will be used to configure the LightPredicate. |
Sets the maximum value the X position can assume to max
.
If the position 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 position 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 min
will pass the check.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the X position can assume. |
Sets the maximum value the Y position can assume to max
.
If the position 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 position 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 min
will pass the check.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the Y position can assume. |
Sets the maximum value the Z position can assume to max
.
If the position 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 position 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 min
will pass the check.
Returns: This predicate for chaining.
Return Type: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter max | Type float | Description The maximum value the Z position can assume. |
Sets the minimum value the X position can assume to min
.
If the position 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 position 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: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the X position can assume. |
Sets the minimum value the Y position can assume to min
.
If the position 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 position 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: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the Y position can assume. |
Sets the minimum value the Z position can assume to min
.
If the position 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 position 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: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the Z position can assume. |
Sets both the minimum and maximum values the X position can assume to min
and max
respectively.
If the position 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: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the X position can assume. |
Parameter max | Type float | Description The maximum value the X position can assume. |
Sets both the minimum and maximum values the Y position can assume to min
and max
respectively.
If the position 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: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the Y position can assume. |
Parameter max | Type float | Description The maximum value the Y position can assume. |
Sets both the minimum and maximum values the Z position can assume to min
and max
respectively.
If the position 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: LocationPredicate
Parameter | Type | Description |
---|---|---|
Parameter min | Type float | Description The minimum value the Z position can assume. |
Parameter max | Type float | Description The maximum value the Z position can assume. |
Indicates that the location must not be on top of a campfire.
If the predicate had already been set to check the opposite condition, the setting will be overwritten.
Returns: This predicate for chaining.
Return Type: LocationPredicate