Class ChunkGenerator

java.lang.Object
com.hypixel.hytale.server.worldgen.chunk.ChunkGenerator
All Implemented Interfaces:
MetricProvider, IBenchmarkableWorldGen, IWorldGen, ValidatableWorldGen, IWorldMapProvider

public class ChunkGenerator extends Object implements IBenchmarkableWorldGen, ValidatableWorldGen, MetricProvider, IWorldMapProvider
Since:
22.02.2016
  • Field Details

    • TINT_INTERPOLATION_RADIUS

      public static final int TINT_INTERPOLATION_RADIUS
      TODO Replace by biome specific values
      See Also:
    • POOL_SIZE

      public static final int POOL_SIZE
  • Constructor Details

  • Method Details

    • getZonePatternProvider

      public ZonePatternProvider getZonePatternProvider()
      Returns local ZonePatternProvider
      Returns:
      ZonePatternGenerator
    • getTimings

      public WorldGenTimingsCollector getTimings()
      Specified by:
      getTimings in interface IWorldGen
    • getGenerator

      @Nonnull public IWorldMap getGenerator(World world) throws WorldMapLoadException
      Specified by:
      getGenerator in interface IWorldMapProvider
      Throws:
      WorldMapLoadException
    • getSpawnPoints

      public Transform[] getSpawnPoints(int seed)
      Specified by:
      getSpawnPoints in interface IWorldGen
    • getBenchmark

      @Nonnull public ChunkWorldgenBenchmark getBenchmark()
      Specified by:
      getBenchmark in interface IBenchmarkableWorldGen
    • getDataFolder

      public Path getDataFolder()
    • getCoreData

      @Nullable public CoreDataCacheEntry getCoreData(int seed, int x, int z)
    • getZonePatternGenerator

      @Nonnull public ZonePatternGenerator getZonePatternGenerator(int seed)
    • getZoneBiomeResultAt

      public ZoneBiomeResult getZoneBiomeResultAt(int seed, int x, int z)
      Proxies #generateZoneBiomeResultAt(x, z) over the local ZoneBiomeGeneratorCache.
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      ZoneBiomeResult of X and Z location
      See Also:
    • getHeight

      public int getHeight(int seed, int x, int z)
      Returns the height of the block column at a certain x and z coordinate
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      Height at X, Z
      See Also:
    • putHeight

      public void putHeight(int seed, int x, int z, int y)
      Put a certain height into the cache. This should allow some cases to not generate the height since we already have it when filling the world with layers.
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      y - Height
      See Also:
    • getInterpolatedBiomeCountAt

      @Nullable public InterpolatedBiomeCountList getInterpolatedBiomeCountAt(int seed, int x, int z)
      Proxies #generateInterpolatedBiomeCountAt(x, z) over the local BiomeCountGeneratorCache.
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      List of all biomes in interpolation radius.
      See Also:
    • getCave

      @Nullable public Cave getCave(@Nonnull CaveType caveType, int seed, int x, int z)
      Returns the cave at a certain X, Z.
      Parameters:
      caveType - the cave type
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      Cached Cave
      See Also:
    • getPrefabLoadingCache

      @Nonnull public PrefabLoadingCache getPrefabLoadingCache()
    • getUniquePrefabs

      @Nullable public UniquePrefabContainer.UniquePrefabEntry[] getUniquePrefabs(int seed)
    • generate

      @Nonnull public CompletableFuture<GeneratedChunk> generate(int seed, long index, int x, int z, @Nullable LongPredicate stillNeeded, it.unimi.dsi.fastutil.longs.Long2FloatFunction priority)
      Specified by:
      generate in interface IWorldGen
    • shutdown

      public void shutdown()
      Specified by:
      shutdown in interface IWorldGen
    • generateZoneBiomeResultAt

      @Nonnull public ZoneBiomeResult generateZoneBiomeResultAt(int seed, int x, int z)
      Usually only called by the ChunkGeneratorCache. Heavy operation going through all levels of generation.
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      ZoneBiomeResult of X and Z location
      See Also:
    • generateZoneBiomeResultAt

      @Nonnull public ZoneBiomeResult generateZoneBiomeResultAt(int seed, int x, int z, @Nonnull ZoneBiomeResult result)
    • generateInterpolatedBiomeCountAt

      public void generateInterpolatedBiomeCountAt(int seed, int x, int z, @Nonnull InterpolatedBiomeCountList biomeCountList)
      Generates a list of a count of all biomes within the given radius.
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      biomeCountList - InterpolatedBiomeCountList
    • generateLowestThresholdDependent

      public int generateLowestThresholdDependent(@Nonnull InterpolatedBiomeCountList biomeCounts)
    • generateHighestThresholdDependent

      public int generateHighestThresholdDependent(@Nonnull InterpolatedBiomeCountList biomeCounts)
      Parameters:
      biomeCounts -
      Returns:
    • generateInterpolatedThreshold

      public static float generateInterpolatedThreshold(int seed, int x, int z, int y, @Nonnull InterpolatedBiomeCountList biomeCounts)
    • generateInterpolatedHeightNoise

      public double generateInterpolatedHeightNoise(@Nonnull InterpolatedBiomeCountList biomeCounts)
      Parameters:
      biomeCounts -
      Returns:
    • generateHeight

      public int generateHeight(int seed, int x, int z)
      Generates the height at a certain X, Z coordinate. Usually only called by the ChunkGeneratorCache
      Parameters:
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      Height at X, Z
      See Also:
    • generateHeightBetween

      public int generateHeightBetween(int seed, int x, int z, @Nonnull IHeightThresholdInterpreter interpreter)
    • generateCave

      @Nullable public Cave generateCave(@Nonnull CaveType caveType, int seed, int x, int z)
      Generates a cave at a certain X, Z coordinate. Usually only called by CaveGeneratorCache
      Parameters:
      caveType - the cave type
      x - X-Coordinate
      z - Z-Coordinate
      Returns:
      Generated Cave
      See Also:
    • generateUniquePrefabs

      @Nonnull public UniquePrefabContainer.UniquePrefabEntry[] generateUniquePrefabs(int seed)
    • run

      @Deprecated(forRemoval=true, since="2026-06-16") @Nonnull public CompletableFuture<Void> run(int seed, @Nonnull IntObjectConsumer<ChunkGenerator> consumer)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This is only here as a temporary measure to fix issues in some other deprecated code. Do not use.
      Runs the given consumer asynchronously on the ChunkGenerator's executor using the specified seed and this chunk generator.
      Parameters:
      seed - the seed value to be supplied to the consumer.
      consumer - the consumer that takes the seed and the current instance of ChunkGenerator.
      Returns:
      a CompletableFuture representing the result of the function execution.
    • execute

      @Deprecated(forRemoval=true, since="2026-06-16") @Nonnull public <T> CompletableFuture<T> execute(int seed, @Nonnull IntObjectFunction<ChunkGenerator, T> function)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This is only here as a temporary measure to fix issues in some other deprecated code. Do not use.
      Executes the given function asynchronously on the ChunkGenerator's executor using the provided seed and this chunk generator.
      Type Parameters:
      T - the type of result produced by the function.
      Parameters:
      seed - the seed value to be passed to the function.
      function - a function that takes the seed and this chunk generator to produce a result.
      Returns:
      a CompletableFuture representing the result of the function execution.
    • getResource

      public static ChunkGeneratorResource getResource()
      Returns the ChunkGeneratorResource of the current thread. That allows to have a very fast way to use Thread local variables and save allocations.
      Returns:
      ChunkGeneratorResource of current Thread
      See Also:
    • isChunkOutsideGeneratableArea

      public boolean isChunkOutsideGeneratableArea(int x, int z)
      Determines if the given chunk coordinate is outside the generatable area supported by this generator.
      Parameters:
      x - The chunk x coordinate
      z - The chunk z coordinate
      Returns:
      true if the chunk is outside the generatable area, false if inside.
    • validate

      public boolean validate()
      Specified by:
      validate in interface ValidatableWorldGen
    • toMetricResults

      @Nonnull public MetricResults toMetricResults()
      Specified by:
      toMetricResults in interface MetricProvider
    • toString

      @Nonnull public String toString(boolean timings, boolean zonePatternGenerator)
    • toString

      @Nonnull public String toString()
      Overrides:
      toString in class Object