Implement tags !

This commit is contained in:
2026-09-30 13:41:29 -03:00
parent dc70ada7c4
commit 342b45d593
51 changed files with 978 additions and 219 deletions
+3 -2
View File
@@ -2,6 +2,7 @@ import { ID_MASK, STATE_SHIFT } from "./constants.ts";
import { BlockRegistry, EverythingRegistry, ItemRegistry } from "./everything_registry.ts";
import { block_item_texture, cube_face_texture } from "./block_models.ts";
import type { ItemStack } from "./inventory.ts";
import { list_matches } from "./tags.ts";
export function point_inside_rec(
point_x: number,
@@ -134,7 +135,7 @@ function compile_block_states(block_info: BlockRegistry) {
// whether a block can be at a spot with below under it, see place_on
export function can_stand_on(block: BlockRegistry | undefined, below: string): boolean {
return !block?.place_on || block.place_on.includes(below);
return !block?.place_on || list_matches("blocks", block.place_on, below);
}
// where a block placed by clicking a face of another goes: into the clicked block when it can be replaced (like water),
@@ -158,7 +159,7 @@ export function can_place(
if (!block) return false;
const into = current?.id ?? "bworld:air";
const replaceable = !current || current.replaceable === true;
const in_ok = block.place_in ? block.place_in.includes(into) : replaceable;
const in_ok = block.place_in ? list_matches("blocks", block.place_in, into) : replaceable;
return in_ok && can_stand_on(block, below);
}