fix: inventory didn't update after dropping an item

This commit is contained in:
Vitaly Turovsky 2024-07-16 10:35:01 +03:00
commit b49e988090

View file

@ -353,7 +353,7 @@ contro.on('trigger', ({ command }) => {
document.exitPointerLock?.()
openPlayerInventory()
break
case 'general.drop':
case 'general.drop': {
// if (bot.heldItem/* && ctrl */) bot.tossStack(bot.heldItem)
bot._client.write('block_dig', {
'status': 4,
@ -365,7 +365,14 @@ contro.on('trigger', ({ command }) => {
'face': 0,
sequence: 0
})
const slot = bot.inventory.hotbarStart + bot.quickBarSlot
const item = bot.inventory.slots[slot]
if (item) {
item.count--
bot.inventory.updateSlot(slot, item.count > 0 ? item : null!)
}
break
}
case 'general.chat':
showModal({ reactType: 'chat' })
break