PrismarineJS / mineflayer

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

entityMoved marks arrows on the ground as moving #1479

Open ghost opened 3 years ago

ghost commented 3 years ago

Versions

Detailed description of a problem

i am trying to make the bot look at an arrow if it is moving (in air), however the event 'entityMoved' for some reason counts arrows on the ground as moving entities.

What did you try yet?

i tried doing physicsTick and looking for nearby entities but it counts arrows on the ground too

Your current code

bot.on('entityMoved', (entity) => {
    if (entity.name === 'arrow') {
        bot.lookAt(entity.position);
    }
});

Expected behavior

entityMoved should not count arrows on the ground as moving.

Additional context

none

Karang commented 3 years ago

You will face an other problem: the arrows (and all projectiles) should be simulated client side, but are currently not simulated by mineflayer.

So the only 'entityMoved' you'll receive is when the arrow is spawned and when it reach something. Everything in between should be simulated.

TheDudeFromCI commented 3 years ago

(Also worth noting that when tracking fast-moving entities, it's usually better to use bot.lookAt(pos, true) since this will force the look packet to be sent instantly. Otherwise, the bot look has a smoothing effect applied to it.)

ghost commented 3 years ago

that i am aware of, though it seems to crash my bot for no apparent reason.