Fluid registry

This commit is contained in:
2026-10-25 14:05:57 -03:00
parent 0cfa4d9b4a
commit 17d83acfc8
18 changed files with 144 additions and 17 deletions
+9 -2
View File
@@ -11,6 +11,7 @@ import {
EffectJson,
EntityJson,
EntityModelJson,
FluidJson,
grid_recipe_from_json,
GridRecipe,
is_mod_recipe,
@@ -45,6 +46,8 @@ export interface ModData {
entity_models: EntityModelJson[];
// status effects, see EffectJson
effects: EffectJson[];
// kinds of fluid, see FluidJson
fluids: FluidJson[];
// tag files, see common/tags.ts
tags: TagJson[];
// see common/loot.ts. missing from mods packed before there were loot tables
@@ -103,8 +106,9 @@ export function is_registered(registry: TagRegistry, id: string): boolean {
return (registry === "blocks" && id === "bworld:air") || EverythingRegistry.get(registry, id) !== undefined;
}
// registers every mod's blocks, items, entities, effects, tags and recipes, in the order given (dependencies first). tags load
// once every mod's content has, since a tag can hold anything, and recipes after them, since they can use tags
// registers every mod's blocks, items, entities, effects, fluids, tags and recipes, in the order given (dependencies
// first). tags load once every mod's content has, since a tag can hold anything, and recipes after them, since they can
// use tags
export function register_mod_data(mods: { id: string; data: ModData }[]): RecipeBook {
const recipes = new RecipeBook();
@@ -147,6 +151,9 @@ export function register_mod_data(mods: { id: string; data: ModData }[]): Recipe
for (const json of data.effects) {
EverythingRegistry.register<EffectJson>("effects", json.id, json);
}
for (const json of data.fluids) {
EverythingRegistry.register<FluidJson>("fluids", json.id, json);
}
for (const json of data.loot_tables ?? []) {
EverythingRegistry.register<LootTableJson>("loot_tables", json.id, json);
}