LocationCheck

Builder for a ‘LocationCheck’ loot condition.

This condition checks the location at which a specific loot table has been rolled, barring a user-specified offset, as obtained via the LootContext. The check is performed according to the specified LocationPredicate.

The condition passes when the origin location of the loot table passes the checks of the predicate, after having been offset by the amount specified by the user, if present.

If no predicate is specified, the condition simply acts as a check on whether an origin location is available or not.

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.

script.zs
import crafttweaker.api.loot.conditions.vanilla.LocationCheck;

Implemented Interfaces

LocationCheck implements the following interfaces. That means all methods defined in these interfaces are also available in LocationCheck

Methods

Creates and sets the LocationPredicate that will be matched against the offset location.

Any changes that have already been made to the predicate will be overwritten, effectively replacing the previous predicate, if any.

This parameter is optional.

Returns: This builder for chaining.
Return Type: LocationCheck

script.zs
LocationCheck.withLocationPredicate(builder as Consumer<LocationPredicate>) as LocationCheck
ParameterTypeDescription
Parameter
builder
Type
Consumer<LocationPredicate>
Description
A consumer that will be used to configure the LocationPredicate.

Sets the offset which should be used to offset the location prior to the predicate check.

This parameter is optional.

Returns: This builder for chaining.
Return Type: LocationCheck

script.zs
LocationCheck.withOffset(pos as BlockPos) as LocationCheck
ParameterTypeDescription
Parameter
pos
Type
BlockPos
Description
The offset that should be applied.

Sets the offset along the X axis that should be used to offset the location prior to the predicate check.

If an offset has already been specified along any other axis, the offset along those axis is preserved. On the other hand, any previous offset that had already been set on this axis will be overwritten.

This parameter is optional.

Returns: This builder for chaining.
Return Type: LocationCheck

script.zs
LocationCheck.withXOffset(x as int) as LocationCheck
ParameterTypeDescription
Parameter
x
Type
int
Description
The offset that should be applied to the X axis.

Sets the offset along the Y axis that should be used to offset the location prior to the predicate check.

If an offset has already been specified along any other axis, the offset along those axis is preserved. On the other hand, any previous offset that had already been set on this axis will be overwritten.

This parameter is optional.

Returns: This builder for chaining.
Return Type: LocationCheck

script.zs
LocationCheck.withYOffset(y as int) as LocationCheck
ParameterTypeDescription
Parameter
y
Type
int
Description
The offset that should be applied to the Y axis.

Sets the offset along the Z axis that should be used to offset the location prior to the predicate check.

If an offset has already been specified along any other axis, the offset along those axis is preserved. On the other hand, any previous offset that had already been set on this axis will be overwritten.

This parameter is optional.

Returns: This builder for chaining.
Return Type: LocationCheck

script.zs
LocationCheck.withZOffset(z as int) as LocationCheck
ParameterTypeDescription
Parameter
z
Type
int
Description
The offset that should be applied to the Z axis.