aboutsummaryrefslogtreecommitdiff
path: root/azalea-inventory/src
diff options
context:
space:
mode:
Diffstat (limited to 'azalea-inventory/src')
-rw-r--r--azalea-inventory/src/slot.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs
index 814b6c37..c4f8da05 100644
--- a/azalea-inventory/src/slot.rs
+++ b/azalea-inventory/src/slot.rs
@@ -71,6 +71,14 @@ impl ItemSlot {
}
}
}
+
+ /// Convert this slot into an [`ItemSlotData`], if it's present.
+ pub fn as_present(&self) -> Option<&ItemSlotData> {
+ match self {
+ ItemSlot::Empty => None,
+ ItemSlot::Present(i) => Some(i),
+ }
+ }
}
/// An item in an inventory, with a count and NBT. Usually you want [`ItemSlot`]