FileLoadingContext class
Пакет: com.hypixel.hytale.server.worldgen.loader.context
Файл: com/hypixel/hytale/server/worldgen/loader/context/FileLoadingContext.java
extends: FileContext<FileContext.RootContext>
Поля (4)
| Модификаторы | Тип | Имя |
|---|---|---|
|
String |
ERROR_INVALID_ID |
|
String |
ID_TYPE_BIOME |
|
String |
ID_TYPE_ZONE |
final |
FileContext.Registry<ZoneFileContext> |
zones |
Методы (9)
| Модификаторы | Возврат | Сигнатура |
|---|---|---|
|
|
if if(var0 < 0 || var0 <= var1) |
protected |
int |
nextBiomeIdint nextBiomeId() |
protected |
int |
nextZoneIdint nextZoneId() |
abstract |
|
super super(-1, var1, var2, FileContext.RootContext.INSTANCE) |
protected |
int |
updateBiomeIdint updateBiomeId(int var1) |
protected |
int |
updateZoneIdint updateZoneId(int var1) |
static |
void |
validateIdvoid validateId(int var0, int var1, String var2) |
abstract |
|
validateId validateId(var1, this.zoneIdCounter, "Zone") |
abstract |
|
validateId validateId(var1, this.biomeIdCounter, "Biome") |
Исходный код
Показать/скрыть
class="kw">package com.hypixel.hytale.server.worldgen.loader.context;
class="kw">import com.hypixel.hytale.server.worldgen.prefab.PrefabCategory;
class="kw">import java.nio.file.Path;
class="kw">import javax.annotation.Nonnull;
class="kw">public class FileLoadingContext class="kw">extends FileContext<FileContext.RootContext> {
class="kw">private class="kw">final FileContext.Registry<ZoneFileContext> zones = new FileContext.Registry<>("Zone");
class="kw">private class="kw">final FileContext.Registry<PrefabCategory> prefabCategories = new FileContext.Registry<>("Category");
class="kw">private int zoneIdCounter = -1;
class="kw">private int biomeIdCounter = -1;
class="kw">public FileLoadingContext(@Nonnull String var1, @Nonnull Path var2) {
super(-1, var1, var2, FileContext.RootContext.INSTANCE);
}
@Nonnull
class="kw">public FileContext.Registry<ZoneFileContext> getZones() {
class="kw">return this.zones;
}
@Nonnull
class="kw">public FileContext.Registry<PrefabCategory> getPrefabCategories() {
class="kw">return this.prefabCategories;
}
@Nonnull
class="kw">protected ZoneFileContext createZone(String var1, Path var2) {
class="kw">return this.createZone(this.nextZoneId(), var1, var2);
}
@Nonnull
class="kw">protected ZoneFileContext createZone(int var1, String var2, Path var3) {
class="kw">return new ZoneFileContext(this.updateZoneId(var1), var2, var3, this);
}
class="kw">protected int nextZoneId() {
class="kw">return this.zoneIdCounter + 1;
}
class="kw">protected int nextBiomeId() {
class="kw">return this.biomeIdCounter + 1;
}
class="kw">protected int updateZoneId(int var1) {
validateId(var1, this.zoneIdCounter, "Zone");
this.zoneIdCounter = var1;
class="kw">return var1;
}
class="kw">protected int updateBiomeId(int var1) {
validateId(var1, this.biomeIdCounter, "Biome");
this.biomeIdCounter = var1;
class="kw">return var1;
}
class="kw">protected class="kw">static void validateId(int var0, int var1, String var2) {
if (var0 < 0 || var0 <= var1) {
throw new Error(String.format("Invalid ID '%s' registered for type %s. Current ID counter: %s", var0, var2, var1));
}
}
class="kw">public class="kw">interface Constants {
String ID_TYPE_ZONE = "Zone";
String ID_TYPE_BIOME = "Biome";
String ERROR_INVALID_ID = "Invalid ID '%s' registered for type %s. Current ID counter: %s";
}
}