Skip to content

Add JSON game content

GDCraft loads several kinds of game content from assets/data/minecraft/. Use these files for supported definitions so related content stays together and can be inspected without navigating registration code. The C# loaders still own parsing, validation, and runtime behavior.

Create a JSON file under assets/data/minecraft/recipe/. A shaped recipe can use item IDs and loaded tags as ingredients:

{
"type": "minecraft:crafting_shaped",
"key": {
"#": "minecraft:stick",
"X": "#minecraft:stone_tool_materials"
},
"pattern": ["XXX", " # ", " # "],
"result": { "id": "minecraft:stone_pickaxe" }
}

RecipeLoader also handles shapeless crafting, cooking, stonecutting, and smithing transforms. Ingredients may be a single ID, a #tag reference, or an array of choices. Keep special result handling in the owning recipe or menu when a plain item result cannot represent the behavior.

Block tables live under assets/data/minecraft/loot_table/blocks/; entity tables live under .../entities/. A compact block table can express the silk-touch alternative and normal drop:

{
"type": "minecraft:block",
"pools": [{
"rolls": 1,
"entries": [{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"name": "minecraft:stone",
"condition": "minecraft:tool/can_silk_touch"
},
{
"type": "minecraft:item",
"name": "minecraft:cobblestone",
"condition": { "type": "minecraft:survives_explosion" }
}
]
}]
}]
}

Loot tables are parsed lazily and cached. Block, entity, and gameplay drop paths consult the table system; when a table is missing or uses unsupported behavior, the relevant domain can fall back to its existing drop logic. Check LootTableParser, LootTables, BlockLoot, and EntityLoot before extending the JSON schema, and preserve the fallback when a definition cannot be evaluated.

Put the file under assets/data/<namespace>/tags/<registry>/. Direct item IDs and nested #tag values are supported. Confirm that GameTags.EnsureLoaded loads that registry before recipes or gameplay query it. For example, a recipe referring to #minecraft:stone_tool_materials needs the item tag loader and binding to run during initialization.

Content Loader or owner Runtime destination
Tags TagLoader, GameTags Registry-backed HolderSet values
Crafting RecipeLoader RecipeRegistry
Cooking RecipeLoader CookingRecipes
Stonecutting RecipeLoader StonecutterRecipes
Smithing RecipeLoader SmithingRecipes
Loot LootTableParser, LootTables Block, entity, and gameplay drop callers

Malformed, unresolved, or unsupported definitions are reported and skipped. When content does not appear, inspect startup diagnostics, the exact namespace and directory, supported type names, and whether referenced tags loaded before the consumer. Keep data IDs canonical and avoid duplicating a special rule in both JSON and code unless the fallback is intentional.