pub struct InventoryDef {
pub id: String,
pub slot_count: usize,
pub layout: Vec<SlotLayout>,
pub include_player_inventory: bool,
pub player_inv_offset: (f32, f32),
pub background_texture: Option<String>,
pub title: String,
}Expand description
Describes one inventory-backed screen: how many slots a mod block has, where they sit, whether the player’s own inventory is appended below, and which background texture to draw (vanilla default, or a mod’s own).
Fields§
§id: String§slot_count: usize§layout: Vec<SlotLayout>§include_player_inventory: bool§player_inv_offset: (f32, f32)§background_texture: Option<String>§title: StringImplementations§
Source§impl InventoryDef
impl InventoryDef
pub fn new(id: impl Into<String>, slot_count: usize) -> InventoryDef
Sourcepub fn layout(self, layout: Vec<SlotLayout>) -> InventoryDef
pub fn layout(self, layout: Vec<SlotLayout>) -> InventoryDef
Explicit per-slot pixel positions, overriding the default grid.
Sourcepub fn include_player_inventory(self, v: bool) -> InventoryDef
pub fn include_player_inventory(self, v: bool) -> InventoryDef
Whether the player’s main inventory + hotbar (no armor/offhand) is appended below the custom slots.
pub fn player_inv_offset(self, x: f32, y: f32) -> InventoryDef
Sourcepub fn background_texture(self, path: impl Into<String>) -> InventoryDef
pub fn background_texture(self, path: impl Into<String>) -> InventoryDef
Custom background texture (resource path); None keeps the default
vanilla-style panel.
pub fn title(self, title: impl Into<String>) -> InventoryDef
Trait Implementations§
Source§impl Clone for InventoryDef
impl Clone for InventoryDef
Source§fn clone(&self) -> InventoryDef
fn clone(&self) -> InventoryDef
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 moreAuto Trait Implementations§
impl Freeze for InventoryDef
impl RefUnwindSafe for InventoryDef
impl Send for InventoryDef
impl Sync for InventoryDef
impl Unpin for InventoryDef
impl UnsafeUnpin for InventoryDef
impl UnwindSafe for InventoryDef
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