azalea_inventory/item/
mod.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
pub trait MaxStackSizeExt {
    /// Get the maximum stack size for this item.
    ///
    /// This is a signed integer to be consistent with the `count` field of
    /// [`ItemSlotData`].
    ///
    /// [`ItemSlotData`]: crate::ItemSlotData
    fn max_stack_size(&self) -> i32;

    /// Whether this item can be stacked with other items.
    ///
    /// This is equivalent to `self.max_stack_size() > 1`.
    fn stackable(&self) -> bool {
        self.max_stack_size() > 1
    }
}

impl MaxStackSizeExt for azalea_registry::Item {
    fn max_stack_size(&self) -> i32 {
        // TODO: have the properties for every item defined somewhere
        64
    }
}