Holds all information that may be obtainable from a loot table roll, allowing for identifying key information.

Not all parameters are present at all times, for obvious reasons. For example, information related to an entity will not be available if the loot table being rolled is the one for a block.

Importare la Classe

Link to importare-la-classe

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.LootContext;
NomeTipoHa GetterHa SetterDescrizione
Nome
blockState
Tipo
MCBlockState?
Ha Getter
Ha Setter
no
Descrizione
Gets the block state that was broken, if present; null otherwise.
Nome
damageSource
Tipo
DamageSource?
Ha Getter
Ha Setter
no
Descrizione
Gets the damage source that caused the death of the current entity, if present; null otherwise.
Nome
directKillerEntity
Tipo
MCEntity?
Ha Getter
Ha Setter
no
Descrizione
Gets the entity that effectively killed the current entity, if present; null otherwise.

The difference between this and killerEntity resides on the direct-ness of the entity. For example,
if a player kills a skeleton with an arrow, the player will be the killerEntity, while the arrow
will be the directKillerEntity.
Nome
explosionRadius
Tipo
float
Ha Getter
Ha Setter
no
Descrizione
Gets the explosion radius that caused the death of the entity or the destruction of the block, if present; 0.0
otherwise.
Nome
killerEntity
Tipo
MCEntity?
Ha Getter
Ha Setter
no
Descrizione
Gets the entity that caused the death of the current entity, if present; null otherwise.

The entity may or may not be a player. To get only the player, refer to lastDamagePlayer.
Nome
lastDamagePlayer
Tipo
MCPlayerEntity?
Ha Getter
Ha Setter
no
Descrizione
Gets the last player that damaged the current entity, if present; null otherwise.
Nome
lootTableId
Tipo
MCResourceLocation
Ha Getter
Ha Setter
no
Descrizione
Gets the loot table id of the current one being rolled, if available; a place-holder otherwise.
Nome
lootingModifier
Tipo
int
Ha Getter
Ha Setter
no
Descrizione
Gets the looting modifier, calculated based on the current parameters.
Nome
luck
Tipo
float
Ha Getter
Ha Setter
no
Descrizione
Gets the luck factor of the player, as computed by the current parameters.
Nome
origin
Tipo
MCVector3d?
Ha Getter
Ha Setter
no
Descrizione
Gets the origin, or location, of the loot roll, if present; null otherwise.
Nome
random
Tipo
Random
Ha Getter
Ha Setter
no
Descrizione
Gets the random generator used in loot table rolling
Nome
thisEntity
Tipo
MCEntity?
Ha Getter
Ha Setter
no
Descrizione
Gets the current entity, if present; null otherwise.
Nome
tileEntity
Tipo
MCTileEntity?
Ha Getter
Ha Setter
no
Descrizione
Gets the block entity that was present at the location of the broken block, if present; null otherwise.
Nome
tool
Tipo
IItemStack
Ha Getter
Ha Setter
no
Descrizione
Gets the tool that was used to break the block or perform additional behavior, if present; an empty stack
otherwise.
Nome
world
Tipo
MCServerWorld
Ha Getter
Ha Setter
no
Descrizione
Gets the world where the interaction happened.