Constants interface

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

Файл: com/hypixel/hytale/server/worldgen/loader/cave/shape/DistortedCaveNodeShapeGeneratorJsonLoader.java

Поля (14)

МодификаторыТипИмя
GeneralNoise.InterpolationFunction DEFAULT_INTERPOLATION
DistortedShape.Factory DEFAULT_SHAPE
String KEY_DISTORTION
String KEY_HEIGHT
String KEY_INHERIT_PARENT_RADIUS
String KEY_INTERPOLATION
String KEY_LENGTH
String KEY_MID_HEIGHT
String KEY_MID_WIDTH
String KEY_RADIUS_X
String KEY_RADIUS_Y
String KEY_RADIUS_Z
String KEY_SHAPE
String KEY_WIDTH

Исходный код

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

class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.procedurallib.json.DoubleRangeJsonLoader;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
class="kw">import com.hypixel.hytale.procedurallib.logic.GeneralNoise;
class="kw">import com.hypixel.hytale.procedurallib.supplier.IDoubleRange;
class="kw">import com.hypixel.hytale.server.worldgen.SeedStringResource;
class="kw">import com.hypixel.hytale.server.worldgen.cave.shape.CaveNodeShapeEnum;
class="kw">import com.hypixel.hytale.server.worldgen.cave.shape.DistortedCaveNodeShape;
class="kw">import com.hypixel.hytale.server.worldgen.cave.shape.distorted.DistortedShape;
class="kw">import com.hypixel.hytale.server.worldgen.cave.shape.distorted.DistortedShapes;
class="kw">import com.hypixel.hytale.server.worldgen.cave.shape.distorted.ShapeDistortion;
class="kw">import java.nio.file.Path;
class="kw">import javax.annotation.Nonnull;
class="kw">import javax.annotation.Nullable;

class="kw">public class DistortedCaveNodeShapeGeneratorJsonLoader class="kw">extends CaveNodeShapeGeneratorJsonLoader {
   class="kw">public DistortedCaveNodeShapeGeneratorJsonLoader(@Nonnull SeedString<SeedStringResource> var1, Path var2, JsonElement var3) {
      super(var1.append(".DistortedCaveNodeShape"), var2, var3);
   }

   @Nonnull
   class="kw">public CaveNodeShapeEnum.CaveNodeShapeGenerator load() {
      class="kw">return new DistortedCaveNodeShape.DistortedCaveNodeShapeGenerator(
         this.loadShape(),
         this.loadWidth(),
         this.loadHeight(),
         this.loadMidWidth(),
         this.loadMidHeight(),
         this.loadLength(),
         this.loadInheritParentRadius(),
         this.loadShapeDistortion(),
         this.loadInterpolation()
      );
   }

   @Nonnull
   class="kw">private DistortedShape.Factory loadShape() {
      if (this.has("Shape")) {
         DistortedShape.Factory var1 = DistortedShapes.getByName(this.get("Shape").getAsString());
         if (var1 != null) {
            class="kw">return var1;
         }
      }

      class="kw">return DistortedCaveNodeShapeGeneratorJsonLoader.Constants.DEFAULT_SHAPE;
   }

   @Nullable
   class="kw">private IDoubleRange loadWidth() {
      class="kw">return this.has("RadiusX")
         ? new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("RadiusX"), 3.0).load()
         : new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("Width"), 3.0).load();
   }

   @Nullable
   class="kw">private IDoubleRange loadHeight() {
      class="kw">return this.has("RadiusY")
         ? new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("RadiusY"), 3.0).load()
         : new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("Height"), 3.0).load();
   }

   @Nullable
   class="kw">private IDoubleRange loadMidWidth() {
      IDoubleRange var1 = null;
      if (this.has("MiddleWidth")) {
         var1 = new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("MiddleWidth"), 0.0).load();
      }

      class="kw">return var1;
   }

   @Nullable
   class="kw">private IDoubleRange loadMidHeight() {
      IDoubleRange var1 = null;
      if (this.has("MiddleHeight")) {
         var1 = new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("MiddleHeight"), 0.0).load();
      }

      class="kw">return var1;
   }

   @Nullable
   class="kw">private IDoubleRange loadLength() {
      if (this.has("RadiusZ")) {
         class="kw">return new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("RadiusZ"), 3.0).load();
      }

      IDoubleRange var1 = null;
      if (this.has("Length")) {
         var1 = new DoubleRangeJsonLoader<>(this.seed, this.dataFolder, this.get("Length"), 5.0, 15.0).load();
      }

      class="kw">return var1;
   }

   class="kw">private boolean loadInheritParentRadius() {
      boolean var1 = true;
      if (this.has("InheritParentRadius")) {
         var1 = this.get("InheritParentRadius").getAsBoolean();
      }

      class="kw">return var1;
   }

   @Nullable
   class="kw">private ShapeDistortion loadShapeDistortion() {
      ShapeDistortion var1 = ShapeDistortion.DEFAULT;
      if (this.has("Distortion")) {
         var1 = new ShapeDistortionJsonLoader<>(this.seed, this.dataFolder, this.get("Distortion")).load();
      }

      class="kw">return var1;
   }

   class="kw">private GeneralNoise.InterpolationFunction loadInterpolation() {
      GeneralNoise.InterpolationFunction var1 = DistortedCaveNodeShapeGeneratorJsonLoader.Constants.DEFAULT_INTERPOLATION;
      if (this.has("Interpolation")) {
         var1 = GeneralNoise.InterpolationMode.valueOf(this.get("Interpolation").getAsString()).function;
      }

      class="kw">return var1;
   }

   class="kw">public class="kw">interface Constants {
      String KEY_SHAPE = "Shape";
      String KEY_WIDTH = "Width";
      String KEY_HEIGHT = "Height";
      String KEY_MID_WIDTH = "MiddleWidth";
      String KEY_MID_HEIGHT = "MiddleHeight";
      String KEY_LENGTH = "Length";
      String KEY_RADIUS_X = "RadiusX";
      String KEY_RADIUS_Y = "RadiusY";
      String KEY_RADIUS_Z = "RadiusZ";
      String KEY_INHERIT_PARENT_RADIUS = "InheritParentRadius";
      String KEY_DISTORTION = "Distortion";
      String KEY_INTERPOLATION = "Interpolation";
      DistortedShape.Factory DEFAULT_SHAPE = DistortedShapes.getDefault();
      GeneralNoise.InterpolationFunction DEFAULT_INTERPOLATION = GeneralNoise.InterpolationMode.LINEAR.function;
   }
}