Replies: 1 comment
-
We could represent different types of Inventories as different structs. But because we can't query for traits (or can we?), we should probably use an enum. this also looks interesting |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I saw
inventory_v2
on the roadmap and my interest was picked up and equipped as armor.So we probably want an easy API for container inventories (like chests), player inventories (which can also contain equipment slots and a 2x2 crafting grid + result).
I'm a bit unsure on valence's direction and if we would like to make it more low level, like some sort of as it is now where we get a low level
ClickSlotEvent
and need to get the useed inventory via the OpenInventory component or if we want something more abstract and simpler where we would get a InventoryId which we then can use to query the inventory and have multiple types for slots likeHotbar(0..=9)
andEquipment::Legs
rather than raw u16. This would also help make the code more readable because the slot id is often offset with other variables because for example we need to convert the hotbar to a slot, clipping the players inventory to only the main slots (used when showing a "split" inventory window) or having to index slots in the other half of the "split" window.Would we rather choose the low level or abstract approach?
Beta Was this translation helpful? Give feedback.
All reactions