fix: slots + 1

This commit is contained in:
əlemi 2022-07-03 01:57:36 +02:00
parent 312f132c50
commit f6ee4b0d79
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -17,7 +17,7 @@ class GameContainer(Scaffold):
window_inventory_type : str window_inventory_type : str
window_entity_id : Optional[int] window_entity_id : Optional[int]
window_transaction_id : int window_transaction_id : int
window_inventory : List[Item] window_inventory : List[Optional[Item]]
@property @property
def is_container_open(self) -> bool: def is_container_open(self) -> bool:
@ -57,11 +57,12 @@ class GameContainer(Scaffold):
@self.on_packet(PacketOpenWindow) @self.on_packet(PacketOpenWindow)
async def on_player_open_window(packet:PacketOpenWindow): async def on_player_open_window(packet:PacketOpenWindow):
assert isinstance(packet.inventoryType, str)
self.window_id = packet.windowId self.window_id = packet.windowId
self.window_title = packet.windowTitle self.window_title = packet.windowTitle
self.window_inventory_type = packet.inventoryType self.window_inventory_type = packet.inventoryType
self.window_entity_id = packet.entityId self.window_entity_id = packet.entityId if packet.inventoryType == "EntityHorse" and hasattr(packet, "entityId") else None
self.window_inventory = [None] * packet.slotCount self.window_inventory = [None] * (packet.slotCount + 1)
@self.on_packet(PacketSetSlot) @self.on_packet(PacketSetSlot)
async def on_set_slot(packet:PacketSetSlot): async def on_set_slot(packet:PacketSetSlot):