Entity movement

This commit is contained in:
2026-11-21 13:23:12 -03:00
parent dd53613758
commit 0f58a9cbfe
4 changed files with 96 additions and 2 deletions
+3 -1
View File
@@ -72,6 +72,8 @@ export abstract class LivingEntity extends Entity {
// minecraft's per tick movement speed, see travel
speed = 0;
jumping = false;
// whether jumping lifts it off the ground. one that doesn't still steps up its step height and swims up in water
jumps = true;
#jump_delay = 0;
// the attributes this kind has and their base values, like minecraft's default attribute suppliers. kinds add
@@ -188,7 +190,7 @@ export abstract class LivingEntity extends Entity {
if (this.jumping) {
if (this.in_water) {
this.vy += SWIM_UP * TICKS_PER_SECOND;
} else if (this.on_ground && this.#jump_delay === 0) {
} else if (this.jumps && this.on_ground && this.#jump_delay === 0) {
this.jump_from_ground();
this.#jump_delay = JUMP_DELAY;
}