Waterlogging
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import { AIR, CHUNK_HEIGHT, ID_MASK } from "$/common/constants.ts";
|
||||
import type { BlockRegistry } from "$/common/everything_registry.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
import { get_state_value, set_state_value } from "$/common/utils.ts";
|
||||
import { get_state_value, liquid_block, set_state_value } from "$/common/utils.ts";
|
||||
|
||||
// what the flow needs of the world
|
||||
export interface LiquidWorld {
|
||||
@@ -154,8 +154,10 @@ export class LiquidFlow {
|
||||
if (value === undefined) return undefined;
|
||||
const nid = value & ID_MASK;
|
||||
const block = this.#world.block(nid);
|
||||
if (!block?.liquid) return undefined;
|
||||
return { nid, block, level: get_state_value(value, block, "level")! };
|
||||
if (block?.liquid) return { nid, block, level: get_state_value(value, block, "level")! };
|
||||
// a waterlogged block is a source of its liquid that never flows away, like minecraft's
|
||||
const liquid = liquid_block(value, block);
|
||||
return liquid && { nid: this.#world.nid(liquid.id), block: liquid, level: 0 };
|
||||
}
|
||||
|
||||
#set(block: BlockRegistry, x: number, y: number, z: number, level: number) {
|
||||
|
||||
Reference in New Issue
Block a user