Class Cubiomes

java.lang.Object
de.rasmusantons.cubiomes.Cubiomes

public class Cubiomes extends Object
Biome Generation
  • Field Details

  • Constructor Details

  • Method Details

    • applySeed

      public void applySeed(Dimension dimension, long seed)
      Initializes the generator for a given dimension and seed.
    • getBiomeAt

      public BiomeID getBiomeAt(int scale, int x, int y, int z)
      Gets the biome for a specified scaled position. Note that the scale should be either 1 or 4, for block or biome coordinates respectively.

      Before calling, applySeed(Dimension, long) should be used to set dimension and seed.

      Returns:
      BiomeID.none upon failure
    • genBiomes

      public BiomeID[][][] genBiomes(Range r)
      Generates the biomes for a cuboidal scaled range given by 'r'.
      Returns:
      A 3-dimensional array of BiomeIDs or null upon failure. The output can be indexed as output[y][z][x] where (x,y,z) is a relative position inside the range cuboid.
    • genBiomes2D

      public BiomeID[][] genBiomes2D(Range r)
      Same as genBiomes(Range), except that the y-size needs to be 1.
      Returns:
      A 2-dimensional array of BiomeIDs or null upon failure. The output can be indexed as output[z][x] where (x,0,z) is a relative position inside the range cuboid.
      Throws:
      InvalidParameterException - if r.sy is not 1.
    • getStructurePos

      public Pos getStructurePos(StructureType structureType, long seed, int regX, int regZ)
      Finds the block position of the structure generation attempt in a given region. You can use isViableStructurePos(StructureType, int, int) to test if the necessary biome requirements are met for the structure to actually generate at that position. Some structure types may fail to produce a valid position in the given region regardless of biomes, in which case the function returns null.
      Parameters:
      structureType - structure type
      seed - world seed (only the lower 48-bits are relevant)
      regX - x coordinate of the region (the region size depends on type)
      regZ - z coordinate of the region (the region size depends on type)
      Returns:
      the block position of the structure
    • isViableStructurePos

      public boolean isViableStructurePos(StructureType structType, int blockX, int blockZ)
      Performs a biome check near the specified block coordinates to determine whether a structure of the given type could spawn there. You can get the block positions using getStructurePos(StructureType, long, int, int).

      Before calling, applySeed(Dimension, long) should be used to set dimension and seed.

    • checkForBiomes

      public boolean checkForBiomes(Range r, Dimension dim, long seed, BiomeFilter filter)
      Starts to generate the specified range and checks if the biomes meet the requirements of the biome filter.

      The generator should be set up for the correct version, however the dimension and seed will be applied internally. This will modify the generator into a partially initialized state that is not valid to use outside this function without re-applying a seed.