-
Notifications
You must be signed in to change notification settings - Fork 2
Getting Started
This guide will walk you through the basics of creating structures with Moogs Structure Lib. By the end, you'll understand the four required files and have created a simple structure.
Minecraft 1.21 or higher is required Moogs Structure Lib supports Minecraft 1.20 through 1.21.10. This wiki will walk through how to use the lib in 1.21+ however most of the steps are the same for 1.20-1.20.6. Feel free to look at the data for our mods like MVS to figure out how to use the lib with older mc versions.
For mod development, add Moogs Structure Lib as a dependency in your fabric.mod.json or mods.toml.
Structures are defined using Minecraft's datapack system. Your files should be organized like this:
data/
└── <namespace>/
├── structure/ # NBT structure files (assets)
│ └── your_structure.nbt
└── worldgen/
├── structure/ # Structure definitions
│ └── your_structure.json
├── structure_set/ # Structure placement rules
│ └── your_structure.json
└── template_pool/ # Template pools
└── your_structure/
└── start_pool.json
Note: The structure/ folder for NBT files is separate from worldgen/structure/ for JSON definitions.
To generate a structure, you need exactly four files:
Location: data/<namespace>/worldgen/structure/<name>.json
Defines what type of structure it is, which biomes it spawns in, height settings, and other properties.
Location: data/<namespace>/worldgen/template_pool/<name>/start_pool.json
Defines which NBT structure files to use and how they connect together (for jigsaw structures).
Location: data/<namespace>/worldgen/structure_set/<name>.json
Defines where structures spawn in the world, how often, and spacing between them.
Location: data/<namespace>/structure/<path>/<name>.nbt
The actual structure data files created with structure blocks in Minecraft.
Let's look at a complete, simple example from MoogsVoyagerStructures - the Cart structure.
File: data/mvs/worldgen/structure/cart.json
{
"type": "moogs_structures:moogs_structures_generic_jigsaw_structure",
"start_pool": "mvs:carts/cart/start_pool",
"size": 1,
"biomes": "#mvs:has_structure/overworld_biomes",
"project_start_to_heightmap": "WORLD_SURFACE_WG",
"cannot_spawn_in_liquid": true,
"step": "surface_structures",
"terrain_adaptation": "beard_thin",
"start_height": {
"absolute": 0
},
"spawn_overrides": {}
}What this does:
-
type: Uses the generic jigsaw structure type from MSL (moogs structure lib) -
start_pool: References the template pool -
size: 1 means it's a simple structure (no jigsaw expansion) -
biomes: Spawns in overworld biomes (using a tag) -
project_start_to_heightmap: Places on world surface -
cannot_spawn_in_liquid: Won't spawn in water -
step: Generates during surface structures phase -
start_height: Uses absolute height 0 (will be adjusted by heightmap)
File: data/mvs/worldgen/template_pool/carts/cart/start_pool.json
{
"name": "mvs:cart/start_pool",
"fallback": "minecraft:empty",
"elements": [
{
"weight": 1,
"element": {
"location": "mvs:carts/cart",
"processors": "minecraft:empty",
"projection": "rigid",
"element_type": "minecraft:single_pool_element"
}
}
]
}What this does:
-
name: Unique identifier for this pool -
fallback: What to use if pool fails (usuallyminecraft:empty) -
elements: Array of structure pieces-
weight: Selection weight (higher = more likely) -
location: Path to NBT file (without.nbtextension) -
processors: Processor list (useminecraft:emptyfor none) -
projection:rigidkeeps structure as-is,terrain_matchingadapts to terrain -
element_type: Type of pool element
-
File: data/mvs/worldgen/structure_set/cart.json
{
"structures": [
{
"structure": "mvs:cart",
"weight": 1
}
],
"placement": {
"type": "moogs_structures:advanced_random_spread",
"salt": 203698201,
"spacing": 34,
"separation": 26
}
}What this does:
-
structures: List of structures in this set-
structure: Reference to structure JSON -
weight: Selection weight if multiple structures
-
-
placement: How structures are placed-
type: Uses advanced random spread placement -
salt: Unique number for this structure (affects spawn locations) -
spacing: Average space between structures -
separation: Minimum space between structures
-
File: data/mvs/structure/carts/cart.nbt
This is the actual structure file created with a structure block. The path mvs:carts/cart in the template pool references this file.
Here's how these files work together:
- World Generation checks structure sets to see if a structure should spawn in a chunk
-
Structure Set (
cart.json) determines if this chunk is valid based on spacing/separation -
Structure JSON (
cart.json) checks biomes, terrain, and other conditions -
Template Pool (
start_pool.json) selects which structure piece to use -
NBT File (
cart.nbt) provides the actual structure data - Structure is placed in the world!
Now that you understand the basics:
- Structure Files - Learn all available options for structure JSON files
- Template Pools - Understand how pools work and connect structures
- Structure Sets - Configure where structures spawn
- Placement Systems - Advanced placement options
- NBT Files - How to create and organize structure files
Or jump straight to examples:
- Simple Structure Example - Detailed walkthrough of the Cart structure
- Spacing must be greater than separation - Otherwise structures can't spawn properly
-
NBT file paths don't include
.nbtextension - Usemvs:carts/cartnotmvs:carts/cart.nbt - Structure names must match - The structure set references the structure JSON by name
Ready to dive deeper? Check out the Structure Files page for a complete reference!