Constants interface

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

Файл: com/hypixel/hytale/server/worldgen/loader/climate/UniqueClimateJsonLoader.java

Поля (13)

МодификаторыТипИмя
Integer DEFAULT_OFFSET
Integer DEFAULT_RADIUS
Integer DEFAULT_SEARCH_MIN_RADIUS
Integer DEFAULT_SEARCH_RADIUS
String KEY_COLOR
String KEY_DISTANCE
String KEY_MIN_DISTANCE
String KEY_ORIGIN_X
String KEY_ORIGIN_Y
String KEY_PARENT
String KEY_RADIUS
String KEY_RULE
String KEY_ZONE

Исходный код

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

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.procedurallib.json.JsonLoader;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedResource;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
class="kw">import com.hypixel.hytale.server.worldgen.climate.ClimateSearch;
class="kw">import com.hypixel.hytale.server.worldgen.climate.UniqueClimateGenerator;
class="kw">import com.hypixel.hytale.server.worldgen.loader.util.ColorUtil;
class="kw">import java.nio.file.Path;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;
class="kw">import org.joml.Vector2i;

class="kw">public class UniqueClimateJsonLoader<K class="kw">extends SeedResource> class="kw">extends JsonLoader<K, UniqueClimateGenerator.Entry> {
   class="kw">public UniqueClimateJsonLoader(SeedString<K> var1, Path var2, @Nullable JsonElement var3) {
      super(var1, var2, var3);
   }

   @Nonnull
   class="kw">public UniqueClimateGenerator.Entry load() {
      class="kw">return new UniqueClimateGenerator.Entry(
         this.loadName(),
         this.loadParent(),
         this.loadColor(),
         this.loadRadius(),
         this.loadOrigin(),
         this.loadMinDistance(),
         this.loadDistance(),
         this.loadRule()
      );
   }

   class="kw">protected String loadName() {
      class="kw">return this.mustGetString("Name", null);
   }

   class="kw">protected String loadParent() {
      class="kw">return this.mustGetString("Parent", "");
   }

   class="kw">protected int loadColor() {
      class="kw">return ColorUtil.hexString(this.mustGetString("Color", null));
   }

   class="kw">protected int loadRadius() {
      class="kw">return this.mustGetNumber("Radius", UniqueClimateJsonLoader.Constants.DEFAULT_RADIUS).intValue();
   }

   @Nonnull
   class="kw">protected Vector2i loadOrigin() {
      int var1 = this.mustGetNumber("OriginX", UniqueClimateJsonLoader.Constants.DEFAULT_OFFSET).intValue();
      int var2 = this.mustGetNumber("OriginY", UniqueClimateJsonLoader.Constants.DEFAULT_OFFSET).intValue();
      class="kw">return new Vector2i(var1, var2);
   }

   class="kw">protected int loadDistance() {
      class="kw">return this.mustGetNumber("Distance", UniqueClimateJsonLoader.Constants.DEFAULT_SEARCH_RADIUS).intValue();
   }

   class="kw">protected int loadMinDistance() {
      class="kw">return this.mustGetNumber("MinDistance", UniqueClimateJsonLoader.Constants.DEFAULT_SEARCH_MIN_RADIUS).intValue();
   }

   class="kw">protected ClimateSearch.Rule loadRule() {
      class="kw">return new ClimateRuleJsonLoader<>(this.seed, this.dataFolder, this.mustGetObject("Rule", null)).load();
   }

   class="kw">protected class="kw">interface Constants {
      String KEY_ZONE = "Name";
      String KEY_PARENT = "Parent";
      String KEY_COLOR = "Color";
      String KEY_RADIUS = "Radius";
      String KEY_ORIGIN_X = "OriginX";
      String KEY_ORIGIN_Y = "OriginY";
      String KEY_DISTANCE = "Distance";
      String KEY_MIN_DISTANCE = "MinDistance";
      String KEY_RULE = "Rule";
      Integer DEFAULT_RADIUS = 8;
      Integer DEFAULT_OFFSET = 8;
      Integer DEFAULT_SEARCH_RADIUS = 5000;
      Integer DEFAULT_SEARCH_MIN_RADIUS = 100;
   }
}