Reference

Builder for a ‘Reference’ loot condition.

A Reference condition defers checking to another loot condition, identified by the given MCResourceLocation, that acts as the name of the additional condition. This allows additional conditions that may have been created in a data-pack to be referred by other conditions, created from within scripts.

This condition acts as the vanilla counterpart of the Delegate loot condition, providing support only for data-packs instead of scripts.

A ‘Reference’ loot condition requires the name of the condition to call to be built correctly.

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.Reference;

Implemented Interfaces

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

Methods

Sets the name of the data-pack loot condition to query.

This parameter is required.

Returns: This builder for chaining.
Return Type: Reference

script.zs
Reference.withName(name as MCResourceLocation) as Reference
ParameterTypeDescription
Parameter
name
Type
MCResourceLocation
Description
The name of the predicate to query.

Sets the name of the data-pack loot condition to query.

The name is treated as a MCResourceLocation, lacking the type safety of the bracket handler. For this reason, it’s suggested to prefer the method with a MCResourceLocation as parameter.

This parameter is required.

Returns: This builder for chaining.
Return Type: Reference

script.zs
Reference.withName(name as string) as Reference
ParameterTypeDescription
Parameter
name
Type
string
Description
The name of the predicate to query, in MCResourceLocation form.