BiomeCountResult class

Пакет: com.hypixel.hytale.server.worldgen.cache

Файл: com/hypixel/hytale/server/worldgen/cache/InterpolatedBiomeCountList.java

Поля (4)

МодификаторыТипИмя
public final Biome biome
public int count
public double heightNoise
public double heightThresholdContext

Методы (1)

МодификаторыВозвратСигнатура
public String toStringpublic String toString()

Исходный код

Показать/скрыть
class="kw">package com.hypixel.hytale.server.worldgen.cache;

class="kw">import com.hypixel.hytale.metrics.metric.AverageCollector;
class="kw">import com.hypixel.hytale.server.worldgen.biome.Biome;
class="kw">import com.hypixel.hytale.server.worldgen.chunk.ZoneBiomeResult;
class="kw">import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
class="kw">import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
class="kw">import it.unimi.dsi.fastutil.ints.IntArrayList;
class="kw">import it.unimi.dsi.fastutil.ints.IntList;
class="kw">import javax.annotation.Nonnull;

class="kw">public class InterpolatedBiomeCountList {
   @Nonnull
   class="kw">private class="kw">final Int2ObjectMap<InterpolatedBiomeCountList.BiomeCountResult> results = new Int2ObjectOpenHashMap();
   @Nonnull
   class="kw">private class="kw">final IntList biomeIds = new IntArrayList();
   class="kw">private Biome center;

   class="kw">public InterpolatedBiomeCountList() {
   }

   class="kw">public InterpolatedBiomeCountList.BiomeCountResult get(@Nonnull Biome var1) {
      class="kw">return this.get(var1.getId());
   }

   class="kw">public InterpolatedBiomeCountList.BiomeCountResult get(int var1) {
      class="kw">return (InterpolatedBiomeCountList.BiomeCountResult)this.results.get(var1);
   }

   class="kw">public void setCenter(@Nonnull ZoneBiomeResult var1) {
      Biome var2 = var1.getBiome();
      this.center = var2;
      this.biomeIds.add(var2.getId());
      this.results.put(var2.getId(), new InterpolatedBiomeCountList.BiomeCountResult(var2, var1.heightThresholdContext, var1.heightmapNoise));
   }

   class="kw">public void add(@Nonnull ZoneBiomeResult var1, int var2) {
      Biome var3 = var1.getBiome();
      int var4 = var3.getId();
      if (this.center.getInterpolation().getBiomeRadius2(var4) >= var2) {
         InterpolatedBiomeCountList.BiomeCountResult var5 = this.get(var4);
         if (var5 == null) {
            this.biomeIds.add(var4);
            this.results.put(var4, new InterpolatedBiomeCountList.BiomeCountResult(var3, var1.heightThresholdContext, var1.heightmapNoise));
         } else {
            var5.heightNoise = AverageCollector.add(var5.heightNoise, var1.heightmapNoise, var5.count);
            var5.count++;
         }
      }
   }

   @Nonnull
   class="kw">public IntList getBiomeIds() {
      class="kw">return this.biomeIds;
   }

   @Nonnull
   @Override
   class="kw">public String toString() {
      class="kw">return "InterpolatedBiomeCountList{results=" + this.results + ", biomeIds=" + this.biomeIds + "}";
   }

   class="kw">public class="kw">static class BiomeCountResult {
      @Nonnull
      class="kw">public class="kw">final Biome biome;
      class="kw">public double heightThresholdContext;
      class="kw">public double heightNoise;
      class="kw">public int count;

      class="kw">public BiomeCountResult(@Nonnull Biome var1, double var2, double var4) {
         this.biome = var1;
         this.heightThresholdContext = var2;
         this.heightNoise = var4;
         this.count = 1;
      }

      @Nonnull
      @Override
      class="kw">public String toString() {
         class="kw">return "BiomeCountResult{biome="
            + this.biome
            + ", heightThresholdContext="
            + this.heightThresholdContext
            + ", heightNoise="
            + this.heightNoise
            + ", count="
            + this.count
            + "}";
      }
   }
}