pub struct CraftingInput {
pub width: usize,
pub height: usize,
pub items: Vec<ItemStack>,
ingredient_count: usize,
}Expand description
Represents the current state of a crafting grid.
This should be a positioned (trimmed) input - containing only the
bounding box of non-empty items. Use CraftingInput::positioned() to
create one from raw grid slots.
Fields§
§width: usize§height: usize§items: Vec<ItemStack>Items in row-major order (width * height).
ingredient_count: usizePre-computed count of non-empty items.
Implementations§
Source§impl CraftingInput
impl CraftingInput
Sourcepub const EMPTY: CraftingInput
pub const EMPTY: CraftingInput
An empty crafting input.
Sourcepub fn new(width: usize, height: usize, items: Vec<ItemStack>) -> Self
pub fn new(width: usize, height: usize, items: Vec<ItemStack>) -> Self
Creates a new crafting input, pre-computing ingredient count.
Sourcepub fn positioned(
width: usize,
height: usize,
items: Vec<ItemStack>,
) -> PositionedCraftingInput
pub fn positioned( width: usize, height: usize, items: Vec<ItemStack>, ) -> PositionedCraftingInput
Creates a positioned (trimmed) crafting input from raw grid slots.
This is the main entry point matching Java’s CraftingInput.ofPositioned().
Returns the trimmed input along with the offset from the original grid.
Sourcepub fn ingredient_count(&self) -> usize
pub fn ingredient_count(&self) -> usize
Returns the number of non-empty items (pre-computed).
Trait Implementations§
Source§impl Clone for CraftingInput
impl Clone for CraftingInput
Source§fn clone(&self) -> CraftingInput
fn clone(&self) -> CraftingInput
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 CraftingInput
impl RefUnwindSafe for CraftingInput
impl Send for CraftingInput
impl Sync for CraftingInput
impl Unpin for CraftingInput
impl UnsafeUnpin for CraftingInput
impl UnwindSafe for CraftingInput
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