ctx.blocks.solid(id) api
This commit is contained in:
+7
-1
@@ -10,7 +10,7 @@ import { ModListing, ModLoadError, RecipeBook, register_mod_data } from "$/commo
|
||||
import { type Bmod, read_bmod } from "$/common/bmod.ts";
|
||||
import { display_name, get_state_value, set_state_value } from "$/common/utils.ts";
|
||||
import { BlockRules } from "$/common/block_rules.ts";
|
||||
import { covers_face, EMPTY_SHAPE, FULL_SHAPE } from "$/common/block_shapes.ts";
|
||||
import { covers_face, EMPTY_SHAPE, FULL_SHAPE, is_solid } from "$/common/block_shapes.ts";
|
||||
import type { SharedContext, SharedWorld } from "$/common/mod_api/shared.ts";
|
||||
import { tag_api } from "$/common/tags.ts";
|
||||
import { AIR_ID } from "$/common/protocol.ts";
|
||||
@@ -205,6 +205,12 @@ function blocks_api(mod: string): SharedContext["blocks"] {
|
||||
if (!block) throw new Error(`[${mod}] unknown block ${id}`);
|
||||
return structuredClone(block.components ?? {});
|
||||
},
|
||||
solid(id) {
|
||||
if (id === AIR_ID) return false;
|
||||
const block = EverythingRegistry.get<BlockRegistry>("blocks", id);
|
||||
if (!block) throw new Error(`[${mod}] unknown block ${id}`);
|
||||
return is_solid(block);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user