Basic crops system
This commit is contained in:
+3
-5
@@ -1,5 +1,6 @@
|
||||
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";
|
||||
|
||||
export function point_inside_rec(
|
||||
point_x: number,
|
||||
@@ -38,11 +39,8 @@ export function distance_point_point(ax: number, ay: number, az: number, bx: num
|
||||
}
|
||||
|
||||
export function register_block_item(block: BlockRegistry) {
|
||||
// TODO: handle block textures
|
||||
let texture_id = "engine:missing";
|
||||
if (typeof block.textures === "string") {
|
||||
texture_id = block.textures;
|
||||
}
|
||||
// cubes are drawn from the block's textures, anything else as a sprite
|
||||
const texture_id = block_item_texture(block) ?? cube_face_texture(block, "side");
|
||||
EverythingRegistry.register<ItemRegistry>("items", block.id, {
|
||||
texture_id,
|
||||
block_id: block.id,
|
||||
|
||||
Reference in New Issue
Block a user