LootContextParams

Importing the class

If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.

script.zs
import crafttweaker.api.loot.param.LootContextParams;

Description

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

You can also create your own using getOrCreate

Members

static blockEntity() as LootContextParam<BlockEntity>
Gets the 'block_entity' param.

Returns: The 'block_entity' param.

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

Return Type: LootContextParam<BlockEntity>

static blockState() as LootContextParam<BlockState>
Gets the 'block_state' param.

Returns: The 'block_state' param.

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

Return Type: LootContextParam<BlockState>

static damageSource() as LootContextParam<DamageSource>
Gets the 'damage_source' param.

Returns: The 'damage_source' param.

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

Return Type: LootContextParam<DamageSource>

static directKillerEntity() as LootContextParam<Entity>
Gets the 'direct_killer_entity' param.

Returns: The 'direct_killer_entity' param.

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

Return Type: LootContextParam<Entity>

static explosionRadius() as LootContextParam<Float>
Gets the 'explosion_radius' param.

Returns: The 'explosion_radius' param.

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

Return Type: LootContextParam<Float>

static getOrCreate(name as ResourceLocation) as LootContextParam<T>
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.

script.zs
// LootContextParams.getOrCreate<T>(name as ResourceLocation) as LootContextParam<T>;
LootContextParams.getOrCreate<T>("height");

Parameters:

name Type: ResourceLocation - The name of the parameter.

Return Type: LootContextParam<T>

static killerEntity() as LootContextParam<Entity>
Gets the 'killer_entity' param.

Returns: The 'killer_entity' param.

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

Return Type: LootContextParam<Entity>

static lastDamagePlayer() as LootContextParam<Player>
Gets the 'last_damage_player' parameter.

Returns: The 'last_damage_player' parameter.

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

Return Type: LootContextParam<Player>

static origin() as LootContextParam<Vec3>
Gets the 'origin' param.

Returns: The 'origin' param.

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

Return Type: LootContextParam<Vec3>

static thisEntity() as LootContextParam<Entity>
Gets the 'this_entity' parameter.

Returns: The 'this_entity' parameter.

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

Return Type: LootContextParam<Entity>

static tool() as LootContextParam<ItemStack>
Gets the 'tool' param.

Returns: The 'tool' param.

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

Return Type: LootContextParam<ItemStack>