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

 

uLR1jww.jpg

 

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

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

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)

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.