Interface Generator

All Known Implementing Classes:
FlatGenerator, StandardGenerator, VoidGenerator

public interface Generator
Generates terrain in a level.

An implementation of Generator is expected to be able to generate and populate chunks on multiple threads concurrently.

Author:
DaPorkchop_
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    finish​(net.daporkchop.lib.random.PRandom random, org.cloudburstmc.api.level.ChunkManager level, int chunkX, int chunkZ)
    Finishes a given chunk.
    void
    generate​(net.daporkchop.lib.random.PRandom random, org.cloudburstmc.api.level.chunk.Chunk chunk, int chunkX, int chunkZ)
    Generates a given chunk.
    void
    populate​(net.daporkchop.lib.random.PRandom random, org.cloudburstmc.api.level.ChunkManager level, int chunkX, int chunkZ)
    Populates a given chunk.
  • Method Details

    • generate

      void generate(net.daporkchop.lib.random.PRandom random, org.cloudburstmc.api.level.chunk.Chunk chunk, int chunkX, int chunkZ)
      Generates a given chunk.
      Parameters:
      random - an instance of PRandom for generating random numbers, initialized with a seed based on chunk's position
      chunk - the chunk to generate
      chunkX - the chunk's X coordinate
      chunkZ - the chunk's Z coordinate
    • populate

      void populate(net.daporkchop.lib.random.PRandom random, org.cloudburstmc.api.level.ChunkManager level, int chunkX, int chunkZ)
      Populates a given chunk.
      Parameters:
      random - an instance of PRandom for generating random numbers, initialized with a seed based on chunk's position
      level - a ChunkManager containing only a 3x3 square of generated chunks, centered around the chunk being populated
      chunkX - the chunk's X coordinate
      chunkZ - the chunk's Z coordinate
    • finish

      void finish(net.daporkchop.lib.random.PRandom random, org.cloudburstmc.api.level.ChunkManager level, int chunkX, int chunkZ)
      Finishes a given chunk.

      This is identical in every respect to population, except it requires that the chunk and all of its neighbors have been populated rather than generated. This phase is intended for things like placing a layer of snow over cold biomes, where overlapping blocks from populated neighbors can cause inconsistent/unexpected results.

      Parameters:
      random - an instance of PRandom for generating random numbers, initialized with a seed based on chunk's position
      level - a ChunkManager containing only a 3x3 square of generated chunks, centered around the chunk being populated
      chunkX - the chunk's X coordinate
      chunkZ - the chunk's Z coordinate