Effect icons and tooltip !

This commit is contained in:
2026-10-02 13:16:50 -03:00
parent e560cb3928
commit f749f6be79
22 changed files with 131 additions and 19 deletions
+4
View File
@@ -85,6 +85,9 @@ export class LocalPlayer extends Player {
food = 20;
saturation = 5;
air = 20;
// the effects it has that show an icon, see the inventory screen. counted down here, the server only says when
// they change
effects: { id: string; amplifier: number; duration: number }[] = [];
// the attack speed attribute the server sent, and when they last attacked or switched slots, for the indicator
attack_speed = 4;
last_attack = -Infinity;
@@ -119,6 +122,7 @@ export class LocalPlayer extends Player {
}
tick() {
for (const effect of this.effects) if (effect.duration > 0) effect.duration -= 1;
this.#in_water = this.in_water;
const was_swimming = this.swimming;
const input = this.client.screen ? NO_INPUT : this.#read_input();