LootContextParams

Link to lootcontextparams

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

You can also create your own using getOrCreate

Importing the class

Link to 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.

ZenScript
Copy
import crafttweaker.api.loot.param.LootContextParams;

Name: attackingEntity

Gets the 'attacking_entity' param.

Returns: The 'attacking_entity' param.
Return Type: LootContextParam<Entity>

ZenScript
Copy
// LootContextParams.attackingEntity() as LootContextParam<Entity>

LootContextParams.attackingEntity();

Name: blockEntity

Gets the 'block_entity' param.

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

ZenScript
Copy
// LootContextParams.blockEntity() as LootContextParam<BlockEntity>

LootContextParams.blockEntity();

Name: blockState

Gets the 'block_state' param.

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

ZenScript
Copy
// LootContextParams.blockState() as LootContextParam<BlockState>

LootContextParams.blockState();

Name: damageSource

Gets the 'damage_source' param.

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

ZenScript
Copy
// LootContextParams.damageSource() as LootContextParam<DamageSource>

LootContextParams.damageSource();

Link to directAttackingEntity

Name: directAttackingEntity

Gets the 'direct_attacking_entity' param.

Returns: The 'direct_attacking_entity' param.
Return Type: LootContextParam<Entity>

ZenScript
Copy
// LootContextParams.directAttackingEntity() as LootContextParam<Entity>

LootContextParams.directAttackingEntity();

Name: explosionRadius

Gets the 'explosion_radius' param.

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

ZenScript
Copy
// LootContextParams.explosionRadius() as LootContextParam<float?>

LootContextParams.explosionRadius();

Name: getOrCreate

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>

ZenScript
Copy
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.

Link to lastDamagePlayer

Name: lastDamagePlayer

Gets the 'last_damage_player' parameter.

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

ZenScript
Copy
// LootContextParams.lastDamagePlayer() as LootContextParam<Player>

LootContextParams.lastDamagePlayer();

Name: origin

Gets the 'origin' param.

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

ZenScript
Copy
// LootContextParams.origin() as LootContextParam<Vec3>

LootContextParams.origin();

Name: thisEntity

Gets the 'this_entity' parameter.

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

ZenScript
Copy
// LootContextParams.thisEntity() as LootContextParam<Entity>

LootContextParams.thisEntity();

Name: tool

Gets the 'tool' param.

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

ZenScript
Copy
// LootContextParams.tool() as LootContextParam<ItemStack>

LootContextParams.tool();