Struct LootContext
#[non_exhaustive]pub struct LootContext {
pub entity: Option<LootEntity>,
pub damage: Option<LootDamage>,
pub player: Option<LootEntity>,
pub tool: Option<LootTool>,
pub block: Option<String>,
pub luck: f32,
pub biome: Option<String>,
pub seed: i64,
pub place: Option<LootPlace>,
}Expand description
An owned view of the parameters supplied to a mod’s loot kind. The game fills it only when that kind has subscribed listeners.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.entity: Option<LootEntity>Entity named by the table, if any.
damage: Option<LootDamage>Killing damage, if any.
player: Option<LootEntity>Player whose kill produced this roll, if any.
tool: Option<LootTool>Tool used for the roll, if any.
block: Option<String>Block identifier for a block-drop roll.
luck: f32Luck applied to this roll.
biome: Option<String>Biome identifier, when available.
seed: i64Seed drawn by the engine only when the mod’s kind participates.
place: Option<LootPlace>Origin, block entity and level facts at the moment of the roll.
Implementations§
§impl LootContext
impl LootContext
pub fn new(seed: i64) -> LootContext
pub fn new(seed: i64) -> LootContext
An empty roll context with its captured random seed.
Trait Implementations§
§impl Clone for LootContext
impl Clone for LootContext
§fn clone(&self) -> LootContext
fn clone(&self) -> LootContext
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read more§impl Debug for LootContext
impl Debug for LootContext
§impl PartialEq for LootContext
impl PartialEq for LootContext
impl StructuralPartialEq for LootContext
Auto Trait Implementations§
impl Freeze for LootContext
impl RefUnwindSafe for LootContext
impl Send for LootContext
impl Sync for LootContext
impl Unpin for LootContext
impl UnsafeUnpin for LootContext
impl UnwindSafe for LootContext
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more