Advertisement
Corosus

Untitled

Feb 23rd, 2012
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. public boolean tryBuild(int x, int y, int z, String file) {
  2. try {
  3. InputStream is = new FileInputStream(file);
  4.  
  5. NBTTagCompound nbttagcompound = CompressedStreamTools.loadGzippedCompoundFromOutputStream(new FileInputStream(file));
  6.  
  7. System.out.println(nbttagcompound.getShort("Width"));
  8. byte metadata[] = nbttagcompound.getByteArray("Data");
  9. byte blockids[] = nbttagcompound.getByteArray("Blocks");
  10.  
  11. int sizeX = nbttagcompound.getShort("Width");
  12. int sizeZ = nbttagcompound.getShort("Length");
  13. int sizeY = nbttagcompound.getShort("Height");
  14.  
  15. int bPosX = 0;
  16. int bPosY = 0;
  17. int bPosZ = 0;
  18.  
  19. int blockIDArr[][][] = new int
  20. [sizeX]
  21. [sizeY]
  22. [sizeZ];
  23.  
  24. int blockMetaArr[][][] = new int
  25. [sizeX]
  26. [sizeY]
  27. [sizeZ];
  28.  
  29. for (int xx = 0; xx < sizeX; xx++) {
  30. for (int yy = 0; yy < sizeY; yy++) {
  31. for (int zz = 0; zz < sizeZ; zz++) {
  32. int index = yy * sizeX * sizeZ + zz * sizeX + xx;
  33. blockIDArr[xx][yy][zz] = blockids[index];
  34. blockMetaArr[xx][yy][zz] = metadata[index];
  35.  
  36. worldRef.setBlockAndMetadata(x+xx, y+yy, z+zz, blockIDArr[xx][yy][zz], blockMetaArr[xx][yy][zz]);
  37. }
  38. }
  39. }
  40.  
  41.  
  42. System.out.println(blockids);
  43.  
  44. } catch (Exception ex) {
  45. ex.printStackTrace();
  46. }
  47. return true;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement