Struct LootDrops
#[non_exhaustive]pub struct LootDrops<'a> {
pub table: &'a str,
pub dimension: &'a str,
pub origin: [f64; 3],
pub block: Option<([i32; 3], BlockState)>,
pub entity: Option<(u32, &'a str)>,
pub player: Option<u128>,
pub damage_source: Option<HurtSource<'a>>,
pub tool: Option<&'a ItemStack>,
pub explosion: Option<f32>,
pub used: bool,
}Expand description
What dropped the items heard by the loot_drops hook.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.table: &'a strThe block’s or mob’s own loot table (minecraft:blocks/stone, minecraft:entities/zombie);
empty when none rolled: the block or mob has none, the mob_drops rule is off, a baby
animal. A mob’s drops may hold more: a charged creeper’s head, a fox’s mouth item.
dimension: &'a strThe level they drop in (minecraft:overworld).
origin: [f64; 3]LootContextParams.ORIGIN: a broken block’s centre, a mob’s position.
block: Option<([i32; 3], BlockState)>The block broken: its position and state.
entity: Option<(u32, &'a str)>The mob that died, or the entity a player’s use dropped them from (the
sheep sheared, the item frame broken): its entity ID and type
(minecraft:zombie).
player: Option<u128>The player who broke the block or killed the mob, when known. A mob names one only while it remembers the player’s hit (100 ticks), so one that dies to lava long after names none.
damage_source: Option<HurtSource<'a>>LootContextParams.DAMAGE_SOURCE of this death invocation. None for
non-death drops. Environmental deaths have a source but no causing entity.
causing and direct are the attacking and direct attacking entity IDs;
0 means absent or unknown, as on the other damage hooks.
tool: Option<&'a ItemStack>The breaking or using tool (LootContextParams.TOOL). Always None for
entity deaths. For the attacker’s live hand, resolve damage_source.causing
through host.entity, then host.living, and read living.hand_item(host, Hand::Main).
This reads when called, including changes made by earlier loot listeners.
explosion: Option<f32>The radius of the explosion that broke the block.
used: boolA player’s use dropped them rather than a break or a death: shears on a
sheep, a mooshroom, a snow golem or a bogged, a brush on an armadillo or
a suspicious block, shears carving a pumpkin, picking sweet berries or
cave vines, a hit taking an item frame or its item, or untying a lead
or cutting it with shears. player names them, or is None when a
dispenser’s shears sheared a mooshroom; block or entity says what
dropped them. A mob that a player killed while
leashed drops its lead on its next tick as a call of its own (entity
the mob, player its killer, table empty, used false).