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.

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;
名称类型可获得可设置描述
名称
blockState
类型
MCBlockState?
可获得
true
可设置
false
描述
Gets the block state that was broken, if present; null otherwise.
名称
damageSource
类型
DamageSource?
可获得
true
可设置
false
描述
Gets the damage source that caused the death of the current entity, if present; null otherwise.
名称
directKillerEntity
类型
MCEntity?
可获得
true
可设置
false
描述
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>.
名称
explosionRadius
类型
浮点数
可获得
true
可设置
false
描述
Gets the explosion radius that caused the death of the entity or the destruction of the block, if present; 0.0 <br /> otherwise.
名称
killerEntity
类型
MCEntity?
可获得
true
可设置
false
描述
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>.
名称
lastDamagePlayer
类型
MCPlayerEntity?
可获得
true
可设置
false
描述
Gets the last player that damaged the current entity, if present; null otherwise.
名称
lootTableId
类型
MCResourceLocation
可获得
true
可设置
false
描述
Gets the loot table id of the current one being rolled, if available; a place-holder otherwise.
名称
lootingModifier
类型
int
可获得
true
可设置
false
描述
Gets the looting modifier, calculated based on the current parameters.
名称
luck
类型
浮点数
可获得
true
可设置
false
描述
Gets the luck factor of the player, as computed by the current parameters.
名称
origin
类型
MCVector3d?
可获得
true
可设置
false
描述
Gets the origin, or location, of the loot roll, if present; null otherwise.
名称
random
类型
Random
可获得
true
可设置
false
描述
Gets the random generator used in loot table rolling
名称
thisEntity
类型
MCEntity?
可获得
true
可设置
false
描述
Gets the current entity, if present; null otherwise.
名称
tileEntity
类型
MCTileEntity?
可获得
true
可设置
false
描述
Gets the block entity that was present at the location of the broken block, if present; null otherwise.
名称
tool
类型
IItemStack
可获得
true
可设置
false
描述
Gets the tool that was used to break the block or perform additional behavior, if present; an empty stack <br /> otherwise.
名称
world
类型
MCServerWorld
可获得
true
可设置
false
描述
Gets the world where the interaction happened.