1
0
mirror of https://github.com/p2r3/bareiron.git synced 2025-10-02 07:35:08 +02:00

fix taking damage when attacking players

This commit is contained in:
p2r3
2025-08-23 02:17:02 +03:00
parent f9bd73d1eb
commit d0dfa01d9d

View File

@@ -576,7 +576,7 @@ void hurtEntity (int entity_id, int attacker_id, uint8_t damage_type, uint8_t da
entity_died = true; entity_died = true;
} else player->health -= damage; } else player->health -= damage;
// Update health on the client // Update health on the client
sc_setHealth(player->client_fd, player->health, player->hunger); sc_setHealth(entity_id, player->health, player->hunger);
} else { // The attacked entity is a mob } else { // The attacked entity is a mob
MobData *mob = &mob_data[entity_id - 65536]; MobData *mob = &mob_data[entity_id - 65536];
uint8_t mob_health = mob->data & 31; uint8_t mob_health = mob->data & 31;