PrismarineJS / mineflayer

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

bot.clickWindow promise never gets resolved #2476

Closed Oreoezi closed 2 years ago

Oreoezi commented 2 years ago

Versions

Detailed description of a problem

await bot.clickWindow hangs. Possibly hypixel sends incorrect packets.

Your current code

await bot.clickWindow(33, 0, 0);
await bot.clickWindow(31, 0, 0);

Expected behavior

Slots 33 and 31 getting clicked and the script continuing as normal.

Additional context

Without awaiting you are clicking too fast allowing only the first one to register so I had to make a promise

await new Promise((res,rej) => setTimeout(res, 500));

which would be inconsistent on a laggy connection.

autowert66 commented 2 years ago

This is perhaps because a server plugin does not send the chest-confirmation. Take a look at this example.

Oreoezi commented 2 years ago

Thank you