Constants interface

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

Файл: com/hypixel/hytale/server/worldgen/loader/biome/BiomeJsonLoader.java

Поля (20)

МодификаторыТипИмя
String ERROR_COVER_CONTAINER
String ERROR_ENVIRONMENT_CONTAINER
String ERROR_FADE_CONTAINER
String ERROR_HEIGHT_CONTAINER
String ERROR_LAYER_CONTAINER
String ERROR_NO_LAYER_CONTAINER
String ERROR_PREFAB_CONTAINER
String ERROR_TINT_CONTAINER
String ERROR_WATER_CONTAINER
String KEY_COVERS
String KEY_ENVIRONMENT
String KEY_FADE
String KEY_HEIGHTMAP_NOISE
String KEY_INTERPOLATION
String KEY_LAYERS
String KEY_MAP_COLOR
String KEY_PREFABS
String KEY_TERRAIN_HEIGHT_THRESHOLD
String KEY_TINT
String KEY_WATER

Исходный код

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

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.procedurallib.condition.IHeightThresholdInterpreter;
class="kw">import com.hypixel.hytale.procedurallib.json.HeightThresholdInterpreterJsonLoader;
class="kw">import com.hypixel.hytale.procedurallib.json.JsonLoader;
class="kw">import com.hypixel.hytale.procedurallib.json.NoisePropertyJsonLoader;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
class="kw">import com.hypixel.hytale.procedurallib.property.NoiseProperty;
class="kw">import com.hypixel.hytale.server.worldgen.SeedStringResource;
class="kw">import com.hypixel.hytale.server.worldgen.biome.Biome;
class="kw">import com.hypixel.hytale.server.worldgen.biome.BiomeInterpolation;
class="kw">import com.hypixel.hytale.server.worldgen.container.CoverContainer;
class="kw">import com.hypixel.hytale.server.worldgen.container.EnvironmentContainer;
class="kw">import com.hypixel.hytale.server.worldgen.container.FadeContainer;
class="kw">import com.hypixel.hytale.server.worldgen.container.LayerContainer;
class="kw">import com.hypixel.hytale.server.worldgen.container.PrefabContainer;
class="kw">import com.hypixel.hytale.server.worldgen.container.TintContainer;
class="kw">import com.hypixel.hytale.server.worldgen.container.WaterContainer;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.CoverContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.EnvironmentContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.FadeContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.LayerContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.PrefabContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.TintContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.container.WaterContainerJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.context.BiomeFileContext;
class="kw">import com.hypixel.hytale.server.worldgen.loader.context.FileLoadingContext;
class="kw">import java.nio.file.Path;
class="kw">import java.util.regex.Pattern;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class="kw">abstract class BiomeJsonLoader class="kw">extends JsonLoader<SeedStringResource, Biome> {
   class="kw">private class="kw">static class="kw">final Pattern COLOR_PREFIX_PATTERN = Pattern.compile("0x|#");
   class="kw">protected class="kw">final BiomeFileContext biomeContext;
   class="kw">protected class="kw">final FileLoadingContext fileContext;

   class="kw">public BiomeJsonLoader(SeedString<SeedStringResource> var1, Path var2, JsonElement var3, BiomeFileContext var4) {
      super(var1, var2, var3);
      this.biomeContext = var4;
      this.fileContext = var4.getParentContext().getParentContext();
   }

   @Nonnull
   class="kw">protected IHeightThresholdInterpreter loadTerrainHeightThreshold() {
      try {
         class="kw">return new HeightThresholdInterpreterJsonLoader<>(this.seed, this.dataFolder, this.get("TerrainHeightThreshold"), 320).load();
      } catch (Throwable var2) {
         throw new Error("Failed to load height threshold container", var2);
      }
   }

   @Nonnull
   class="kw">protected CoverContainer loadCoverContainer() {
      try {
         class="kw">return new CoverContainerJsonLoader(this.seed, this.dataFolder, this.get("Covers"), this.biomeContext).load();
      } catch (Throwable var2) {
         throw new Error("Failed to load cover container", var2);
      }
   }

   @Nonnull
   class="kw">protected FadeContainer loadFadeContainer() {
      try {
         class="kw">return new FadeContainerJsonLoader(this.seed, this.dataFolder, this.get("Fade")).load();
      } catch (Throwable var2) {
         throw new Error("Failed to load fade container", var2);
      }
   }

   @Nonnull
   class="kw">protected LayerContainer loadLayerContainers() {
      try {
         if (!this.has("Layers")) {
            throw new IllegalArgumentException("LayerContainer is not defined in Biome!");
         } else {
            class="kw">return new LayerContainerJsonLoader(this.seed, this.dataFolder, this.get("Layers"), this.biomeContext).load();
         }
      } catch (Throwable var2) {
         throw new Error("Failed to load layer container", var2);
      }
   }

   @Nullable
   class="kw">protected PrefabContainer loadPrefabContainer() {
      try {
         PrefabContainer var1 = null;
         if (this.has("Prefabs")) {
            var1 = new PrefabContainerJsonLoader(this.seed, this.dataFolder, this.get("Prefabs"), this.biomeContext).load();
         }

         class="kw">return var1;
      } catch (Throwable var2) {
         throw new Error("Failed to load prefab container", var2);
      }
   }

   @Nonnull
   class="kw">protected TintContainer loadTintContainer() {
      try {
         class="kw">return new TintContainerJsonLoader(this.seed, this.dataFolder, this.get("Tint"), this.biomeContext).load();
      } catch (Throwable var2) {
         throw new Error("Failed to load tint container", var2);
      }
   }

   @Nonnull
   class="kw">protected EnvironmentContainer loadEnvironmentContainer() {
      try {
         class="kw">return new EnvironmentContainerJsonLoader(this.seed, this.dataFolder, this.get("Environment"), this.biomeContext).load();
      } catch (Throwable var2) {
         throw new Error("Failed to load environment container", var2);
      }
   }

   @Nonnull
   class="kw">protected WaterContainer loadWaterContainer() {
      try {
         class="kw">return new WaterContainerJsonLoader(this.seed, this.dataFolder, this.get("Water"), this.biomeContext).load();
      } catch (Throwable var2) {
         throw new Error("Failed to load water container", var2);
      }
   }

   @Nullable
   class="kw">protected NoiseProperty loadHeightmapNoise() {
      NoiseProperty var1 = null;
      if (this.has("HeightmapNoise")) {
         var1 = new NoisePropertyJsonLoader<>(this.seed, this.dataFolder, this.get("HeightmapNoise")).load();
      }

      class="kw">return var1;
   }

   class="kw">protected int loadColor() {
      int var1 = 16711680;
      if (this.has("MapColor")) {
         var1 = getColor(this.get("MapColor").getAsString());
      }

      class="kw">return var1;
   }

   @Nullable
   class="kw">protected BiomeInterpolation loadInterpolation() {
      BiomeInterpolation var1 = BiomeInterpolation.DEFAULT;
      if (this.has("Interpolation")) {
         var1 = new BiomeInterpolationJsonLoader(this.seed, this.dataFolder, this.get("Interpolation"), this.biomeContext.getParentContext()).load();
      }

      class="kw">return var1;
   }

   class="kw">protected class="kw">static int getColor(@Nonnull String var0) {
      String var1 = COLOR_PREFIX_PATTERN.matcher(var0).replaceFirst("");
      class="kw">return Integer.parseInt(var1, 16);
   }

   class="kw">public class="kw">interface Constants {
      String KEY_TERRAIN_HEIGHT_THRESHOLD = "TerrainHeightThreshold";
      String KEY_COVERS = "Covers";
      String KEY_LAYERS = "Layers";
      String KEY_PREFABS = "Prefabs";
      String KEY_FADE = "Fade";
      String KEY_TINT = "Tint";
      String KEY_ENVIRONMENT = "Environment";
      String KEY_WATER = "Water";
      String KEY_HEIGHTMAP_NOISE = "HeightmapNoise";
      String KEY_INTERPOLATION = "Interpolation";
      String KEY_MAP_COLOR = "MapColor";
      String ERROR_NO_LAYER_CONTAINER = "LayerContainer is not defined in Biome!";
      String ERROR_COVER_CONTAINER = "Failed to load cover container";
      String ERROR_HEIGHT_CONTAINER = "Failed to load height threshold container";
      String ERROR_LAYER_CONTAINER = "Failed to load layer container";
      String ERROR_WATER_CONTAINER = "Failed to load water container";
      String ERROR_TINT_CONTAINER = "Failed to load tint container";
      String ERROR_FADE_CONTAINER = "Failed to load fade container";
      String ERROR_ENVIRONMENT_CONTAINER = "Failed to load environment container";
      String ERROR_PREFAB_CONTAINER = "Failed to load prefab container";
   }
}