HyCodeYourTale
classpublicPriority 3

TileBiomeJsonLoader

com.hypixel.hytale.server.worldgen.loader.biome.TileBiomeJsonLoader

extends BiomeJsonLoader

1

Methods

1

Public Methods

0

Fields

1

Constructors

Constructors

public
TileBiomeJsonLoader(SeedString<SeedStringResource> seed, Path dataFolder, JsonElement json, BiomeFileContext biomeContext)

Methods

Public Methods (1)

public
TileBiome load()
@Nonnull

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.biome;

import com.google.gson.JsonElement;
import com.hypixel.hytale.procedurallib.json.SeedString;
import com.hypixel.hytale.server.worldgen.SeedStringResource;
import com.hypixel.hytale.server.worldgen.biome.TileBiome;
import com.hypixel.hytale.server.worldgen.loader.context.BiomeFileContext;
import java.nio.file.Path;
import javax.annotation.Nonnull;

public class TileBiomeJsonLoader extends BiomeJsonLoader {
   public TileBiomeJsonLoader(@Nonnull SeedString<SeedStringResource> seed, Path dataFolder, JsonElement json, @Nonnull BiomeFileContext biomeContext) {
      super(seed.append(String.format(".TileBiome-%s", biomeContext.getName())), dataFolder, json, biomeContext);
   }

   @Nonnull
   public TileBiome load() {
      return new TileBiome(
         this.biomeContext.getId(),
         this.biomeContext.getName(),
         this.loadInterpolation(),
         this.loadTerrainHeightThreshold(),
         this.loadCoverContainer(),
         this.loadLayerContainers(),
         this.loadPrefabContainer(),
         this.loadTintContainer(),
         this.loadEnvironmentContainer(),
         this.loadWaterContainer(),
         this.loadFadeContainer(),
         this.loadHeightmapNoise(),
         this.loadWeight(),
         this.loadSizeModifier(),
         this.loadColor()
      );
   }

   protected double loadWeight() {
      double weight = 1.0;
      if (this.has("Weight")) {
         weight = this.get("Weight").getAsDouble();
      }

      return weight;
   }

   protected double loadSizeModifier() {
      double sizeModifier = 1.0;
      if (this.has("SizeModifier")) {
         sizeModifier = this.get("SizeModifier").getAsDouble();
      }

      return sizeModifier * sizeModifier;
   }

   public interface Constants {
      String KEY_WEIGHT = "Weight";
      String KEY_SIZE_MODIFIER = "SizeModifier";
      String SEED_PREFIX = ".TileBiome-%s";
   }
}