Constants interface
Пакет: com.hypixel.hytale.server.worldgen.loader.zone
Файл: com/hypixel/hytale/server/worldgen/loader/zone/ZoneCustomBiomesJsonLoader.java
Поля (5)
| Модификаторы | Тип | Имя |
|---|---|---|
|
String |
ERROR_BIOME_FAILED |
|
String |
ERROR_BIOME_FILES_NULL |
|
String |
ERROR_NO_CUSTOM_GENERATOR |
|
String |
FILE_CUSTOM_PREFIX |
|
String |
FILE_CUSTOM_SUFFIX |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.worldgen.loader.zone;
class="kw">import com.google.gson.JsonElement;
class="kw">import com.hypixel.hytale.procedurallib.file.FileIO;
class="kw">import com.hypixel.hytale.procedurallib.json.JsonLoader;
class="kw">import com.hypixel.hytale.procedurallib.json.SeedString;
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.CustomBiome;
class="kw">import com.hypixel.hytale.server.worldgen.biome.CustomBiomeGenerator;
class="kw">import com.hypixel.hytale.server.worldgen.loader.biome.CustomBiomeJsonLoader;
class="kw">import com.hypixel.hytale.server.worldgen.loader.context.BiomeFileContext;
class="kw">import com.hypixel.hytale.server.worldgen.loader.context.ZoneFileContext;
class="kw">import java.nio.file.Path;
class="kw">import java.util.Arrays;
class="kw">import java.util.Comparator;
class="kw">import java.util.Map.Entry;
class="kw">import javax.annotation.Nonnull;
class="kw">public class ZoneCustomBiomesJsonLoader class="kw">extends JsonLoader<SeedStringResource, CustomBiome[]> {
class="kw">private class="kw">static class="kw">final Comparator<CustomBiome> PRIORITY_SORTER = (var0, var1) -> Integer.compare(
var1.getCustomBiomeGenerator().getPriority(), var0.getCustomBiomeGenerator().getPriority()
);
class="kw">protected class="kw">final ZoneFileContext zoneContext;
class="kw">protected class="kw">final Biome[] tileBiomes;
class="kw">public ZoneCustomBiomesJsonLoader(SeedString<SeedStringResource> var1, Path var2, JsonElement var3, ZoneFileContext var4, Biome[] var5) {
super(var1, var2, var3);
this.zoneContext = var4;
this.tileBiomes = var5;
}
@Nonnull
class="kw">public CustomBiome[] load() {
int var1 = 0;
CustomBiome[] var2 = new CustomBiome[this.zoneContext.getCustomBiomes().size()];
for (Entry var4 : this.zoneContext.getCustomBiomes()) {
BiomeFileContext var5 = var4.getValue();
try {
JsonElement var6 = (JsonElement)FileIO.load(var5.getPath(), JsonLoader.JSON_OBJ_LOADER);
CustomBiome var7 = new CustomBiomeJsonLoader(this.seed, this.dataFolder, var6, var5, this.tileBiomes).load();
CustomBiomeGenerator var8 = var7.getCustomBiomeGenerator();
if (var8 == null) {
throw new NullPointerException(var5.getPath().toAbsolutePath().toString());
}
var2[var1++] = var7;
} catch (Throwable var9) {
throw new Error(String.format("Error while loading custom biome \"%s\" from \"%s\"", var5.getName(), var5.getPath().toString()), var9);
}
}
Arrays.sort(var2, PRIORITY_SORTER);
class="kw">return var2;
}
class="kw">public class="kw">interface Constants {
String ERROR_BIOME_FILES_NULL = "Biome files error occured.";
String ERROR_BIOME_FAILED = "Error while loading custom biome \"%s\" from \"%s\"";
String ERROR_NO_CUSTOM_GENERATOR = "Could not find custom biome generator for custom biome \"%s\" at \"%s\"";
String FILE_CUSTOM_PREFIX = "Custom.";
String FILE_CUSTOM_SUFFIX = ".json";
}
}