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
withBiomeName
Sets the biome in which the location should be.
Return Type: LocationPredicate
withBlockPredicate
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.
Return Type: LocationPredicate
withCampfireBelow
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.
Return Type: LocationPredicate
withDimension
Sets the dimension where the location should be located in.
Return Type: LocationPredicate
withExactXPosition
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.
Return Type: LocationPredicate
withExactYPosition
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.
Return Type: LocationPredicate
withExactZPosition
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.
Return Type: LocationPredicate
withFeatureName
Sets the name of the feature this location should be located in.
Return Type: LocationPredicate
withFluidPredicate
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.
Return Type: LocationPredicate
withLightPredicate
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.
Return Type: LocationPredicate
withMaximumXPosition
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.
Return Type: LocationPredicate
withMaximumYPosition
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.
Return Type: LocationPredicate
withMaximumZPosition
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.
Return Type: LocationPredicate
withMinimumXPosition
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.
Return Type: LocationPredicate
withMinimumYPosition
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.
Return Type: LocationPredicate
withMinimumZPosition
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.
Return Type: LocationPredicate
withRangedXPosition
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.
Return Type: LocationPredicate
withRangedYPosition
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.
Return Type: LocationPredicate
withRangedZPosition
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.
Return Type: LocationPredicate
withoutCampfireBelow
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.
Return Type: LocationPredicate