Posted March 3, 20214 yr 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?
March 3, 20214 yr 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
March 3, 20214 yr 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")); }
March 3, 20214 yr 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 March 3, 20214 yr by NullDev
March 4, 20214 yr Please, post a link to your repository so we can see the whole code...those few lines of code are completely decontextualized and it is very hard to tell what you are actually doing Check out the port of the BetterEnd fabric mod (WIP): https://www.curseforge.com/minecraft/mc-mods/betterend-forge-port
March 6, 20214 yr 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 March 6, 20214 yr 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.