예제 #1
0
  private void setupBiomeMapping() {
    biomeMapping.clear();
    if (controllerType == ControllerType.CONTROLLER_FILTERED) {
      BiomeGenBase[] biomeGenArray = BiomeGenBase.getBiomeGenArray();
      final Set<Integer> ids = new HashSet<Integer>();
      for (BiomeGenBase biome : biomes) {
        if (biome != null) {
          ids.add(biome.biomeID);
        } else {
          ids.add(BiomeGenBase.plains.biomeID);
        }
      }

      ControllerType.BiomeFilter biomeFilter =
          new ControllerType.BiomeFilter() {
            @Override
            public boolean match(BiomeGenBase biome) {
              return ids.contains(biome.biomeID);
            }

            @Override
            public double calculateBiomeDistance(BiomeGenBase a, BiomeGenBase b) {
              return calculateBiomeDistance(a, b, false, false, false);
            }
          };
      BiomeControllerMapping.makeFilteredBiomeMap(biomeGenArray, biomeMapping, biomeFilter);
    }
  }
예제 #2
0
 private static <T extends Enum> Set<T> toEnumSet(int[] arr, T[] values) {
   Set<T> list = new HashSet<T>();
   for (int a : arr) {
     list.add(values[a]);
   }
   return list;
 }