fix: use window_id 0 for "no container"
This commit is contained in:
parent
363eeea3aa
commit
d8c62e57d2
1 changed files with 4 additions and 4 deletions
|
@ -36,14 +36,14 @@ class GameContainer(Scaffold):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.window_transaction_id = 0
|
self.window_transaction_id = 0
|
||||||
self.window_id = -1
|
self.window_id = 0
|
||||||
self.window_title = ""
|
self.window_title = ""
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
super().__init__(*args, **kwargs)
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
self.window_transaction_id = 0
|
self.window_transaction_id = 0
|
||||||
self.window_id = -1
|
self.window_id = 0
|
||||||
self.window_title = ""
|
self.window_title = ""
|
||||||
self.window_inventory_type = ""
|
self.window_inventory_type = ""
|
||||||
self.window_entity_id = None
|
self.window_entity_id = None
|
||||||
|
@ -52,7 +52,7 @@ class GameContainer(Scaffold):
|
||||||
@self.on(DisconnectedEvent)
|
@self.on(DisconnectedEvent)
|
||||||
async def disconnected_cb(_):
|
async def disconnected_cb(_):
|
||||||
self.window_transaction_id = 0
|
self.window_transaction_id = 0
|
||||||
self.window_id = -1
|
self.window_id = 0
|
||||||
self.window_title = ""
|
self.window_title = ""
|
||||||
|
|
||||||
@self.on_packet(PacketOpenWindow)
|
@self.on_packet(PacketOpenWindow)
|
||||||
|
@ -65,5 +65,5 @@ class GameContainer(Scaffold):
|
||||||
|
|
||||||
@self.on_packet(PacketSetSlot)
|
@self.on_packet(PacketSetSlot)
|
||||||
async def on_set_slot(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
|
self.window_inventory[packet.slot] = packet.item
|
||||||
|
|
Loading…
Reference in a new issue