diff --git a/lib/plugins/inventory.js b/lib/plugins/inventory.js index b532b95c2..b36a418c7 100644 --- a/lib/plugins/inventory.js +++ b/lib/plugins/inventory.js @@ -43,8 +43,12 @@ function inject (bot, { hideErrors }) { bot.quickBarSlot = null bot.inventory = windows.createWindow(0, 'minecraft:inventory', 'Inventory') bot.currentWindow = null - bot.heldItem = null bot.usingHeldItem = false + Object.defineProperty(o, 'heldItem', { + get: function () { + return bot.inventory.slots[bot.QUICK_BAR_START + bot.quickBarSlot] + }, + }) bot._client.on('entity_status', (packet) => { if (packet.entityId === bot.entity.id && packet.entityStatus === 9 && !eatingTask.done) { @@ -364,9 +368,7 @@ function inject (bot, { hideErrors }) { } function updateHeldItem () { - bot.heldItem = bot.inventory.slots[bot.QUICK_BAR_START + bot.quickBarSlot] - bot.entity.heldItem = bot.heldItem - bot.emit('heldItemChanged', bot.entity.heldItem) + bot.emit('heldItemChanged', bot.heldItem) } function closeWindow (window) {