Water phyisics

This commit is contained in:
2026-10-07 19:38:27 -03:00
parent d101fa2ef3
commit 78117f65c9
13 changed files with 338 additions and 13 deletions
+6
View File
@@ -4,6 +4,7 @@
import { CHUNK_SIZE } from "$/common/constants.ts";
import { is_within_view } from "$/common/chunk_streaming.ts";
import { is_liquid_block } from "$/common/everything_registry.ts";
import { liquid_in_cell } from "$/common/utils.ts";
import type { ItemStack } from "$/common/inventory.ts";
import type { EntityEvent, EntityInfo, ServerMessage } from "$/common/protocol.ts";
import type { ServerPlayer } from "../player.ts";
@@ -101,6 +102,11 @@ export class EntityManager implements EntityLevel {
return this.#host.world.get_block_info(x, y, z);
}
liquid_at(x: number, y: number, z: number) {
const world = this.#host.world;
return liquid_in_cell(world.get_block_value(x, y, z), world.get_block_info(x, y, z));
}
nearest_player(x: number, y: number, z: number, max_distance: number): ServerPlayer | undefined {
let nearest: ServerPlayer | undefined;
let nearest_distance = max_distance;