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.

Diese Klasse importieren

Link to diese-klasse-importieren

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;
NameTypeHas GetterHas SetterBeschreibung
Name
blockState
Type
MCBlockState?
Has Getter
true
Has Setter
false
Beschreibung
Gets the block state that was broken, if present; null otherwise.
Name
damageSource
Type
DamageSource?
Has Getter
true
Has Setter
false
Beschreibung
Gets the damage source that caused the death of the current entity, if present; null otherwise.
Name
directKillerEntity
Type
MCEntity?
Has Getter
true
Has Setter
false
Beschreibung
Gets the entity that effectively killed the current entity, if present; null otherwise. <br /> <br /> The difference between this and <code>killerEntity</code> resides on the direct-ness of the entity. For example, <br /> if a player kills a skeleton with an arrow, the player will be the <code>killerEntity</code>, while the arrow <br /> will be the <code>directKillerEntity</code>.
Name
explosionRadius
Type
float
Has Getter
true
Has Setter
false
Beschreibung
Gets the explosion radius that caused the death of the entity or the destruction of the block, if present; 0.0 <br /> otherwise.
Name
killerEntity
Type
MCEntity?
Has Getter
true
Has Setter
false
Beschreibung
Gets the entity that caused the death of the current entity, if present; null otherwise. <br /> <br /> The entity may or may not be a player. To get only the player, refer to <code>lastDamagePlayer</code>.
Name
lastDamagePlayer
Type
MCPlayerEntity?
Has Getter
true
Has Setter
false
Beschreibung
Gets the last player that damaged the current entity, if present; null otherwise.
Name
lootTableId
Type
MCResource-Standort
Has Getter
true
Has Setter
false
Beschreibung
Gets the loot table id of the current one being rolled, if available; a place-holder otherwise.
Name
lootingModifier
Type
int
Has Getter
true
Has Setter
false
Beschreibung
Gets the looting modifier, calculated based on the current parameters.
Name
luck
Type
float
Has Getter
true
Has Setter
false
Beschreibung
Gets the luck factor of the player, as computed by the current parameters.
Name
origin
Type
MCVector3d?
Has Getter
true
Has Setter
false
Beschreibung
Gets the origin, or location, of the loot roll, if present; null otherwise.
Name
random
Type
Random
Has Getter
true
Has Setter
false
Beschreibung
Gets the random generator used in loot table rolling
Name
thisEntity
Type
MCEntity?
Has Getter
true
Has Setter
false
Beschreibung
Gets the current entity, if present; null otherwise.
Name
tileEntity
Type
MCTileEntity?
Has Getter
true
Has Setter
false
Beschreibung
Gets the block entity that was present at the location of the broken block, if present; null otherwise.
Name
tool
Type
IItemStack
Has Getter
true
Has Setter
false
Beschreibung
Gets the tool that was used to break the block or perform additional behavior, if present; an empty stack <br /> otherwise.
Name
world
Type
MCServerWorld
Has Getter
true
Has Setter
false
Beschreibung
Gets the world where the interaction happened.