Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export interface BotEvents {
bossBarUpdated: (bossBar: BossBar) => Promise<void> | void
resourcePack: (url: string, hash?: string, uuid?: string) => Promise<void> | void
particle: (particle: Particle) => Promise<void> | void
heldItemChanged: (newItem: Item | null) => Promise<void> | void
abilities: (abilities: Abilities) => Promise<void> | void
}

Expand Down
7 changes: 6 additions & 1 deletion lib/plugins/inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ function inject (bot, { hideErrors }) {
}
const window = bot.currentWindow || bot.inventory

assert.ok(mode >= 0 && mode <= 4)
assert.ok(mode >= 0 && mode <= 6)
const actionId = createActionNumber()

const click = {
Expand Down Expand Up @@ -728,6 +728,11 @@ function inject (bot, { hideErrors }) {
const newItem = Item.fromNotch(packet.item)
bot._setSlot(packet.slot, newItem, window)
})
bot.inventory.on('updateSlot', (index) => {
if (index === bot.quickBarSlot + bot.inventory.hotbarStart) {
bot.emit('heldItemChanged')
}
})
bot._client.on('window_items', (packet) => {
const window = packet.windowId === 0 ? bot.inventory : bot.currentWindow
if (!window || window.id !== packet.windowId) {
Expand Down
Loading