Water phyisics
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { block_value, chunk_key, default_block_value } from "$/common/utils.ts";
|
||||
import { block_value, chunk_key, default_block_value, liquid_in_cell } from "$/common/utils.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { decode_level_chunk } from "$/common/chunk_streaming.ts";
|
||||
import { DEFAULT_WATER_COLOR, foliage_color, grass_color, water_color } from "$/common/worldgen/biome_colors.ts";
|
||||
@@ -333,6 +333,13 @@ export class ClientLevel {
|
||||
.biome_colors[CHUNK_AREA * 2 + (z - chunk_z * CHUNK_SIZE) * CHUNK_SIZE + (x - chunk_x * CHUNK_SIZE)];
|
||||
}
|
||||
|
||||
// the liquid there and how high it is, for liquids pushing things along. unloaded chunks have none
|
||||
liquid_at(x: number, y: number, z: number) {
|
||||
const value = this.get_block_value(x, y, z);
|
||||
const nid = value & ID_MASK;
|
||||
return nid === VOID || nid === AIR ? undefined : liquid_in_cell(value, this.#blocks[nid]);
|
||||
}
|
||||
|
||||
// water, see is_liquid_block. unloaded chunks aren't
|
||||
is_liquid(x: number, y: number, z: number) {
|
||||
const block = this.get_block(x, y, z);
|
||||
|
||||
Reference in New Issue
Block a user