Skip to content

Commit 0da1a5d

Browse files
authored
Add offhand slot to player inventory (#485)
1 parent e4791aa commit 0da1a5d

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

feather/generated/feather/inventory.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@
6262
"leggings": 1,
6363
"boots": 1,
6464
"storage": 27,
65-
"hotbar": 9
65+
"hotbar": 9,
66+
"offhand": 1
6667
},
6768
"chest": {
6869
"storage": 27

feather/generated/src/inventory.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,6 +1052,7 @@ pub enum InventoryBacking<T> {
10521052
boots: [T; 1],
10531053
storage: [T; 27],
10541054
hotbar: [T; 9],
1055+
offhand: [T; 1],
10551056
},
10561057
Chest {
10571058
storage: [T; 27],
@@ -1078,6 +1079,7 @@ impl<T> InventoryBacking<T> {
10781079
boots,
10791080
storage,
10801081
hotbar,
1082+
offhand,
10811083
} => match area {
10821084
Area::CraftingInput => Some(crafting_input.as_ref()),
10831085
Area::CraftingOutput => Some(crafting_output.as_ref()),
@@ -1087,6 +1089,7 @@ impl<T> InventoryBacking<T> {
10871089
Area::Boots => Some(boots.as_ref()),
10881090
Area::Storage => Some(storage.as_ref()),
10891091
Area::Hotbar => Some(hotbar.as_ref()),
1092+
Area::Offhand => Some(offhand.as_ref()),
10901093
_ => None,
10911094
},
10921095
InventoryBacking::Chest { storage } => match area {
@@ -1116,7 +1119,7 @@ impl<T> InventoryBacking<T> {
11161119
pub fn areas(&self) -> &'static [Area] {
11171120
match self {
11181121
InventoryBacking::Player { .. } => {
1119-
static AREAS: [Area; 8] = [
1122+
static AREAS: [Area; 9] = [
11201123
Area::CraftingInput,
11211124
Area::CraftingOutput,
11221125
Area::Helmet,
@@ -1125,6 +1128,7 @@ impl<T> InventoryBacking<T> {
11251128
Area::Boots,
11261129
Area::Storage,
11271130
Area::Hotbar,
1131+
Area::Offhand,
11281132
];
11291133
&AREAS
11301134
}
@@ -1159,6 +1163,7 @@ impl<T> InventoryBacking<T> {
11591163
boots: Default::default(),
11601164
storage: Default::default(),
11611165
hotbar: Default::default(),
1166+
offhand: Default::default(),
11621167
}
11631168
}
11641169
pub fn chest() -> Self

0 commit comments

Comments
 (0)