World shape for dimension

This commit is contained in:
2026-11-06 22:49:43 -03:00
parent 7458a2d42a
commit 818ce22dd6
60 changed files with 749 additions and 349 deletions
+3 -3
View File
@@ -4,14 +4,15 @@
// fluids flowing, like minecraft's FlowingFluid: a change next to a fluid gets the cells around it looked at again
// after the fluid's ticks, and each works out what it should be from its neighbors (see next_level). that changes
// more cells, and so it spreads one block a step, and drains away the same way once its source is gone
import { AIR, CHUNK_HEIGHT, ID_MASK } from "@/common/constants.ts";
import { AIR, ID_MASK } from "@/common/constants.ts";
import type { BlockRegistry } from "@/common/everything_registry.ts";
import { AIR_ID } from "@/common/protocol.ts";
import { fluid_block, get_state_value, set_state_value } from "@/common/utils.ts";
// what the flow needs of the world
export interface FluidWorld {
// undefined where the chunk isn't loaded, so fluid stops at the edge of the world instead of making new chunks
// undefined where the chunk isn't loaded and above and below the world, so fluid stops at the edge of the world
// instead of making new chunks
value_at(x: number, y: number, z: number): number | undefined;
// by numeric id
block(nid: number): BlockRegistry | undefined;
@@ -152,7 +153,6 @@ export class FluidFlow {
}
#fluid(x: number, y: number, z: number): Fluid | undefined {
if (y < 0 || y >= CHUNK_HEIGHT) return undefined;
const value = this.#world.value_at(x, y, z);
if (value === undefined) return undefined;
const nid = value & ID_MASK;