diff options
| author | mat <github@matdoes.dev> | 2023-05-04 20:38:10 +0000 |
|---|---|---|
| committer | mat <github@matdoes.dev> | 2023-05-04 20:38:10 +0000 |
| commit | c7a923ccc8ae825deca62ac2cc8c80c01484d5b6 (patch) | |
| tree | 787c6eb579d0b126f0e9dfa161bdea758fe9aa0a /azalea-inventory/src/item | |
| parent | ff6d43458cef8ac6a23e6e8accd4b71c2a04aef6 (diff) | |
| parent | 634cb8d72c6608512aedba19e5cd669104bc35ea (diff) | |
| download | azalea-drasl-c7a923ccc8ae825deca62ac2cc8c80c01484d5b6.tar.xz | |
merge main
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 + } +} |
