Пример #1
0
    private void biomePrep() {
      if (sameneighborbiomecnt != null) return;
      int x_size = x_dim << 4;
      int z_size = (z_max - z_min + 1) << 4;
      sameneighborbiomecnt = new byte[x_size][];
      biomemap = new BiomeMap[x_size][];
      for (int i = 0; i < x_size; i++) {
        sameneighborbiomecnt[i] = new byte[z_size];
        biomemap[i] = new BiomeMap[z_size];
      }
      Object[] biomebase = null;
      ChunkSnapshot biome_css = null;
      for (int i = 0; i < x_size; i++) {
        initialize(i + x_base, 64, z_base);
        for (int j = 0; j < z_size; j++) {
          BiomeMap bm;

          if (snap != biome_css) {
            biomebase = null;
            biome_css = snap;
            if (biome_css instanceof SpoutChunkSnapshot) {
              biome_css = ((SpoutChunkSnapshot) biome_css).chunk;
            }
            biomebase = helper.getBiomeBaseFromSnapshot(biome_css);
          }
          if (biomebase != null) {
            bm = BiomeMap.byBiomeID(helper.getBiomeBaseID(biomebase[bz << 4 | bx]));
          } else {
            Biome bb = snap.getBiome(bx, bz);
            if (bb == null) bm = BiomeMap.NULL;
            else bm = biome_to_bmap[bb.ordinal()];
          }
          biomemap[i][j] = bm;
          int cnt = 0;
          if (i > 0) {
            if (bm == biomemap[i - 1][j]) {
                /* Same as one to left */
              cnt++;
              sameneighborbiomecnt[i - 1][j]++;
            }
            if ((j > 0) && (bm == biomemap[i - 1][j - 1])) {
              cnt++;
              sameneighborbiomecnt[i - 1][j - 1]++;
            }
            if ((j < (z_size - 1)) && (bm == biomemap[i - 1][j + 1])) {
              cnt++;
              sameneighborbiomecnt[i - 1][j + 1]++;
            }
          }
          if ((j > 0) && (biomemap[i][j] == biomemap[i][j - 1])) {
              /* Same as one to above */
            cnt++;
            sameneighborbiomecnt[i][j - 1]++;
          }
          sameneighborbiomecnt[i][j] = (byte) cnt;

          stepPosition(BlockStep.Z_PLUS);
        }
      }
    }
 private Color getMaterialColor(
     Material material, ChunkSnapshot chunkSnapshot, int x, int y, int z) {
   MaterialColor materialColor = colorPalette.getMaterialColor(material);
   if (materialColor != null) {
     Color color =
         materialColor.getColor(
             chunkSnapshot.getBlockData(x, y, z),
             x + (chunkSnapshot.getX() * 16),
             z + (chunkSnapshot.getZ() * 16),
             chunkSnapshot.getRawBiomeRainfall(x, z),
             chunkSnapshot.getRawBiomeTemperature(x, z),
             chunkSnapshot.getBiome(x, z));
     if (color != null) {
       if (material.equals(Material.STATIONARY_WATER) && isUnderWater(chunkSnapshot, x, y, z)) {
         color = setAlpha(color, 32);
       }
       return color;
     }
   }
   // RealtimeRender.getLogger().warning(String.format("RealtimeRender: missing color for material
   // '%s'!", material.toString()));
   return new Color(0xFF00FF);
 }
Пример #3
0
 public final Biome getBiome(int x, int z) {
   return chunk.getBiome(x, z);
 }