Make players mobs too !

This commit is contained in:
2026-09-30 10:42:52 -03:00
parent 65f27d6099
commit 4fbcca6851
23 changed files with 314 additions and 132 deletions
+16
View File
@@ -331,6 +331,22 @@ export abstract class LivingEntity extends Entity {
this.health -= post_mitigation;
}
// back to full health with nothing left over from before: no effects, fire, hurt cooldown or who hurt it. for
// players respawning, minecraft makes them a new entity instead
revive() {
this.clear_effects();
this.health = this.max_health;
this.fire = 0;
this.air = this.max_air;
this.fall_distance = 0;
this.vx = this.vy = this.vz = 0;
this.hurt_time = this.death_time = 0;
this.#hurt_cooldown = 0;
this.#last_hurt_amount = 0;
this.last_hurt_by_mob = this.last_hurt_by_player = undefined;
this.ticks_since_last_hurt_by_mob = this.last_hurt_by_player_memory_time = 0;
}
// it was just hurt, for kinds that react
on_hurt(_source: DamageSource) {}