コード例 #1
0
  /**
   * Return a list of biomes for the specified blocks. Args: listToReuse, x, y, width, length,
   * cacheFlag (if false, don't check biomeCache to avoid infinite loop in BiomeCacheBlock)
   */
  @Override
  public BiomeGenBase[] getBiomeGenAt(
      BiomeGenBase[] par1ArrayOfBiomeGenBase,
      int x,
      int y,
      int width,
      int length,
      boolean cacheFlag) {
    IntCache.resetIntCache();

    if (par1ArrayOfBiomeGenBase == null || par1ArrayOfBiomeGenBase.length < width * length) {
      par1ArrayOfBiomeGenBase = new BiomeGenBase[width * length];
    }

    if (cacheFlag && width == 16 && length == 16 && (x & 15) == 0 && (y & 15) == 0) {
      final BiomeGenBase[] abiomegenbase1 = myBiomeCache.getCachedBiomes(x, y);
      System.arraycopy(abiomegenbase1, 0, par1ArrayOfBiomeGenBase, 0, width * length);
      return par1ArrayOfBiomeGenBase;
    } else {
      final int[] aint = myBiomeIndexLayer.getInts(x, y, width, length);

      for (int i = 0; i < width * length; ++i) {
        if (aint[i] >= 0) {
          par1ArrayOfBiomeGenBase[i] = BiomeGenBase.biomeList[aint[i]];
        } else {
          // Change this to a biome
          par1ArrayOfBiomeGenBase[i] = TechWorld.mainBiome;
        }
      }

      return par1ArrayOfBiomeGenBase;
    }
  }
コード例 #2
0
 @Override
 public int[] getCachedBiomes(int x, int z) {
   BiomeGenBase[] cached = handle.getCachedBiomes(x, z);
   int[] intCache = new int[cached.length];
   for (int i = 0; i < cached.length; i++) {
     intCache[i] = cached[i].biomeID;
   }
   return intCache;
 }