Closed plexigras closed 7 years ago
well, is there something on slot 36 ?
No, that handles the case when you're holding an item https://github.com/PrismarineJS/mineflayer/blob/master/lib/plugins/inventory.js#L491
ah well, maybe it would handle it
@plexigras are you waiting for the callback ?
yes
I mean, what you put in the first post of the issue is your whole code ?
no i'm trying out my book implementation https://gist.github.com/a21fe04c58aeca16447edb9ff872c3cd
but i'm gonna give the code above a try
oh wait somehow this works:
bot.once('login', () => console.log('loged in'))
bot._client.once('window_items', () => {
console.log('got items');
print();
var [ book ] = bot.inventory.items().filter(({ name }) => name === 'writable_book')
var slot = book.slot;
assert.ok(bot.inventory.slots[slot], `no item in slot ${slot}`)
bot.moveSlotItem(slot, 36, (err) => {
console.log('err:',err);
print();
})
});
function print() {
var books = bot.inventory.items().filter(({ name }) => name === 'writable_book')
console.log('books:',books.length);
console.log('slots:',books.map(book => book.slot));
}
returns an error
at line 467 of inventory.js