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 stopped modding a year ago due to exams and the 1.7 update meaning that the way i generate schematics no longer works due to the fact that schematics store block ID's which as i understand are not relevant to forge post 1.6

 

After a few hours of searching i have been unable to find a solution and as my mod uses hundreds of schematic files i am not sure what to do. I am an amateur and a year away from modding has not helped so any help or light you may be able to shed on the issue would be greatly appreciated.

 

This is the code used to generate the schematic files:

 

 

public class Loader {

 

public byte[] blocks;

public byte[] datablocks;

public short width;

public short length;

public short height;

public short[] sizes;

 

public Loader(String path) {

blocks = null;

datablocks = null;

width = 0;

length = 0;

height = 0;

load(path);

}

 

public void load(String path) {

try {

InputStream inputstream = Loader.class.getResourceAsStream("/assets/warsmod/structures/" + path);

NBTTagCompound nbt = CompressedStreamTools.readCompressed(inputstream);

 

blocks = nbt.getByteArray("Blocks");

datablocks = nbt.getByteArray("Data");

width = nbt.getShort("Width");

length = nbt.getShort("Length");

height = nbt.getShort("Height");

sizes = new short[] { width, length, height };

} catch (Exception e) {

e.printStackTrace();

}

}

 

public void generate(World world, int posX, int posY, int posZ, boolean spawnairblocks) {

try {

int xnum = 0;

int ynum = 0;

int znum = 0;

 

for (int i = 0; i < blocks.length; i++) {

int blockId = UnsignedBytes.toInt(blocks);

if (((blocks != 0) && (!spawnairblocks)) || (spawnairblocks == true)) {

 

world.setBlock(posX + xnum, posY + ynum, posZ + znum, blockId, datablocks, 2);

}

 

if (xnum < width - 1) {

xnum++;

} else if ((xnum >= width - 1) && (znum < length - 1)) {

xnum = 0;

znum++;

} else if ((xnum >= width - 1) && (znum >= length - 1) && (ynum < height - 1)) {

xnum = 0;

znum = 0;

ynum++;

}

}

} catch (Exception e) {

e.printStackTrace();

}

}

}

I stopped modding a year ago due to exams and the 1.7 update meaning that the way i generate schematics no longer works due to the fact that schematics store block ID's which as i understand are not relevant to forge post 1.6

 

After a few hours of searching i have been unable to find a solution and as my mod uses hundreds of schematic files i am not sure what to do. I am an amateur and a year away from modding has not helped so any help or light you may be able to shed on the issue would be greatly appreciated.

 

This is the code used to generate the schematic files:

 

 

public class Loader {

 

public byte[] blocks;

public byte[] datablocks;

public short width;

public short length;

public short height;

public short[] sizes;

 

public Loader(String path) {

blocks = null;

datablocks = null;

width = 0;

length = 0;

height = 0;

load(path);

}

 

public void load(String path) {

try {

InputStream inputstream = Loader.class.getResourceAsStream("/assets/warsmod/structures/" + path);

NBTTagCompound nbt = CompressedStreamTools.readCompressed(inputstream);

 

blocks = nbt.getByteArray("Blocks");

datablocks = nbt.getByteArray("Data");

width = nbt.getShort("Width");

length = nbt.getShort("Length");

height = nbt.getShort("Height");

sizes = new short[] { width, length, height };

} catch (Exception e) {

e.printStackTrace();

}

}

 

public void generate(World world, int posX, int posY, int posZ, boolean spawnairblocks) {

try {

int xnum = 0;

int ynum = 0;

int znum = 0;

 

for (int i = 0; i < blocks.length; i++) {

int blockId = UnsignedBytes.toInt(blocks);

if (((blocks != 0) && (!spawnairblocks)) || (spawnairblocks == true)) {

 

world.setBlock(posX + xnum, posY + ynum, posZ + znum, blockId, datablocks, 2);

}

 

if (xnum < width - 1) {

xnum++;

} else if ((xnum >= width - 1) && (znum < length - 1)) {

xnum = 0;

znum++;

} else if ((xnum >= width - 1) && (znum >= length - 1) && (ynum < height - 1)) {

xnum = 0;

znum = 0;

ynum++;

}

}

} catch (Exception e) {

e.printStackTrace();

}

}

}

For reading old schematics, Block#getBlockById(int i) should work for reading them as blocks. In 1.7.10, I believe blocks still have metadata, so you should be good there, unless you are jumping straight from 1.6 to 1.8, in which case Block#getStateFromMeta will also be helpful.

If I helped please press the Thank You button.

 

Check out my mods at http://www.curse.com/users/The_Fireplace/projects

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.