HyCodeYourTale
classpublicPriority 3

CavePrefabEntryJsonLoader

com.hypixel.hytale.server.worldgen.loader.cave.CavePrefabEntryJsonLoader

extends JsonLoader

1

Methods

1

Public Methods

1

Fields

1

Constructors

Constructors

public
CavePrefabEntryJsonLoader(SeedString<SeedStringResource> seed, Path dataFolder, JsonElement json, ZoneFileContext zoneContext)

Methods

Public Methods (1)

public
CavePrefabContainer.CavePrefabEntry load()
@Nonnull

Fields

Private/Package Fields (1)

privateZoneFileContext zoneContext

Inheritance

Parent
Current
Interface
Child

Use mouse wheel to zoom, drag to pan. Click nodes to navigate.

Related Classes

Source Code

package com.hypixel.hytale.server.worldgen.loader.cave;

import com.google.gson.JsonElement;
import com.hypixel.hytale.common.map.IWeightedMap;
import com.hypixel.hytale.procedurallib.json.JsonLoader;
import com.hypixel.hytale.procedurallib.json.SeedString;
import com.hypixel.hytale.server.worldgen.SeedStringResource;
import com.hypixel.hytale.server.worldgen.cave.prefab.CavePrefabContainer;
import com.hypixel.hytale.server.worldgen.loader.WorldGenPrefabSupplier;
import com.hypixel.hytale.server.worldgen.loader.context.ZoneFileContext;
import com.hypixel.hytale.server.worldgen.loader.prefab.WeightedPrefabMapJsonLoader;
import java.nio.file.Path;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public class CavePrefabEntryJsonLoader extends JsonLoader<SeedStringResource, CavePrefabContainer.CavePrefabEntry> {
   private final ZoneFileContext zoneContext;

   public CavePrefabEntryJsonLoader(@Nonnull SeedString<SeedStringResource> seed, Path dataFolder, JsonElement json, ZoneFileContext zoneContext) {
      super(seed.append(".CavePrefabEntry"), dataFolder, json);
      this.zoneContext = zoneContext;
   }

   @Nonnull
   public CavePrefabContainer.CavePrefabEntry load() {
      return new CavePrefabContainer.CavePrefabEntry(this.loadPrefabs(), this.loadConfig());
   }

   @Nullable
   protected IWeightedMap<WorldGenPrefabSupplier> loadPrefabs() {
      return new WeightedPrefabMapJsonLoader(this.seed, this.dataFolder, this.json, "Prefab", "Weight").load();
   }

   @Nonnull
   protected CavePrefabContainer.CavePrefabEntry.CavePrefabConfig loadConfig() {
      return new CavePrefabConfigJsonLoader(this.seed, this.dataFolder, this.get("Config"), this.zoneContext).load();
   }

   public interface Constants {
      String KEY_PREFAB = "Prefab";
      String KEY_WEIGHT = "Weight";
      String KEY_CONFIG = "Config";
   }
}