Esempio n. 1
0
  public static void convertToAnvilFormat(
      ChunkLoader.AnvilConverterData p_76690_0_,
      NBTTagCompound p_76690_1_,
      WorldChunkManager p_76690_2_) {
    p_76690_1_.setInteger("xPos", p_76690_0_.x);
    p_76690_1_.setInteger("zPos", p_76690_0_.z);
    p_76690_1_.setLong("LastUpdate", p_76690_0_.lastUpdated);
    int[] var3 = new int[p_76690_0_.heightmap.length];

    for (int var4 = 0; var4 < p_76690_0_.heightmap.length; ++var4) {
      var3[var4] = p_76690_0_.heightmap[var4];
    }

    p_76690_1_.setIntArray("HeightMap", var3);
    p_76690_1_.setBoolean("TerrainPopulated", p_76690_0_.terrainPopulated);
    NBTTagList var16 = new NBTTagList();
    int var7;

    for (int var5 = 0; var5 < 8; ++var5) {
      boolean var6 = true;

      for (var7 = 0; var7 < 16 && var6; ++var7) {
        int var8 = 0;

        while (var8 < 16 && var6) {
          int var9 = 0;

          while (true) {
            if (var9 < 16) {
              int var10 = var7 << 11 | var9 << 7 | var8 + (var5 << 4);
              byte var11 = p_76690_0_.blocks[var10];

              if (var11 == 0) {
                ++var9;
                continue;
              }

              var6 = false;
            }

            ++var8;
            break;
          }
        }
      }

      if (!var6) {
        byte[] var19 = new byte[4096];
        NibbleArray var20 = new NibbleArray();
        NibbleArray var21 = new NibbleArray();
        NibbleArray var22 = new NibbleArray();

        for (int var23 = 0; var23 < 16; ++var23) {
          for (int var12 = 0; var12 < 16; ++var12) {
            for (int var13 = 0; var13 < 16; ++var13) {
              int var14 = var23 << 11 | var13 << 7 | var12 + (var5 << 4);
              byte var15 = p_76690_0_.blocks[var14];
              var19[var12 << 8 | var13 << 4 | var23] = (byte) (var15 & 255);
              var20.set(
                  var23, var12, var13, p_76690_0_.data.get(var23, var12 + (var5 << 4), var13));
              var21.set(
                  var23, var12, var13, p_76690_0_.skyLight.get(var23, var12 + (var5 << 4), var13));
              var22.set(
                  var23,
                  var12,
                  var13,
                  p_76690_0_.blockLight.get(var23, var12 + (var5 << 4), var13));
            }
          }
        }

        NBTTagCompound var24 = new NBTTagCompound();
        var24.setByte("Y", (byte) (var5 & 255));
        var24.setByteArray("Blocks", var19);
        var24.setByteArray("Data", var20.getData());
        var24.setByteArray("SkyLight", var21.getData());
        var24.setByteArray("BlockLight", var22.getData());
        var16.appendTag(var24);
      }
    }

    p_76690_1_.setTag("Sections", var16);
    byte[] var17 = new byte[256];

    for (int var18 = 0; var18 < 16; ++var18) {
      for (var7 = 0; var7 < 16; ++var7) {
        var17[var7 << 4 | var18] =
            (byte)
                (p_76690_2_.func_180300_a(
                            new BlockPos(p_76690_0_.x << 4 | var18, 0, p_76690_0_.z << 4 | var7),
                            BiomeGenBase.field_180279_ad)
                        .biomeID
                    & 255);
      }
    }

    p_76690_1_.setByteArray("Biomes", var17);
    p_76690_1_.setTag("Entities", p_76690_0_.entities);
    p_76690_1_.setTag("TileEntities", p_76690_0_.tileEntities);

    if (p_76690_0_.tileTicks != null) {
      p_76690_1_.setTag("TileTicks", p_76690_0_.tileTicks);
    }
  }