Ejemplo n.º 1
0
  public ChunkMap djChunkMap(Chunk chunk, boolean flag, int paramInt) {
    int i = 0;
    ChunkSection[] arrayOfChunkSection = chunk.i();
    int j = 0;
    ChunkMap localChunkMap = new ChunkMap();
    byte[] arrayOfByte1 = buildBuffer;

    if (flag) {
      chunk.seenByPlayer = true;
    }
    int k;
    for (k = 0; k < arrayOfChunkSection.length; ++k)
      if ((arrayOfChunkSection[k] != null)
          && (((!(flag)) || (!(arrayOfChunkSection[k].isEmpty()))))
          && ((paramInt & 1 << k) != 0)) {
        localChunkMap.b |= 1 << k;
        if (arrayOfChunkSection[k].getExtendedIdArray() != null) {
          localChunkMap.c |= 1 << k;
          ++j;
        }
      }
    byte[] byteObject;
    NibbleArray nibObject;
    for (k = 0; k < arrayOfChunkSection.length; ++k) {
      if ((arrayOfChunkSection[k] != null)
          && (((!(flag)) || (!(arrayOfChunkSection[k].isEmpty()))))
          && ((paramInt & 1 << k) != 0)) {
        byteObject = replaceCoveredBlocks(chunk, arrayOfChunkSection[k]);
        System.arraycopy(byteObject, 0, arrayOfByte1, i, byteObject.length);
        i += byteObject.length;
      }
    }
    for (k = 0; k < arrayOfChunkSection.length; ++k) {
      if ((arrayOfChunkSection[k] != null)
          && (((!(flag)) || (!(arrayOfChunkSection[k].isEmpty()))))
          && ((paramInt & 1 << k) != 0)) {
        nibObject = arrayOfChunkSection[k].getDataArray();
        System.arraycopy(nibObject.a, 0, arrayOfByte1, i, nibObject.a.length);
        i += nibObject.a.length;
      }
    }
    for (k = 0; k < arrayOfChunkSection.length; ++k) {
      if ((arrayOfChunkSection[k] != null)
          && (((!(flag)) || (!(arrayOfChunkSection[k].isEmpty()))))
          && ((paramInt & 1 << k) != 0)) {
        nibObject = arrayOfChunkSection[k].getEmittedLightArray();
        System.arraycopy(nibObject.a, 0, arrayOfByte1, i, nibObject.a.length);
        i += nibObject.a.length;
      }
    }
    if (!(chunk.world.worldProvider.g)) {
      for (k = 0; k < arrayOfChunkSection.length; ++k) {
        if ((arrayOfChunkSection[k] != null)
            && (((!(flag)) || (!(arrayOfChunkSection[k].isEmpty()))))
            && ((paramInt & 1 << k) != 0)) {
          nibObject = arrayOfChunkSection[k].getSkyLightArray();
          System.arraycopy(nibObject.a, 0, arrayOfByte1, i, nibObject.a.length);
          i += nibObject.a.length;
        }
      }
    }

    if (j > 0) {
      for (k = 0; k < arrayOfChunkSection.length; ++k) {
        if ((arrayOfChunkSection[k] != null)
            && (((!(flag)) || (!(arrayOfChunkSection[k].isEmpty()))))
            && (arrayOfChunkSection[k].getExtendedIdArray() != null)
            && ((paramInt & 1 << k) != 0)) {
          nibObject = arrayOfChunkSection[k].getExtendedIdArray();
          System.arraycopy(nibObject.a, 0, arrayOfByte1, i, nibObject.a.length);
          i += nibObject.a.length;
        }
      }
    }

    if (flag) {
      byte[] arrayOfByte2 = chunk.m();
      System.arraycopy(arrayOfByte2, 0, arrayOfByte1, i, arrayOfByte2.length);
      i += arrayOfByte2.length;
    }

    localChunkMap.a = new byte[i];
    System.arraycopy(arrayOfByte1, 0, localChunkMap.a, 0, i);

    return ((ChunkMap) localChunkMap);
  }