fix: use window_id 0 for "no container"

This commit is contained in:
əlemi 2022-07-03 00:27:29 +02:00
parent 363eeea3aa
commit d8c62e57d2
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -36,14 +36,14 @@ class GameContainer(Scaffold):
)
)
self.window_transaction_id = 0
self.window_id = -1
self.window_id = 0
self.window_title = ""
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.window_transaction_id = 0
self.window_id = -1
self.window_id = 0
self.window_title = ""
self.window_inventory_type = ""
self.window_entity_id = None
@ -52,7 +52,7 @@ class GameContainer(Scaffold):
@self.on(DisconnectedEvent)
async def disconnected_cb(_):
self.window_transaction_id = 0
self.window_id = -1
self.window_id = 0
self.window_title = ""
@self.on_packet(PacketOpenWindow)
@ -65,5 +65,5 @@ class GameContainer(Scaffold):
@self.on_packet(PacketSetSlot)
async def on_set_slot(packet:PacketSetSlot):
if packet.windowId == self.window_id:
if self.window_id > 0 and packet.windowId == self.window_id:
self.window_inventory[packet.slot] = packet.item