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 fn conditions(&self) -> &'static [LootCondition]
pub fn conditions(&self) -> &'static [LootCondition]
Get the conditions for this entry.
Sourcepub fn functions(&self) -> &'static [ConditionalLootFunction]
pub 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