Jump to content

[1.19.4] Difficulties adding Custom Structures to Villages using DatapackBuiltinEntriesProvider


mrxiii

Recommended Posts

I am experimenting with the DatapackBuiltinEntriesProvider, and I am trying to add a custom structure for the taiga village structure template pool. The json file generates properly, however the result doesn't actually show in the taiga village. I'm looking at the official forge documentation and the forge GitHub, to see how things are working. Here is a snippet of my code, in the rest of the project I made sure to replace the "examplemod" mod ID,

 

...


modEventBus.addListener(this::onGatherData);
}



public void onGatherData(GatherDataEvent event) {
event.getGenerator().addProvider(
event.includeServer(),
(DataProvider.Factory<DatapackBuiltinEntriesProvider>) output -> new DatapackBuiltinEntriesProvider(
output,
event.getLookupProvider(),
new RegistrySetBuilder().add(Registries.TEMPLATE_POOL, this::addHut),

// Minecraft because this is modifying a minecraft template pool.
Set.of("minecraft")
)
);
}

public void addHut(BootstapContext<StructureTemplatePool> context) {
HolderGetter<StructureTemplatePool> poolHolderGetter = context.lookup(Registries.TEMPLATE_POOL);


Holder<StructureTemplatePool> emptyPool = poolHolderGetter.getOrThrow(Pools.EMPTY);

StructurePoolElement hut = StructurePoolElement.legacy("arcana:witch_hut").apply(StructureTemplatePool.Projection.RIGID);
context.register(ResourceKey.create(Registries.TEMPLATE_POOL, new ResourceLocation("village/taiga/houses")), new StructureTemplatePool(emptyPool, List.of(Pair.of(hut, 2))));

}

...

What this code should do to my knowledge is create a new structure template pool with only the given structure as shown by the generated json:

"elements": [
{
"element": {
"element_type": "minecraft:legacy_single_pool_element",
"location": "arcana:witch_hut",
"processors": {
"processors": []
},
"projection": "rigid"
},
"weight": 2
}
],
"fallback": "minecraft:empty"
}

 

With my .nbt structure file contained in "resources/data/arcana/structures/witch_hut.nbt"

 

However, in the end this structure doesn't show up at all. Pardon me but if this is a very simple issue, I would appreciate being redirected to any resources or tips that may be helpful in figuring out myself how to fix this issue. I've been refraining from watching YouTube tutorials for the longest point because I am trying to actually develop the skillset to go through code and documentation to learn this myself.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.