diff options
Diffstat (limited to 'azalea-inventory/src/item')
| -rw-r--r-- | azalea-inventory/src/item/mod.rs | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/azalea-inventory/src/item/mod.rs b/azalea-inventory/src/item/mod.rs new file mode 100644 index 00000000..07e51363 --- /dev/null +++ b/azalea-inventory/src/item/mod.rs @@ -0,0 +1,21 @@ +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`]. + fn max_stack_size(&self) -> i8; + + /// 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) -> i8 { + // TODO: have the properties for every item defined somewhere + 64 + } +} |
