Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[1.19.4] Difficulties adding Custom Structures to Villages using DatapackBuiltinEntriesProvider

Featured Replies

Posted

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.

  • Author

Yeah that was pretty much it, I did have a configured jigsaw block but it had to be more than one block above, thanks for the help!

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.