Options
All
• Public
• Public/Protected
• All

# Namespace GenerationUtils

Module used to simplify generation tasks in mods logic

## Functions

### canSeeSky

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

#### Returns boolean

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

### findHighSurface

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

### findLowSurface

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

### findSurface

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

### genMinable

• 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

#### Parameters

• ##### 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

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``

### generateOre

• 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

• ##### id: number

ore tile id

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

### generateOreCustom

• 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

• ##### 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

### getPerlinNoise

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

#### Parameters

• ##### 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

### isTerrainBlock

• isTerrainBlock(id: number): boolean
• #### Parameters

• ##### id: number

numeric tile id

#### Returns boolean

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

### isTransparentBlock

• isTransparentBlock(id: number): boolean
• #### Parameters

• ##### id: number

numeric tile id

#### Returns boolean

true if block is transparent, false otherwise

### lockInBlock

• lockInBlock(id: number, data: number, checkerTile: any, checkerMode: any): void

### randomCoords

• 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

### randomXZ

• 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

### setLockedBlock

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

#### Returns void

Generated using TypeDoc