PrismarineJS / mineflayer

Create Minecraft bots with a powerful, stable, and high level JavaScript API.
https://prismarinejs.github.io/mineflayer/
MIT License
4.96k stars 906 forks source link

How do I drop an item from a specific slot? #1292

Closed ghost closed 4 years ago

ghost commented 4 years ago

Versions

Clear question

What method can be used to drop an item from a specific slot?

What did you try yet?

I used the method bot.clickWindow(3, 0, 4) but it was giving an error

Your current code

Please put here any custom code you tried yet.


if (message == 'drop') {
bot.clickWindow(3, 0 ,4)

Additional context

Add any other context about the problem here.

Karang commented 4 years ago

Why do you want it to be in a specific slot ? You have the toss method that drop an item based on its id: https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#bottossitemtype-metadata-count-callback

ghost commented 4 years ago

Why do you want it to be in a specific slot ? You have the toss method that drop an item based on its id: https://github.com/PrismarineJS/mineflayer/blob/master/docs/api.md#bottossitemtype-metadata-count-callback

It's just that in this case it's more convenient for me on the slot. I just can't find out the ID, because the VKontakte bot won't be able to display it

Karang commented 4 years ago

I don't know what a VKontakte bot is, so I'm not able to help you with that. For tossing a specific slot, look at how toss() is implemented in mineflayer.