Better block models !

This commit is contained in:
2026-10-03 15:57:47 -03:00
parent ecc0295f6d
commit 24fe7cdede
23 changed files with 678 additions and 122 deletions
+1 -1
View File
@@ -127,7 +127,7 @@ export abstract class Entity {
// falls and moves by its velocity for one tick (see move_body), then slows down from drag and friction
move() {
const is_solid = (x: number, y: number, z: number) => this.level.has_collision(x, y, z);
const is_solid = (x: number, y: number, z: number) => this.level.collision_shape(x, y, z);
const can_step = this.#air_ticks <= this.step_grace_ticks && this.vy <= 0;
const friction = this.horizontal_friction();
const collisions = move_body(this, this.gravity, is_solid, this.step_height, can_step);
+3 -3
View File
@@ -157,7 +157,7 @@ export class LocalPlayer extends Player {
const was_on_ground = this.on_ground;
// not while jumping, so it can still jump off a ledge
if (this.sneaking && this.on_ground && this.vy <= 0) {
const is_solid = (x: number, y: number, z: number) => this.level.has_collision(x, y, z);
const is_solid = (x: number, y: number, z: number) => this.level.collision_shape(x, y, z);
const [dx, dz] = back_off_from_edge(
this,
this.vx * TICK_DELTA,
@@ -195,7 +195,7 @@ export class LocalPlayer extends Player {
vy: 0,
vz: 0,
};
if (box_is_free(standing, 0, 0, 0, (x, y, z) => this.level.has_collision(x, y, z))) this.set_swimming(false);
if (box_is_free(standing, 0, 0, 0, (x, y, z) => this.level.collision_shape(x, y, z))) this.set_swimming(false);
}
// turns up or down toward where it's looking. not up once its head is out, so it swims along the surface instead
@@ -232,7 +232,7 @@ export class LocalPlayer extends Player {
#hop_out_of_water(from_y: number) {
if (!this.colliding_x && !this.colliding_z) return;
const blocked = (x: number, y: number, z: number) =>
this.level.has_collision(x, y, z) || this.level.is_liquid(x, y, z);
this.level.is_liquid(x, y, z) || this.level.collision_shape(x, y, z);
const dy = from_y - this.y + this.vy * TICK_DELTA + WATER_HOP_HEIGHT;
if (box_is_free(this, this.vx * TICK_DELTA, dy, this.vz * TICK_DELTA, blocked)) this.vy = WATER_HOP;
}