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.

Featured Replies

Posted

I am creating a mod that has blocks that build structures, but I don't want to code in each of the positions for blocks by hand, so I want to use schematics. How would I start going about reading a schematic with forge?

  • Author
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"));
}

 

  • Author

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

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

https://github.com/AyliasTheCoder/OneBlockADayForge

Edited by NullDev
Forgot github link

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.