Crafting and chest

This commit is contained in:
2026-03-10 19:53:15 -03:00
parent 9e2b2bcb42
commit e9da307841
11 changed files with 234 additions and 21 deletions
+3 -7
View File
@@ -3,18 +3,14 @@ import { Tile } from "../client/components/dimension.ts";
import { ItemStack } from "../client/inventory.ts";
export class EverythingRegistry {
static #registries = new Map<string, Map<string, unknown>>();
static add_registry(name: string) {
this.#registries.set(name, new Map());
}
static #registries = new Map<string, unknown>();
static register<T>(registry_name: string, key: string, value: T) {
this.#registries.get(registry_name)?.set(key, value);
this.#registries.set(`${registry_name}__${key}`, value);
}
static get<T>(registry_name: string, key: string): T {
return this.#registries.get(registry_name)?.get(key) as T;
return this.#registries.get(`${registry_name}__${key}`) as T;
}
}