Water phyisics
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user