Giant chesplate
This commit is contained in:
@@ -104,6 +104,12 @@ export abstract class LivingEntity extends Entity {
|
||||
this.#health = Math.min(this.max_health, Math.max(0, value));
|
||||
}
|
||||
|
||||
// health from a save. it can be over max_health until the next tick, so max_health modifiers given back while
|
||||
// loading, like worn curios', keep it
|
||||
load_health(value: number) {
|
||||
this.#health = Math.max(0, value);
|
||||
}
|
||||
|
||||
get dead() {
|
||||
return this.#health <= 0;
|
||||
}
|
||||
@@ -439,6 +445,8 @@ export abstract class LivingEntity extends Entity {
|
||||
}
|
||||
|
||||
tick_effects() {
|
||||
// like minecraft, losing max health, like a max_health modifier going away, takes the health over it
|
||||
if (this.#health > this.max_health) this.#health = this.max_health;
|
||||
for (const effect of [...this.effects.values()]) {
|
||||
if (this.effects.get(effect.type.id) !== effect) continue;
|
||||
const result = effect.tick(this);
|
||||
|
||||
Reference in New Issue
Block a user