Adding Entries to Template Pools - Apollounknowndev/lithostitched GitHub Wiki
This guide will show you how to add a new entry to template pools using Lithostitched. In the given example, we'll add a custom village house to the plains village.

The prerequisites for understanding this guide is:
- Understanding how datapacks are structured
- Understanding what template pools are
- How to use a structure block
Please note that for this guide, 'datapack' both refers to standalone datapacks and built-in datapacks in mods. When you put a data file in a mod's resources file, the game reads from it like it is a datapack.
First, we need to actually make the structure that will be added to the structure. Open a creative world and grab yourself a structure block. Set the structure name to a piece that is already in the template pool you are targeting. For example, given this guide is focusing on plains village houses, I will reference minecraft:village/plains/houses/plains_small_house_1. Load the structure.

From here you're free to modify this template to create the house you want. You can resize the structure if needed to fit a larger piece. The important thing is keeping the jigsaw block! It must both exist and be facing an outer edge of the structure to work.

One more thing before we save the new piece: Open the jigsaw block gui. You should see that all fields are filled in with the values from the base structure. If this isn't the case, load the base structure in somewhere else and copy over the jigsaw block from it.
When the jigsaw block is placed in the world, it will transform into whatever block is in the Turns into field. If you want to change that, do it now.
Now we're done and you can save the structure.

Now that we have a structure nbt file, it's time to use a worldgen modifier to add it to the template pool. Worldgen modifiers are a data-driven system from Lithostitched that can do things such as add new elements to template pools.
Create a json file in the data/<namespace>/lithostitched/worldgen_modifier folder. In the example datapack, it is at example/lithostitched/worldgen_modifier/add_azalea_house.json, but it can be named whatever you want and in as many/as few subfolders as you want.
Make sure the path contains your namespace, then
lithostitched, thenworldgen_modifier!!
Open the file in a text editor and paste this in:
{
"type": "lithostitched:add_template_pool_elements",
"template_pools": "<the template pool you're adding to>",
"elements": [
{
"weight": 1,
"element": {
"element_type": "minecraft:single_pool_element",
"projection": "rigid",
"location": "<your structure nbt location>",
"processors": "minecraft:empty"
}
}
]
}The template_pool field can be a template pool, a list of template pools, or a hash-prefixed template pool tag. In the given example, we're adding to the plains village houses template pool, so this should be minecraft:village/plains/houses.
The elements field holds a list of template pool elements to be injected. The weight field is the weight of this piece generating when the template pool is rolled relative to other pieces. Most village houses have a weight of 2.
The location field references a file in the <namespace>/structure folder. For example, if a structure nbt file is at namespace/structure/village/house3.nbt, the location field would be "namespace:village/house3". Change the location field to be the location of your structure nbt file. In the example datapack, since the nbt file is at example/structure/village_plains/azalea_house.nbt, the location in the template pool file is "example:village_plains/azalea_house".
You may also want to change the processors field if you have a processor list you want to apply to the structure. Plains village houses use the minecraft:mossify_10_percent processor, so the example pack will reference it as well.
If you've done everything correctly, you're done! Open a new world and teleport to/spawn in a village and you may see your new village house. If you don't see it after awhile, double check each step in the guide and reference the example datapack to see if you made a mistake somewhere.

Sometimes you may want a piece to always generate in a structure or only generate in a structure a maximum number of times. Lithostitched allows you to do those things with some small changes to your worldgen modifier file.
{
"type": "lithostitched:add_template_pool_elements",
"template_pools": "<the template pool you're adding to>",
"elements": [
{
"weight": 1,
"element": {
"element_type": "lithostitched:delegating",
"delegate": {
"element_type": "minecraft:single_pool_element",
"projection": "rigid",
"location": "<your structure nbt location>",
"processors": "minecraft:empty"
},
"forced_count": 1
}
}
]
}It is almost the same as the original file but with a key different: The pool element is wrapped in a delegating pool element. This special element type will place its delegate piece but also has extra fields for additional configuration.
-
If present,
forced_countwill force the structure to generate the element the number of times specified. Ifforced_countis 2, 2 instances of the piece will always be placed. One that count is reached, the piece is no longer placed. -
If present,
max_countwill cap the number of times the element can spawn in the structure without giving it any sort of priority like is gained fromforced_count. Ifmax_countis 2, only 0-2 instances of the piece can be placed.
There are additional optional fields on the delegating pool element which can be found on the wiki here.