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
+20 -20
View File
@@ -160,20 +160,20 @@ export interface BlockRegistry {
// draws the item a server script gives it (ServerWorld.set_block_item) on top of it, like farmer's delight's
// cutting board. surface is the height in pixels it lies on. turned with the variant's y
item_display?: { surface: number };
// a liquid like water, drawn like luanti's: its top slopes down towards where it flows. see LiquidProperties
liquid?: LiquidProperties;
// the liquid it can hold, like minecraft's waterlogged fences. it gets a "waterlogged" state, see WATERLOGGED
// a fluid like water, drawn like luanti's: its top slopes down towards where it flows. see FluidProperties
fluid?: FluidProperties;
// the fluid it can hold, like minecraft's waterlogged fences. it gets a "waterlogged" state, see WATERLOGGED
waterloggable?: string;
// it can only be placed into a source of that liquid, so it's always placed holding it, like farmer's delight's rice
// it can only be placed into a source of that fluid, so it's always placed holding it, like farmer's delight's rice
waterlogged_only?: boolean;
compiled_states?: CompiledStateDefinition[];
}
// a liquid's "level" state is 0 for a source, the full block, and 1 to range as it flows away from one, each lower,
// like minecraft's. liquids get that state without listing it. their textures are one texture, or { still, flowing }:
// a fluid's "level" state is 0 for a source, the full block, and 1 to range as it flows away from one, each lower,
// like minecraft's. fluids get that state without listing it. their textures are one texture, or { still, flowing }:
// still on the top and bottom, flowing on the sides, like luanti's special tiles
export interface LiquidProperties {
export interface FluidProperties {
// how many blocks it flows from a source, 1 to 7, like luanti's liquid_range
range: number;
// ticks between each step it flows, like minecraft's 5 for water and 30 for lava
@@ -183,28 +183,28 @@ export interface LiquidProperties {
renewable: boolean;
}
export const LIQUID_LEVEL: BlockStateDefinition = { name: "level", bits: 3, default: 0 };
// a waterloggable block's state, 1 while it holds a source of its liquid. blocks get it without listing it, after
export const FLUID_LEVEL: BlockStateDefinition = { name: "level", bits: 3, default: 0 };
// a waterloggable block's state, 1 while it holds a source of its fluid. blocks get it without listing it, after
// their own states
export const WATERLOGGED: BlockStateDefinition = { name: "waterlogged", bits: 1, default: 0 };
export const MAX_LIQUID_RANGE = 7;
// what a liquid that doesn't say has
export const LIQUID_DEFAULTS: LiquidProperties = { range: MAX_LIQUID_RANGE, ticks: 5, renewable: true };
export const MAX_FLUID_RANGE = 7;
// what a fluid that doesn't say has
export const FLUID_DEFAULTS: FluidProperties = { range: MAX_FLUID_RANGE, ticks: 5, renewable: true };
// what entities swim in, and where falling doesn't hurt
export function is_liquid_block(block: BlockRegistry | undefined): boolean {
return block?.liquid !== undefined;
export function is_fluid_block(block: BlockRegistry | undefined): boolean {
return block?.fluid !== undefined;
}
// a liquid's textures as the top, bottom and sides of a cube, for its item and its particles
export function liquid_textures(textures: BlockTextures): { still: string; flowing: string } {
// a fluid's textures as the top, bottom and sides of a cube, for its item and its particles
export function fluid_textures(textures: BlockTextures): { still: string; flowing: string } {
if (typeof textures === "string") return { still: textures, flowing: textures };
const still = textures.still ?? "engine:missing";
return { still, flowing: textures.flowing ?? still };
}
// how high a liquid's surface is in a block of it at this level, 0 to 1, like luanti's flowing levels
export function liquid_height(level: number, range: number) {
// how high a fluid's surface is in a block of it at this level, 0 to 1, like luanti's flowing levels
export function fluid_height(level: number, range: number) {
if (level === 0) return 1;
return (range - Math.min(level, range) + 0.5) / range;
}
@@ -264,9 +264,9 @@ export interface ItemRegistry<T = unknown | undefined> {
lore?: string;
food?: FoodProperties;
worn?: WornProperties;
// whether players holding it aim at liquids, like buckets and fishing rods. others look through them, so they can
// whether players holding it aim at fluids, like buckets and fishing rods. others look through them, so they can
// break and place blocks under water
targets_liquids?: boolean;
targets_fluids?: boolean;
components?: Record<string, unknown>;
on_create?(item: ItemStack<T>): void;