Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EntityHurt is not working at 1.20.0 #3501

Closed
ErneTalu opened this issue Nov 10, 2024 · 5 comments
Closed

EntityHurt is not working at 1.20.0 #3501

ErneTalu opened this issue Nov 10, 2024 · 5 comments
Labels
contribution-wanted Stage3 idea is precisely specified, only coding is left to do

Comments

@ErneTalu
Copy link

Im using lastest version of Mineflayer and Minecraft 1.20.0. I tried everything but bot.on("entityHurt" is not working. I dont know the other versions but in 1.20.0 with Mineflayer it isnt working. The other entity actions are working but entityHurt is not

@ErneTalu ErneTalu added possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Nov 10, 2024
@rom1504
Copy link
Member

rom1504 commented Nov 10, 2024 via email

@u9g
Copy link
Member

u9g commented Nov 11, 2024

We store entity_status's in mineflayer itself as a map

const entityStatusEvents = {
2: 'entityHurt',
3: 'entityDead',
6: 'entityTaming',
7: 'entityTamed',
8: 'entityShakingOffWater',
10: 'entityEatingGrass',
55: 'entityHandSwap'
}

this is no longer how entity_hurts are received by the client, it is now it's own packet (hurt_animation) which needs to make the same event. PR's welcome :D

@u9g u9g added Stage3 idea is precisely specified, only coding is left to do contribution-wanted and removed possible bug Stage1 just created by someone new to the project, we don't know yet if it deserves an implementation / a f labels Nov 11, 2024
@Pix3lPirat3
Copy link

Related issue #3184

@miles-igd
Copy link

I'm testing the "hurt_animation" and it seems to only fire when the bot itself gets hurt. It doesn't trigger when a different mob gets hit, which is what I think entityHurt was used for.

Should "damage_event" packet which has the entityId in it, be used instead?

I tested this in 1.20 and 1.21.1 and it should behave the same.

bot._client.on('damage_event', (packet) => {
    const entity = bot.entities[packet.entityId];
    bot.emit('entityHurt', entity);
})

@ErneTalu
Copy link
Author

ErneTalu commented Nov 13, 2024

I'm testing the "hurt_animation" and it seems to only fire when the bot itself gets hurt. It doesn't trigger when a different mob gets hit, which is what I think entityHurt was used for.

Should "damage_event" packet which has the entityId in it, be used instead?

I tested this in 1.20 and 1.21.1 and it should behave the same.

bot._client.on('damage_event', (packet) => {
    const entity = bot.entities[packet.entityId];
    bot.emit('entityHurt', entity);
})

Thanks, Im closing issue nothing to do left. I think we should wait for new entityHurt Push or use damage_event

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution-wanted Stage3 idea is precisely specified, only coding is left to do
Projects
None yet
Development

No branches or pull requests

5 participants