Water tweaks
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { block_value, chunk_key, default_block_value } from "$/common/utils.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { decode_level_chunk } from "$/common/chunk_streaming.ts";
|
||||
import { foliage_color, grass_color, water_color } from "$/common/worldgen/biome_colors.ts";
|
||||
import { DEFAULT_WATER_COLOR, foliage_color, grass_color, water_color } from "$/common/worldgen/biome_colors.ts";
|
||||
import {
|
||||
block_light_emission,
|
||||
block_light_opacity,
|
||||
@@ -323,6 +323,16 @@ export class ClientLevel {
|
||||
return block ? collision_shape_at(block, value) : true;
|
||||
}
|
||||
|
||||
// the biome's water color at a column as 0xRRGGBB, see "tint". plains' in unloaded chunks
|
||||
water_color(x: number, z: number) {
|
||||
const chunk_x = Math.floor(x / CHUNK_SIZE);
|
||||
const chunk_z = Math.floor(z / CHUNK_SIZE);
|
||||
const chunk = this.get_chunk(chunk_x, chunk_z);
|
||||
if (!chunk) return DEFAULT_WATER_COLOR;
|
||||
return chunk
|
||||
.biome_colors[CHUNK_AREA * 2 + (z - chunk_z * CHUNK_SIZE) * CHUNK_SIZE + (x - chunk_x * CHUNK_SIZE)];
|
||||
}
|
||||
|
||||
// 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