Posted March 21, 20169 yr I have a few questions about structures. First, is there a decent schematic exporter for 1.8.9? I've tried MCEdit and mineways, but they both (possibly) produce garbled junk, that in no way resembles what I've created. It doesn't seem to handle stairs or slabs very well. Second, why - if the schematics are alright, which I think they are - would it generate garbled junk? Here's my generation code: public static void PlaceStructure(Schematic structure, World world, BlockPos centre) { int i = 0; if(structure == null) return; for(int x = centre.getX() - structure.width / 2; x < centre.getX() + structure.width / 2; x++) { for(int y = centre.getY() - 1; y < centre.getY() - 1 + structure.height; y++) { for(int z = centre.getZ() - structure.length / 2; z < centre.getZ() + structure.length / 2; z++) { Block currentBlock = Block.getBlockById(structure.blocks[i]); i += 1; if(currentBlock != Blocks.air) { world.setBlockState(new BlockPos(x, y, z), currentBlock.getDefaultState()); } } } } } And here's my Schematic class: public class SchematicHandler { public Schematic get(String schematic) { try { InputStream is = this.getClass().getClassLoader().getResourceAsStream("assets/masterofmagic/schematics/" + schematic + ".schematic"); NBTTagCompound nbtdata = CompressedStreamTools.readCompressed(is); short width = nbtdata.getShort("Width"); short height = nbtdata.getShort("Height"); short length = nbtdata.getShort("Length"); byte[] blocks = nbtdata.getByteArray("Blocks"); byte[] data = nbtdata.getByteArray("Data"); System.out.println("schem size:" + width + " x " + height + " x " + length); NBTTagList tileentities = nbtdata.getTagList("TileEntities", 10); is.close(); return new Schematic(tileentities, width, height, length, blocks, data); } catch (Exception e) { System.out.println("I can't load schematic, because " + e.toString()); return null; } } public class Schematic { public NBTTagList tileentities; public short width; public short height; public short length; public byte[] blocks; public byte[] data; public Schematic(NBTTagList tileentities, short width, short height, short length, byte[] blocks, byte[] data) { this.tileentities = tileentities; this.width = width; this.height = height; this.length = length; this.blocks = blocks; this.data = data; } } } Here's one I made earlier:
March 22, 20169 yr Do you have any mods installed, and are you using any modded blocks in your structure? The trouble with modded blocks is that they do not have set IDs - the integer IDs can and will be different between different worlds, so they are no longer a valid storage format without some sort of converter (e.g. a file storing the map of block IDs to block registry names used to create the structure). http://i.imgur.com/NdrFdld.png[/img]
March 22, 20169 yr Author Nope, no blocks except vanilla blocks, and no mods at all. I created a separate version just for building stuff for my mod.
March 22, 20169 yr Author I found the problem. The loops must go Y, Z, X, not X, Y, Z, for some reason. That's just the way schematics are constructed, apparently. Which apparently is how pre-1.4 Minecraft did its chunks. Whoever did that is stupid. EDIT TO PREVENT DOUBLE POSTING: So my structure builds, now. The only problem I have is that the block metadata (I think) for the slabs and stairs are not set properly, so they are not the right type, or are oriented incorrectly, as appropriate.
March 24, 20169 yr Author Just a shameless bump. Anyone got any ideas on how to get the block's data to set it to the correct facing/type?
March 24, 20169 yr You're not using the metadata at all right now: currentBlock.getDefaultState() That will only ever give you the default state, which isn't what you want. Assuming you have access to the metadata value of the block, you should use: currentBlock.getStateFromMeta(meta) http://i.imgur.com/NdrFdld.png[/img]
March 24, 20169 yr Author Thanks for the help, guys. Both posts really helped me out. Here's what my structures look like now!
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.