Add inventory controls and enhance dashboard

This commit is contained in:
Tanner
2026-11-05 03:00:13 +00:00
parent efa2140a91
commit 659fa49ea1
13 changed files with 979 additions and 36 deletions
+12
View File
@@ -471,6 +471,7 @@ class InventoryManager:
self.g.inv = slots
self.g.inventory_partial = packet.partial
self.g.cursor = self.to_slot(packet.carried_item)
self._sync_held_item()
elif (self.g.get('window') and
packet.container_id == self.g.window.window_id):
self.g.window.contents = slots
@@ -488,6 +489,9 @@ class InventoryManager:
if packet.container_id == 0:
self.g.inv[packet.slot] = item
self.g.item_lock = False
if (self.g.get('holding_hand', 0) == 0 and
packet.slot == 36 + self.g.get('holding_slot', 0)):
self.g.holding = item.item_id if item.present else 0
elif packet.container_id == -1 and packet.slot == -1:
self.g.cursor = item
elif (self.g.get('window') and
@@ -501,6 +505,14 @@ class InventoryManager:
self.g.inv[36 + offset - 27] = item
self.g.item_lock = False
def _sync_held_item(self):
if self.g.get('holding_hand', 0) != 0:
return
hotbar_slot = int(self.g.get('holding_slot', 0) or 0)
item = self.g.inv.get(36 + hotbar_slot)
self.g.holding = (item.item_id if item and
getattr(item, 'present', False) else 0)
def handle_cursor(self, packet):
if packet.item.components_unknown:
self.g.inventory_partial = True