I got rid of the classes and tried making it so in my…
- User
I got rid of the classes and tried making it so in my resources/data/minecraft/structures/village/plains/houses I have all the nbts and they are named after the minecraft ones trying to "replace" them and when you do the /place command it will place my structure but if I look in real villages by flying around and using /locate village_plains it seems like there is no houses that I replaced for example before I replaced the plains_tannery it would spawn but since I replaced it with mine it will not spawn in the actual village now and that's the same for all of the ones I have replaced
Assistant
To resolve the issue where your custom structures aren't appearing in generated villages despite replacing NBT files, follow these steps:
✅ 1. Correct Structure Placement (Namespace & Path)
Your structures must reside in your mod's own namespace and follow the correct path:
src/main/resources/data/marloevillages/structures/village/plains/houses/plains_tannery.nbtThis ensures
marloevillages:village/plains/houses/plains_tanneryresolves correctly.
✅ 2. Override the Vanilla Pool via Data Pack
Create a data pack inside your mod to override the vanilla pool. This is the only reliable way to replace structures in 1.20.1.
Directory Structure:
src/main/resources/data/marloevillages/datapacks/custom_villages/data/marloevillages/worldgen/template_pool/village/plains/houses.jsonhouses.jsonContent:{ "name": "minecraft:village/plains/houses", "fallback": "minecraft:empty", "elements": [ { "weight": 5, "element": { "element_type": "minecraft:single_pool_element", "location": "marloevillages:village/plains/houses/plains_tannery", "projection": "rigid", "processors": "minecraft:empty" } }, { "weight": 3, "element": { "element_type": "minecraft:single_pool_element", "location": "marloevillages:village/plains/houses/marloe_house_1", "projection": "rigid", "processors": "minecraft:empty" } } ] }
✅ 3. Automatically Apply the Data Pack
Forge won't auto-apply data packs from your mod. Use this code to inject it at runtime:
ModDataPackHandler.java:package net.mattias.marloevillages; import net.minecraft.server.packs.PackType; import net.minecraft.server.packs.metadata.pack.PackMetadataSection; import net.minecraft.server.packs.repository.Pack; import net.minecraft.server.packs.repository.PackSource; import net.minecraft.server.packs.resources.IoSupplier; import net.minecraftforge.event.AddPackFindersEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import java.nio.file.Files; import java.nio.file.Path; @Mod.EventBusSubscriber(modid = MarloeVillages.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class ModDataPackHandler { @SubscribeEvent public static void addPack(AddPackFindersEvent event) { if (event.getPackType() != PackType.SERVER_DATA) return; Path packPath = Path.of("data/marloevillages/datapacks/custom_villages"); IoSupplier<PackMetadataSection> metadata = () -> new PackMetadataSection( "Custom Marloe Villages", 13 ); Pack pack = Pack.readMetaAndCreate( "file/marloevillages:custom_villages", "Custom Marloe Villages", true, (s) -> Files.exists(packPath.resolve(s)), PackType.SERVER_DATA, Pack.Position.TOP, false, metadata ); event.addRepositorySource((consumer) -> consumer.accept(Pack.create( "marloevillages:custom_villages", false, (id) -> pack, PackSource.BUILT_IN ))); } }Register this class in your main class:
IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); modEventBus.addListener(ModDataPackHandler::addPack);
✅ 4. Verify Structure NBT Files
Ensure your NBT files are valid:
- Use a Structure Block in-game to save structures.
- Export them to
data/marloevillages/structures/village/plains/houses/. - Test with
/structure load <name> <pos>.
✅ 5. Generate New Villages
Old villages won't reflect changes. Generate a new world or use
/locate villagein a new area.
🧪 Example Structure File Location:
src/main/resources/data/marloevillages/structures/village/plains/houses/plains_tannery.nbt
🚫 Common Pitfalls
Issue Fix Structures in minecraftnamespaceMove to marloevillagesPool JSON not referencing modded structures Update locationfieldsData pack not applied Use ModDataPackHandlerOld village cache Generate new world
✅ Final Result
When a village generates, it will use your custom structures defined in
houses.json. This method works reliably in 1.20.1 and avoids registry-modification pitfalls.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.