Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace GenerationUtils

Module used to simplify generation tasks in mods logic

Index

Functions

  • canSeeSky(x: number, y: number, z: number): boolean
  • Parameters

    • x: number
    • y: number
    • z: number

    Returns boolean

    true, if one can see sky from the specified position, false otherwise

  • findHighSurface(x: number, z: number): Vector
  • Finds nearest to y=128 coordinate empty space on the specified x and z coordinates

    Parameters

    • x: number
    • z: number

    Returns Vector

  • findLowSurface(x: number, z: number): Vector
  • Finds nearest to y=64 coordinate empty space on the specified x and z coordinates

    Parameters

    • x: number
    • z: number

    Returns Vector

  • findSurface(x: number, y: number, z: number): Vector
  • Finds nearest to the specified y coordinate empty space on the specified x and z coordinates

    Parameters

    • x: number
    • y: number
    • z: number

    Returns Vector

  • genMinable(x: number, y: number, z: number, params: { amount?: number; data: number; id: number; noStoneCheck: number; ratio?: number; size?: number }): void
  • Generates ore vein on the specified coordinates using specified params

    deprecated

    Consider using GenerationUtils.generateOre instead

    Parameters

    • x: number
    • y: number
    • z: number
    • params: { amount?: number; data: number; id: number; noStoneCheck: number; ratio?: number; size?: number }

      generation params

      • Optional amount?: number

        amount of the ore to be generated

      • data: number

        ore data

      • id: number

        ore tile id

      • noStoneCheck: number

        if true, no check for stone is performed so the ore may be generated in the air. Use this to debug ore generation in the superflat worlds

      • Optional ratio?: number

        if amount is not specified, used to calculate amount

      • Optional size?: number

        if amount is not specified, used to calculate amount, using simple formula

        size * ratio * 3
        

    Returns void

  • generateOre(x: number, y: number, z: number, id: number, data: number, amount: number, noStoneCheck: boolean, seed?: number): void
  • Generates ore vein on the specified coordinates

    Parameters

    • x: number
    • y: number
    • z: number
    • id: number

      ore tile id

    • data: number

      ore data

    • amount: number

      ore amount, use number at least 6 to be able to find generated ore. Note that amount doesn't mean blocks count, it is just an input value for generation algorithm

    • noStoneCheck: boolean

      if true, no check for stone is performed so the ore may be generated in the air. Use this to debug ore generation in the superflat worlds

    • Optional seed: number

      random generation seed

    Returns void

  • generateOreCustom(x: number, y: number, z: number, id: number, data: number, amount: number, mode: boolean, listOfIds: number[], seed?: number): void
  • Generates ore with custom whitelist/blacklist, see GenerationUtils.generateOre for details

    Parameters

    • x: number
    • y: number
    • z: number
    • id: number
    • data: number
    • amount: number
    • mode: boolean

      if true, specified block ids are used as whitelist for generation (only the ids from the list can be replaced with ores), if false - specified block ids are used as a blacklist (only the ids from the list canNOT be replaced with ores)

    • listOfIds: number[]

      array of block ids to be used as whitelist or blacklist

    • Optional seed: number

    Returns void

  • getPerlinNoise(x: number, y: number, z: number, seed?: number, scale?: number, numOctaves?: number): number
  • Retrieves perlin noise value at the specified coordinates

    Parameters

    • x: number
    • y: number
    • z: number
    • Optional seed: number

      integer random generator seed. If not specified or set to 0, the default constant value is used

    • Optional scale: number

      noise size, to set the main octave size, use 1 / octave size

    • Optional numOctaves: number

      number of octaves, the more octaves you use, the more detailed is the generated noise. The next octave is two times smaller then the previous one

    Returns number

  • isTerrainBlock(id: number): boolean
  • Parameters

    • id: number

      numeric tile id

    Returns boolean

    true if block is solid and light blocking block, false otherwise

  • isTransparentBlock(id: number): boolean
  • Parameters

    • id: number

      numeric tile id

    Returns boolean

    true if block is transparent, false otherwise

  • lockInBlock(id: number, data: number, checkerTile: any, checkerMode: any): void
  • randomCoords(cx: number, cz: number, lowest?: number, highest?: number): Vector
  • Generates random coordinates inside specified chunk

    Parameters

    • cx: number

      chunk x coordinate

    • cz: number

      chunk z coordinate

    • Optional lowest: number

      lowest possible y coordinate. Default is 0

    • Optional highest: number

      highest possible y coordinate. Default is 128

    Returns Vector

  • randomXZ(cx: number, cz: number): { x: number; z: number }
  • Generates random x and z coordinates inside specified chunk

    Parameters

    • cx: number

      chunk x coordinate

    • cz: number

      chunk z coordinate

    Returns { x: number; z: number }

    • x: number
    • z: number
  • setLockedBlock(x: number, y: number, z: number): void

Generated using TypeDoc