LootContextParams

These are pre-registered params that are used by vanilla.

You can also create your own using getOrCreate

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.param.LootContextParams;

Static Methods

Gets the ‘block_entity’ param.

Returns: The ‘block_entity’ param.
Return Type: LootContextParam<BlockEntity>

script.zs
// LootContextParams.blockEntity() as LootContextParam<BlockEntity>
LootContextParams.blockEntity();

Gets the ‘block_state’ param.

Returns: The ‘block_state’ param.
Return Type: LootContextParam<BlockState>

script.zs
// LootContextParams.blockState() as LootContextParam<BlockState>
LootContextParams.blockState();

Gets the ‘damage_source’ param.

Returns: The ‘damage_source’ param.
Return Type: LootContextParam<DamageSource>

script.zs
// LootContextParams.damageSource() as LootContextParam<DamageSource>
LootContextParams.damageSource();

Gets the ‘direct_killer_entity’ param.

Returns: The ‘direct_killer_entity’ param.
Return Type: LootContextParam<Entity>

script.zs
// LootContextParams.directKillerEntity() as LootContextParam<Entity>
LootContextParams.directKillerEntity();

Gets the ‘explosion_radius’ param.

Returns: The ‘explosion_radius’ param.
Return Type: LootContextParam<float?>

script.zs
// LootContextParams.explosionRadius() as LootContextParam<float?>
LootContextParams.explosionRadius();

Gets or creates a new parameter with the given name, using the given type.

Returns: The parameter with the given name or a new parameter if there are no registered parameters with the name.
Return Type: LootContextParam<T>

script.zs
LootContextParams.getOrCreate<T : Object>(name as ResourceLocation, tClass as Class<T>) as LootContextParam<T>
ParameterTypeDescription
Parameter
name
Type
ResourceLocation
Description
The name of the parameter.
Parameter
tClass
Type
Class<T>
Description
Parameter
T
Type
Object
Description
The type that the parameter acts on.

Gets the ‘killer_entity’ param.

Returns: The ‘killer_entity’ param.
Return Type: LootContextParam<Entity>

script.zs
// LootContextParams.killerEntity() as LootContextParam<Entity>
LootContextParams.killerEntity();

Gets the ‘last_damage_player’ parameter.

Returns: The ‘last_damage_player’ parameter.
Return Type: LootContextParam<Player>

script.zs
// LootContextParams.lastDamagePlayer() as LootContextParam<Player>
LootContextParams.lastDamagePlayer();

Gets the ‘origin’ param.

Returns: The ‘origin’ param.
Return Type: LootContextParam<Vec3>

script.zs
// LootContextParams.origin() as LootContextParam<Vec3>
LootContextParams.origin();

Gets the ‘this_entity’ parameter.

Returns: The ‘this_entity’ parameter.
Return Type: LootContextParam<Entity>

script.zs
// LootContextParams.thisEntity() as LootContextParam<Entity>
LootContextParams.thisEntity();

Gets the ‘tool’ param.

Returns: The ‘tool’ param.
Return Type: LootContextParam<ItemStack>

script.zs
// LootContextParams.tool() as LootContextParam<ItemStack>
LootContextParams.tool();