Rename all "liquid" mentions to "fluid"

This commit is contained in:
2026-10-25 13:54:53 -03:00
parent bcca8fa4a5
commit 0cfa4d9b4a
58 changed files with 547 additions and 548 deletions
+18 -18
View File
@@ -5,9 +5,9 @@ import {
block_value,
chunk_key,
default_block_value,
fluid_block,
fluid_in_cell,
is_waterlogged,
liquid_block,
liquid_in_cell,
} from "$/common/utils.ts";
import { AIR_ID } from "$/common/protocol.ts";
import { decode_level_chunk } from "$/common/chunk_streaming.ts";
@@ -17,7 +17,7 @@ import {
block_light_opacity,
BlockRegistry,
EverythingRegistry,
is_liquid_block,
is_fluid_block,
RENDER_LAYERS,
RenderLayer,
} from "$/common/everything_registry.ts";
@@ -376,18 +376,18 @@ 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) {
// the fluid there and how high it is, for fluids pushing things along. unloaded chunks have none
fluid_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]);
return nid === VOID || nid === AIR ? undefined : fluid_in_cell(value, this.#blocks[nid]);
}
// water, or a block waterlogged with it, see liquid_block. unloaded chunks aren't
is_liquid(x: number, y: number, z: number) {
// water, or a block waterlogged with it, see fluid_block. unloaded chunks aren't
is_fluid(x: number, y: number, z: number) {
const value = this.get_block_value(x, y, z);
const block = value & ID_MASK;
return block !== VOID && block !== AIR && liquid_block(value, this.#blocks[block]) !== undefined;
return block !== VOID && block !== AIR && fluid_block(value, this.#blocks[block]) !== undefined;
}
// only changes what this client shows, drops and everything else happen on the server
@@ -409,13 +409,13 @@ export class ClientLevel {
const old_value = chunk.blocks[index];
const old_nid = old_value & ID_MASK;
const old_block = this.#blocks[old_nid];
// a waterlogged block leaves its liquid, like the server's destroy_block
const liquid = is_waterlogged(old_value, old_block)
// a waterlogged block leaves its fluid, like the server's destroy_block
const fluid = is_waterlogged(old_value, old_block)
? EverythingRegistry.get_id("blocks", old_block!.waterloggable!) ?? AIR
: AIR;
chunk.blocks[index] = liquid;
chunk.blocks[index] = fluid;
this.#mark_dirty(chunk);
this.#mark_neighbors_dirty(block_chunk_x, block_chunk_z, lx, lz, old_nid, liquid);
this.#mark_neighbors_dirty(block_chunk_x, block_chunk_z, lx, lz, old_nid, fluid);
}
// a block that lets through or gives off a different amount of light changes the light up to 15 blocks
@@ -774,7 +774,7 @@ export class ClientLevel {
// the first block along the view of something at x/y/z looking at yaw/pitch, like minecraft's pick. it has to go
// into one of the block's boxes (see common/block_shapes.ts), so it looks past the empty half of a slab. it looks
// through liquids unless liquids is set, see ItemRegistry.targets_liquids
// through fluids unless fluids is set, see ItemRegistry.targets_fluids
pick(
x: number,
y: number,
@@ -782,7 +782,7 @@ export class ClientLevel {
yaw: number,
pitch: number,
max_distance = 6,
liquids = false,
fluids = false,
step = 0.05,
): BlockHitResult | undefined {
const cos_pitch = Math.cos(pitch);
@@ -812,11 +812,11 @@ export class ClientLevel {
continue;
}
const info = this.#blocks[block];
if (!liquids && is_liquid_block(info)) {
if (!fluids && is_fluid_block(info)) {
continue;
}
// aimed at liquids, the source in a waterlogged block covers it, like the server's raycast_shape
const covered = liquids && is_waterlogged(value, info);
// aimed at fluids, the source in a waterlogged block covers it, like the server's raycast_shape
const covered = fluids && is_waterlogged(value, info);
const hit = clip_shape(
!info || covered ? FULL_SHAPE : shape_at(info, value),
bx,