Skip to content
Open
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
10 changes: 7 additions & 3 deletions lib/plugins/inventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,10 @@ function inject (bot, { hideErrors }) {
return changedSlots
}

// 1.21.5+ clicks claim slot contents by hash; the server resends any slot
// whose claim doesn't match its own state.
const toClickNotch = bot.registry.protocol.types.HashedSlot ? Item.toHashedNotch : Item.toNotch

async function clickWindow (slot, mouseButton, mode) {
// if you click on the quick bar and have dug recently,
// wait a bit
Expand Down Expand Up @@ -600,7 +604,7 @@ function inject (bot, { hideErrors }) {
changedSlots = changedSlots.map(slot => {
return {
location: slot,
item: Item.toNotch(window.slots[slot])
item: toClickNotch(window.slots[slot])
}
})
}
Expand All @@ -614,7 +618,7 @@ function inject (bot, { hideErrors }) {
mouseButton,
mode,
changedSlots,
cursorItem: Item.toNotch(window.selectedItem)
cursorItem: toClickNotch(window.selectedItem)
})
} else if (bot.supportFeature('actionIdUsed')) { // <= 1.16.5
bot._client.write('window_click', {
Expand Down Expand Up @@ -834,7 +838,7 @@ function inject (bot, { hideErrors }) {
mouseButton: 2, // end of a drag that never started
mode: 5,
changedSlots: [],
cursorItem: Item.toNotch(window.selectedItem)
cursorItem: toClickNotch(window.selectedItem)
})
await synced
}
Expand Down
Loading