pub enum LootEntry {
Item {
name: Identifier,
weight: i32,
quality: i32,
conditions: &'static [LootCondition],
functions: &'static [ConditionalLootFunction],
},
LootTableRef {
name: Identifier,
weight: i32,
quality: i32,
conditions: &'static [LootCondition],
functions: &'static [ConditionalLootFunction],
},
InlineLootTable {
pools: &'static [LootPool],
weight: i32,
quality: i32,
conditions: &'static [LootCondition],
functions: &'static [ConditionalLootFunction],
},
Tag {
name: Identifier,
expand: bool,
weight: i32,
quality: i32,
conditions: &'static [LootCondition],
functions: &'static [ConditionalLootFunction],
},
Alternatives {
children: &'static [LootEntry],
conditions: &'static [LootCondition],
},
Group {
children: &'static [LootEntry],
conditions: &'static [LootCondition],
},
Sequence {
children: &'static [LootEntry],
conditions: &'static [LootCondition],
},
Empty {
weight: i32,
conditions: &'static [LootCondition],
},
Dynamic {
name: Identifier,
conditions: &'static [LootCondition],
},
Slots {
slots: SlotRange,
conditions: &'static [LootCondition],
functions: &'static [ConditionalLootFunction],
},
}Expand description
A loot table entry that can generate items.
Variants§
Item
Drop a specific item.
Fields
§
name: Identifier§
conditions: &'static [LootCondition]§
functions: &'static [ConditionalLootFunction]LootTableRef
Reference another loot table by name.
Fields
§
name: Identifier§
conditions: &'static [LootCondition]§
functions: &'static [ConditionalLootFunction]InlineLootTable
Inline loot table (embedded pools directly in entry).
Tag
Drop items from a tag.
Fields
§
name: Identifier§
conditions: &'static [LootCondition]§
functions: &'static [ConditionalLootFunction]Alternatives
Try children in order, use first that matches.
Group
Use all children.
Sequence
Use children in sequence until one fails.
Empty
Empty entry (no drop).
Dynamic
Dynamic content (e.g., block entity contents).
Slots
Select items from specific block entity slots.
Implementations§
Source§impl LootEntry
impl LootEntry
Sourcepub fn effective_weight(&self, luck: f32) -> i32
pub fn effective_weight(&self, luck: f32) -> i32
Get the effective weight adjusted for luck. Formula: max(floor(weight + quality * luck), 0)
Sourcepub const fn conditions(&self) -> &'static [LootCondition]
pub const fn conditions(&self) -> &'static [LootCondition]
Get the conditions for this entry.
Sourcepub const fn functions(&self) -> &'static [ConditionalLootFunction]
pub const fn functions(&self) -> &'static [ConditionalLootFunction]
Get the functions for this entry.
Source§impl LootEntry
impl LootEntry
Sourcefn create_items<R: Rng>(
&self,
ctx: &mut LootContext<'_, R>,
result: &mut Vec<ItemStack>,
)
fn create_items<R: Rng>( &self, ctx: &mut LootContext<'_, R>, result: &mut Vec<ItemStack>, )
Create items from this entry and add them to the result.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LootEntry
impl RefUnwindSafe for LootEntry
impl Send for LootEntry
impl Sync for LootEntry
impl Unpin for LootEntry
impl UnsafeUnpin for LootEntry
impl UnwindSafe for LootEntry
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>