Better block models !
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
import { TICKS_PER_SECOND } from "$/common/constants.ts";
|
||||
import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import type { ItemStack } from "$/common/inventory.ts";
|
||||
import type { Shape } from "$/common/block_shapes.ts";
|
||||
import { type Collisions, eyes_in_water, in_water, move_body } from "$/common/physics.ts";
|
||||
import type { EntityData, EntityEvent, EntityInfo } from "$/common/protocol.ts";
|
||||
import type { ServerPlayer } from "../player.ts";
|
||||
@@ -62,6 +63,8 @@ export function damage_source(cause: string): DamageSource {
|
||||
export interface EntityLevel {
|
||||
readonly current_tick: number;
|
||||
has_collision(x: number, y: number, z: number): boolean;
|
||||
// what it bumps into at a block, see common/physics.ts
|
||||
collision_shape(x: number, y: number, z: number): boolean | Shape;
|
||||
// water, and other blocks you're in instead of on
|
||||
is_liquid(x: number, y: number, z: number): boolean;
|
||||
get_block_info(x: number, y: number, z: number): BlockRegistry | undefined;
|
||||
@@ -254,7 +257,7 @@ export abstract class Entity {
|
||||
|
||||
// falls and moves by its velocity for one tick (see move_body), and counts how far it fell. returns what it hit
|
||||
move(): Collisions {
|
||||
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 from_y = this.y;
|
||||
const collisions = move_body(
|
||||
this,
|
||||
|
||||
Reference in New Issue
Block a user