Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public boolean tryBuild(int x, int y, int z, String file) {
- try {
- InputStream is = new FileInputStream(file);
- NBTTagCompound nbttagcompound = CompressedStreamTools.loadGzippedCompoundFromOutputStream(new FileInputStream(file));
- System.out.println(nbttagcompound.getShort("Width"));
- byte metadata[] = nbttagcompound.getByteArray("Data");
- byte blockids[] = nbttagcompound.getByteArray("Blocks");
- int sizeX = nbttagcompound.getShort("Width");
- int sizeZ = nbttagcompound.getShort("Length");
- int sizeY = nbttagcompound.getShort("Height");
- int bPosX = 0;
- int bPosY = 0;
- int bPosZ = 0;
- int blockIDArr[][][] = new int
- [sizeX]
- [sizeY]
- [sizeZ];
- int blockMetaArr[][][] = new int
- [sizeX]
- [sizeY]
- [sizeZ];
- for (int xx = 0; xx < sizeX; xx++) {
- for (int yy = 0; yy < sizeY; yy++) {
- for (int zz = 0; zz < sizeZ; zz++) {
- int index = yy * sizeX * sizeZ + zz * sizeX + xx;
- blockIDArr[xx][yy][zz] = blockids[index];
- blockMetaArr[xx][yy][zz] = metadata[index];
- worldRef.setBlockAndMetadata(x+xx, y+yy, z+zz, blockIDArr[xx][yy][zz], blockMetaArr[xx][yy][zz]);
- }
- }
- }
- System.out.println(blockids);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement