Skip to content

Commit 472a72d

Browse files
Update inventory.js
1 parent ef8fc45 commit 472a72d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

lib/plugins/inventory.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -726,6 +726,11 @@ function inject (bot, { hideErrors }) {
726726
const window = packet.windowId === 0 ? bot.inventory : bot.currentWindow
727727
if (!window || window.id !== packet.windowId) return
728728
const newItem = Item.fromNotch(packet.item)
729+
// very hacky solution. if the server doesnt send the slots in the proper order, then the window will still never emit 'windowOpen'
730+
if (bot.currentWindow && packet.slot === bot.currentWindow.slots.length - 1) {
731+
// window is probably ready
732+
bot.emit(`setWindowItems:${window.id}`)
733+
}
729734
bot._setSlot(packet.slot, newItem, window)
730735
})
731736
bot._client.on('window_items', (packet) => {

0 commit comments

Comments
 (0)