Messy but working chicken
This commit is contained in:
+11
-1
@@ -4,6 +4,8 @@ import {
|
||||
block_from_json,
|
||||
BlockJson,
|
||||
choice_ids,
|
||||
EntityJson,
|
||||
EntityModelJson,
|
||||
grid_recipe_from_json,
|
||||
GridRecipe,
|
||||
is_mod_recipe,
|
||||
@@ -24,6 +26,8 @@ export interface ModData {
|
||||
items: ItemJson[];
|
||||
recipes: RecipeJson[];
|
||||
ores: OreJson[];
|
||||
entities: EntityJson[];
|
||||
entity_models: EntityModelJson[];
|
||||
}
|
||||
|
||||
// a mod as the server lists it to clients, in load order: the .bmod players download, without its server script
|
||||
@@ -57,7 +61,7 @@ export class ModLoadError extends Error {
|
||||
}
|
||||
}
|
||||
|
||||
// registers every mod's blocks, items and recipes, in the order given (dependencies first)
|
||||
// registers every mod's blocks, items, entities and recipes, in the order given (dependencies first)
|
||||
export function register_mod_data(mods: { id: string; data: ModData }[]): RecipeBook {
|
||||
const recipes = new RecipeBook();
|
||||
|
||||
@@ -79,6 +83,12 @@ export function register_mod_data(mods: { id: string; data: ModData }[]): Recipe
|
||||
for (const json of data.items) {
|
||||
EverythingRegistry.register<ItemRegistry>("items", json.id, item_from_json(json));
|
||||
}
|
||||
for (const model of data.entity_models) {
|
||||
EverythingRegistry.register<EntityModelJson>("entity_models", model.id, model);
|
||||
}
|
||||
for (const json of data.entities) {
|
||||
EverythingRegistry.register<EntityJson>("entities", json.id, json);
|
||||
}
|
||||
} catch (e) {
|
||||
fail((e as Error).message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user