Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Reading Schematics


Recommended Posts

You could look at how vanilla minecraft load its .nbt structure files. the Igloo is a pretty simple one, so it would be a good place to start. You can find other examples about loading structures from file here: https://github.com/Beethoven92/BetterEndForge

Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port

Link to comment
Share on other sites

23 minutes ago, Beethoven92 said:

You could look at how vanilla minecraft load its .nbt structure files

Alright. It seems it uses TemplateManager, and I have figured out how to get that, ang grab a Template using it, but how do I get the blocks from said template?

if (!world.isRemote) {
  TemplateManager manager = world.getServer().func_241755_D_().getStructureTemplateManager();
  Template template = manager.getTemplate(new ResourceLocation(ModBase.MODID, "schematics/small_house"));


Link to comment
Share on other sites

It turns out using 

TemplateManager manager = world.getServer().func_241755_D_().getStructureTemplateManager();

crashes if its a singleplayer world, even with the !world.isRemote, so how else do I get the TemplateManager?


And I think to get the blocks I just do

BlockPos temp = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ());
template.func_215386_a(temp, new PlacementSettings(), Blocks.ACACIA_WOOD, true);


Edited by NullDev
Link to comment
Share on other sites

On 3/4/2021 at 3:22 AM, Beethoven92 said:

Please, post a link to your repository so we can see the whole code...

Sorry it took me so long, but here you go. I am trying to build it block by block from a tileentity. The code for the building is in the OneBlockBuilderTileEntityAbstract class. I currently have my own system implemented, but I'd prefer to use schematics, because those will be easier for complex structures.


Edited by NullDev
Forgot github link
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.

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.