PrismarineJS / mineflayer

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

How to use enderearl in mineflayer #3227

Open Maaz4f opened 10 months ago

Maaz4f commented 10 months ago

I tried this code async function useEnderPearl() { // Check if the bot has an ender pearl const enderPearl = bot.inventory .items() .find((item) => item.name === "ender_pearl");

if (enderPearl) {
  // Equip and use the ender pearl
  bot.equip(enderPearl, "hand", () => {
    bot.activateItem();

    bot.lookAt(bot.position.add(bot.direction));
    setTimeout(() => {
      bot.activateItem();
    }, 500);
  });
}

} useEnderPearl(); The bot picks the pearl in hand but it does not use it

sefirosweb commented 5 months ago

Maybe need yo add "bot.swingArm('left')"

https://github.com/sefirosweb/minecraftHawkEye/blob/ef7d092683a5a5235d836baae83c75d9dc2efb36/src/hawkEye.ts#L110-L112