BasicHeightThresholdInterpreterJsonLoader class

Пакет: com.hypixel.hytale.procedurallib.json

Файл: com/hypixel/hytale/procedurallib/json/BasicHeightThresholdInterpreterJsonLoader.java

extends: JsonLoader<K, BasicHeightThresholdInterpreter>

Поля (9)

МодификаторыТипИмя
String ERROR_NO_POSITIONS
String ERROR_NO_VALUES
String KEY_POSITIONS
String KEY_VALUES
final int length
JsonArray var1
JsonArray var1
int[] var2
float[] var2

Методы (6)

МодификаторыВозвратСигнатура
abstract throw new IllegalStateExceptionthrow new IllegalStateException("Could not find position data in HeightThresholdInterpreter. Keyword: Positions")
abstract throw new IllegalStateExceptionthrow new IllegalStateException("Could not find value data in HeightThresholdInterpreter. Keyword: Values")
for for(int var3 = 0; var3 < var2.length; var3++)
for for(int var3 = 0; var3 < var2.length; var3++)
protected int[] loadPositionsint[] loadPositions()
protected float[] loadValuesfloat[] loadValues()

Исходный код

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

class="kw">import com.google.gson.JsonArray;
class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.procedurallib.condition.BasicHeightThresholdInterpreter;
class="kw">import java.nio.file.Path;
class="kw">import javax.annotation.Nonnull;

class="kw">public class BasicHeightThresholdInterpreterJsonLoader<K class="kw">extends SeedResource> class="kw">extends JsonLoader<K, BasicHeightThresholdInterpreter> {
   class="kw">protected class="kw">final int length;

   class="kw">public BasicHeightThresholdInterpreterJsonLoader(@Nonnull SeedString<K> var1, Path var2, JsonElement var3, int var4) {
      super(var1.append(".BasicHeightThresholdInterpreter"), var2, var3);
      this.length = var4;
   }

   @Nonnull
   class="kw">public BasicHeightThresholdInterpreter load() {
      class="kw">return new BasicHeightThresholdInterpreter(this.loadPositions(), this.loadValues(), this.length);
   }

   class="kw">protected int[] loadPositions() {
      if (!this.has("Positions")) {
         throw new IllegalStateException("Could not find position data in HeightThresholdInterpreter. Keyword: Positions");
      }

      JsonArray var1 = this.get("Positions").getAsJsonArray();
      int[] var2 = new int[var1.size()];

      for (int var3 = 0; var3 < var2.length; var3++) {
         var2[var3] = var1.get(var3).getAsInt();
      }

      class="kw">return var2;
   }

   class="kw">protected float[] loadValues() {
      if (!this.has("Values")) {
         throw new IllegalStateException("Could not find value data in HeightThresholdInterpreter. Keyword: Values");
      }

      JsonArray var1 = this.get("Values").getAsJsonArray();
      float[] var2 = new float[var1.size()];

      for (int var3 = 0; var3 < var2.length; var3++) {
         var2[var3] = var1.get(var3).getAsFloat();
      }

      class="kw">return var2;
   }

   class="kw">public class="kw">interface Constants {
      String KEY_POSITIONS = "Positions";
      String KEY_VALUES = "Values";
      String ERROR_NO_POSITIONS = "Could not find position data in HeightThresholdInterpreter. Keyword: Positions";
      String ERROR_NO_VALUES = "Could not find value data in HeightThresholdInterpreter. Keyword: Values";
   }
}