World Presets, Chunk Generators, & Dimension Types
World Preset
World presets determine the dimensions of a world by mapping a the id of the dimension to its dimension type and chunk generator. WorldJS adds the ability to create world presets through KubeJS’s ServerEvents.registry('worldgen/world_preset', event => {}) event via the default (no type id) builder
: Adds a dimension to the preset.withDimension(id: ResourceKey<LevelStem>, dimensionType: Holder$Reference<DimensionType>, generatorType: ResourceLocation, generatorBuilder: Consumer<ChunkGeneratorBuilder>)id: ResourceKey<LevelStem>: The id of the dimensiondimensionType: Holder$Reference<Dimensiontype>: The id of the dimension type to use for the dimensiongeneratorType: ResourceLocation: The id of a chunk generator builder typegeneratorBuilder: Consumer<ChunkGeneratorBuilder>: A callback to edit the properties of the chunk generator builder- The methods available will depend on the
generatorType
- The methods available will depend on the
- Note: A
minecraft:overworlddimension must be set for the preset to be valid
: Add the preset to the.addToNormalPresetList()minecraft:normaltag so it can be selected in the create world screen: Add the preset to the
minecraft:extendedtag so it is available in the create world screen as a hidden preset
: Makes this preset be selected by default in the create world screen.asDefaultPreset()
Example
ServerEvents.registry('worldgen/world_preset', event => {
event.create('cave_world')
.withDimension(
'minecraft:overworld',
'minecraft:overworld_caves',
'minecraft:noise',
generator => generator
.noiseSettings('minecraft:caves')
.biomeSource(
'minecraft:multi_noise',
biomeSource => biomeSource
.usingParameters(climate => {
climate.forBiome('minecraft:plains')
.depth(0, 2)
.continentalness(0, 2)
.erosion(1.5, 2)
.humidity(-1, 1)
.temperature(1, 2)
.weirdness(-2, 2)
climate.forBiome('minecraft:ice_spikes')
.depth(0, 2)
.continentalness(-1 , 2)
.erosion(-2, 2)
.humidity(-1, 2)
.temperature(-2, 1)
.weirdness(-2, 0)
climate.forBiome('minecraft:flower_forest')
.depth(-2, 1)
.continentalness(-0.5, 2)
.erosion(-2, 2)
.humidity(-2, 2)
.temperature(-1, 1)
.weirdness(-1, 0)
climate.forBiome('minecraft:cold_ocean')
.depth(-2, 0.25)
.continentalness(-2, 0.1)
.erosion(-2, 2)
.humidity(-2, 2)
.temperature(-2, -1)
.weirdness(-2, 2)
climate.forBiome('minecraft:ocean')
.depth(-2, 0.4)
.continentalness(-2, 0.1)
.erosion(-2, 2)
.humidity(-2, 2)
.temperature(-1, 2)
.weirdness(-2, 2)
climate.forBiome('minecraft:lush_caves')
.depth(-2, 2)
.continentalness(-1, 1)
.erosion(0, 2)
.humidity(0, 2)
.temperature(0.5, 2)
.weirdness(0, 2)
climate.forBiome('minecraft:deep_dark')
.depth(-2, -1.75)
.continentalness(1.5, 2)
.erosion(-0.1, 0.1)
.humidity(1, 2)
.temperature(1, 2)
.weirdness(1, 2)
climate.forBiome('minecraft:deep_dark')
.depth(-2, -1.75)
.continentalness(1.75, 2)
.erosion(0.1, 0.2)
.humidity(1.5, 2)
.temperature(1.5, 2)
.weirdness(0.5, 1)
climate.forBiome('minecraft:badlands')
.depth(-2, 2)
.continentalness(-2, 2)
.erosion(-2, 2)
.humidity(-2, 2)
.temperature(-2, 2)
.weirdness(-2, 2)
.offset(1)
})
)
)
.withDimension(
'minecraft:the_nether',
'minecraft:the_nether',
'minecraft:noise',
generator => generator
.noiseSettings('minecraft:nether')
.biomeSource(
'minecraft:fixed',
biomeSource => biomeSource
.biome('minecraft:nether_wastes')
)
)
.addToNormalPresetList()
.asDefaultPreset()
})
Chunk Generators
Chunk generators define the shape and biomes of a dimension. WorldJS adds builders for the vanilla types, but other addons may add their own types
minecraft:debug
Contains all possible blocks states laid out in a grid at y = 60
minecraft:flat
A superflat world
: The structure sets to place in the world.structureOverrides(structures: HolderSet<StrcutrueSet>)- Defaults to all structure sets
: Add a layer to the world.addLayer(height: int, block: Block)height: int: The thickness of the layer- Must be in the range
[0, 4064]
- Must be in the range
block: Block: The block to place for the layer
: The biome of the world.biome(biome: Holder$Reference<Biome>)- Defaults to
'minecraft:plains'
- Defaults to
: Allows lava lakes to generate.withLavaLakes()
: Allows the placed features of the biome to generate.withBiomeFeatures()
minecraft:noise
Uses noise to determine the shape and biomes of the world
: The noise settings of the world.noiseSettings(settings: Holder$Reference<NoiseGeneratorSettings>)- Must be set
: Settings for the biome layout of the world.biomeSource(type: ResourceLocation, biomeSourceBuilder: Consumer<BiomeSourceBuilder>)type: ResourceLocation: The id of a biome source builder typebiomeSourceBuilder: Consumer<BiomeSourceBuilder>: A callback to edit the properties of the biome source- The methods available will depend on the
type
- The methods available will depend on the
- Must be set
Biome Sources
minecraft:checkerboard
Places biomes in a checkerboard pattern
: The size of the checkerboard grid.size(size: int)- Must be in the range
[0, 62] - Defaults to
2
- Must be in the range
: The biomes to place in the world.biomes(biomes: HolderSet<Biome>)- Must be set
minecraft:fixed
A single biome across the whole world
minecraft:multi_noise
Uses the world’s noise router to determine biome positions
One of the following must be set. If both are set, the preset will take precedence over the custom parameters
: The parameter preset to use.usingPreset(preset: Holder$Reference<MultiNoiseBiomeSourceParameterList>)- May be one of
'minecraft:overworld'or'minecraft:nether'
- May be one of
: Build the climate parameters using a callback of the form.usingParameters(Consumer<ClimateParameterListBuilder>)builder: ClimateParameterListBuilder: The builder, which has a single method available
: Creates, adds, and returns a climate parameter entry for the referenced biome. Biomes may have multiple entries. Entries have the following methods, which all return the entry.forBiome(biome: Holder$Reference<Biome>): ParameterEntry.temperature(value: number): The temperature to place the biome at- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.temperature(min: number, max: number): The temperature range to place the biome in- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.humidity(value: number): The humidity to place the biome at- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.humidity(min: number, max: number): The humidity range to place the biome in- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.continentalness(value: number): The continentalness to place the biome at- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.continentalness(min: number, max: number): The continentalness range to place the biome in- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.erosion(value: number): The erosion to place the biome at- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.erosion(min: number, max: number): The erosion range to place the biome in- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.depth(value: number): The depth to place the biome at- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.depth(min: number, max: number): The depth range to place the biome in- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.weirdness(value: number): The weirdness to place the biome at- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.weirdness(min: number, max: number): The weirdness range to place the biome in- Must be in the range
[-2, 2] - Defaults to
0
- Must be in the range
.offset(offset: number): The suitability offset- Must be in the range
[0, 1] - Defaults to
0
- Must be in the range
minecraft:the_end
The biome source used for the End
Has no methods available
Dimension Type
Dimension types define technical properties of a dimension like its building height limits and ambient light. WorldJS adds the ability to create dimension types through KubeJS’s ServerEvents.registry('dimension_type', event => {}) event vai the default (no type id) builder
: Fixes the dimension at the given day time, in ticks.fixedTime(time: int)- Defaults to un-fixed time
: Marks the dimension as not having sky light.withNosSkyLight()
: Marks the dimension as having a logical ceiling.withCeiling()- Note: This does not influence the actual generation of a ceiling in the dimension, that is controlled by the chunk generator
: Marks the dimension as being ultra warm. Enables water evaporation and faster lava spread, among other effects.ultraWarm()
: Marks the dimension as being unnatural, disabling compasses, beds, creaking spawns, and zombified piglins from spawn in nether portals.unnatural()
: Disallow sleeping in the dimension, causing them to explode on interact.disableBeds()
: Disallow respawn anchors in the dimension, causing them to explode on interact.disableRespawnAnchors()
: The multiplier applied to coordinates when leaving the dimension.coordinateScale(scale: number)- Must be in the range
[1E-5, 3E7] - Defaults to
1
- Must be in the range
: The minimum height at which blocks can exist in the dimension.minY(minY: int)- Must be in the range
[-2032, 2031] - Must be a multiple of
16 - Defaults to
-64
- Must be in the range
: The total height in which blocks can exist in the dimension.height(height: int)
: The maximum height ‘natural’ teleporters (nether portals, chorus fruit) can bring players.logicalHeight(height: int)- Must be in the range
[0, 4064] - Cannot be greater than
height - Defaults to
384
- Must be in the range
: The blocks on which fires burn indefinitely on.infiniburn(infiniburn: TagKey<Block>)- Defaults to
'minecraft:infiniburn_overworld'
- Defaults to
: The previously registered client-side effects of the dimension.effects(effects: ResourceLocation)- Controls the cloud height, sky type, ambient light, and light map behaviors
- Defaults to
'minecraft:overworld'
: How much ambient light the dimension has..ambientLight(ambientLight: number)0follows the light level and1has no ambient lighting- Defaults to
0
- Defaults to
: The weather-affected maximum light allowed when a mob spawns.monsterSpawnLightTest(test: IntProvider)- Must be in the range
[0, 15] - Defaults to
[0, 7]
- Must be in the range
: The maximum light allowed when a mob spawns.monsterSpawnBlockLightLimit(limit: int)- Must be in the range
[0, 15] - Defaults to
7
- Must be in the range
: Disables piglins and hoglins transforming into their zombified variants when in the dimension.safeForPiglins()
: Disables raids in the dimension.noRaids()
Example
ServerEvents.registry('dimension_type', event => {
event.create('space')
.withNoSkyLight()
.coordinateScale(300)
.minY(0)
.height(64)
.logicalHeight(64)
.effects('minecraft:the_end')
.noRaids()
})
Noise Generator Settings
Noise generator settings define the parameters used for the shape of terrain in noise-based chunk generators. WorldJS adds the ability to create noise generator settings through KubeJS’s ServerEvents.registry('worldgen/noise_settings', event => {}) event via the default (no type id) builder
: The world settings.noiseSettings(minY: int, height: int, horizontalSize: int, verticalSize: int)minY: int: The minimum y coordinate where terrain will generate- Must be in the range
[-2032, 2031] - Must be divisible by
16 - Defaults to
-64
- Must be in the range
height: int: The total height where terrain will generate- Must be in the range
[0, 4064] - Must be divisible by
16 heightplusminYmay not exceed2032- Defaults to
384
- Must be in the range
horizontalSize: int: The horizontal size of the noise- Must be in the range
[1, 4] - Defaults to
1
- Must be in the range
verticalSize: int: The vertical size of the noise- Must be in the range
[1, 4] - Defaults to
2
- Must be in the range
: The default block and fluid of the world.defaults(block: BlockState, fluid: BlockState)block: BlockState: The default block used for terrainfluid: BlockState: The default block used for seas and lakes- Must be set
: The density functions used for generation parameters. Can be made as an object with the following params:.noiseRouter(router: NoiseRouter)barrierNoise: DensityFunction: TheDensityFunctionfor separation of aquifers and open areas in caves- Must be set
fluidLevelFloodednessNoise: DensityFunction: TheDensityFunctionfor the probability of generating fluids in a cave for aquifers- Values will be clamped to
[-1, 1] - Must be set
- Values will be clamped to
fluidLevelSpreadNoise: DensityFunction: TheDensityFunctionfor the height of the liquid surface at a horizontal position- Must be set
lavaNoise: DensityFunction: TheDensityFunctionfor if an aquifer should use lava instead- The threshold is
0.3 - Must be set
- The threshold is
temperature: DensityFunction: TheDensityFunctionfor the temperature value used in biome placement- Must be set
vegetation: DensityFunction: TheDensityFunctionfor the humidity value used in biome placement- Must be set
continents: DensityFunction: TheDensityFunctionfor the continentalness value used in biome placement- Must be set
erosion: DensityFunction: TheDensityFunctionfor the erosion values used in biome and aquifer placement- Must be set
depth: DensityFunction: TheDensityFunctionfor the depth values used in biome and aquifer placement- Must be set
ridges: DensityFunction: TheDensityFunctionfor the weirdness values in biome placement- Must be set
initialDensityWithoutJaggedness: DensityFunction: TheDensityFunctionfor used for the initial terrain height for world generation- Must be set
finalDesnity: DensityFunction: TheDensityFunctionfor determining if air or a default block is placed- If positive, a block that can be replaced by the surface rule. Otherwise, an air block where aquifers can generate
- Must be set
veinToggle: DensityFunction: TheDensityFunctionfor special, large ore veins- If greater than
0the vein is copper - If less than or equal to
0the vein is iron - Must be set
- If greater than
veinRidged: DensityFunction: TheDensityFunctionfor which blocks are part of a vein- If greater than or equal to
0, the block is not part of a vein - If less than
0, the block is either the vein’s stone or ore block - Must be set
- If greater than or equal to
veinGap: DensityFunction: TheDensityFunctionfor determining which blocks in a vein are ore blocks- Must be set
- Must be set
: The surface rule source for the terrain’s blocks.surfaceRule(source: RuleSource)- Must be set
: Add a climate parameter point for where the player is allowed to spawn. The consumer has the methods available on.addSpawnTarget(builder: Consumer<ParameterEntry>)ParameterEntrys of noise biome sources
: The (world generation) sea level.seaLevel(seaLevel: int)
: Disables mob generation on chunk load.disableMobGeneration()
: Disables the generation of aquifers.disableAquifers()
: Disables the generation of special ore veins.disableOreVeins()
: Use the pre-1.18 random number generator.useLegacyRandomSource()
Example
ServerEvents.registry('worldgen/noise_settings', event => {
event.create('noisy')
.defaults('minecraft:pink_glazed_terracotta', 'minecraft:lava')
.noiseRouter({
barrierNoise: {
noise: {
noise: 'minecraft:aquifer_barrier',
xz_scale: 1,
y_scale: 1
}
},
fluidLevelFloodednessNoise: {
noise: {
noise: 'minecraft:aquifer_fluid_level_floodedness',
xz_scale: 1,
y_scale: 1
}
},
fluidLevelSpreadNoise: {
noise: {
noise: 'minecraft:aquifer_fluid_level_spread',
xz_scale: 1,
y_scale: 1
}
},
lavaNoise: {
noise: {
noise: 'minecraft:aquifer_lava',
xz_scale: 1,
y_scale: 1
}
},
temperature: {
cube: {
squeeze: {
mul: {
first: 0.1,
second: {
noise: {
noise: 'minecraft:temperature',
xz_scale: 0.13,
y_scale: 1
}
}
}
}
}
},
vegetation: 2,
continents: {
beardifier: {}
},
erosion: {
end_islands: {}
},
depth: -2,
ridges: {
square: {
y_clamped_gradient: {
from_y: -64,
to_y: 320,
from_value: -3.68,
to_value: 1.49
}
}
},
initialDensityWithoutJaggedness: 5,
finalDensity: 5.1,
veinToggle: 0,
veinRidged: 0,
veinGap: 0
})
.disableOreVeins()
.seaLevel(92)
.surfaceRule([
{
condition: {
if_true: {
noise_threshold: {
noise: 'minecraft:surface',
min_threshold: 0.2,
max_threshold: 0.8
}
},
then_run: 'badlands'
}
},
{
condition: {
if_true: {
y_above: {
anchor: 120,
surface_depth_multiplier: 1
}
},
then_run: 'minecraft:lime_stained_glass'
}
},
'minecraft:pink_glazed_terracotta'
])
.addSpawnTarget(builder =>
builder.humidity(2)
.temperature(-0.1, 0.1)
.depth(-2)
)
})
Biome
Biomes define the environment of a location in the world. WorldJS adds the ability to create new biomes through KubeJS’s ServerEvents.registry('worldgen/biome', event => {}) event via the default (no type id) builder
: Controls the grass/foliage color and height-adjusted temperature. Not related to the.temperature(temp: number)temperatureof noise generators- Defaults to
0
- Defaults to
: Controls the grass/foliage color.downfall(downfall: number)- Defaults to
0
- Defaults to
: The color used for fog.fogColor(color: KubeColor)- Defaults to
0
- Defaults to
: The color used for water blocks and cauldrons.waterColor(color: KubeColor)- Defaults to
0
- Defaults to
: The color used for water fog.waterFogColor(color: KubeColor)- Defaults to
0
- Defaults to
: The color used for the sky.skyColor(color: KubeColor)- Defaults to
0
- Defaults to
: The color used for leaves and vines.foliageColor(color: KubeColor)- If not set, a color derived from the
temperatureanddownfallis used
- If not set, a color derived from the
: The color used for grass blocks, short and tall grass, (tall) ferns, and sugarcane.grassColor(color: KubeColor)- If not set, a color derived from the
temperatureanddownfallis used
- If not set, a color derived from the
: A modifier to apply to the grass color.grassColorModifier(modifier: GrassColorModifier)Reveal/hide valid grass color modifiers
nonedark_forestswamp
Mods may add additional values
- Defaults to
none
: The ambient particle of the biome.particle(particleOptions: ParticleOptions, probability: number)particleOptions: ParticleOptions: The particle to spawnprobability: number: How often the particle spawns
: The ambient sound.ambientSound(sound: Holder$Reference<SoundEvent>)
: The mood properties.moodSound(sound: Holder$Reference<SoundEvent>, tickDelay: int, blockSearchExtent: int, offset: number)sound: Holder$Reference<SoundEvent>: The mood soundtickDelay: int: The minimum delay between two playsblockSearchExtent: int: The range at which the mood algorithm can checkoffset: number: How far the sound source should be from the player
: Settings for additions sound.additionsSound(sound: Holder$Reference<SoundEvent>, tickChance: double)sound: Holder$Reference<SoundEvent>: The sound to playtickChance: number: The chance the sound will play each tick
: Specific music that should play in the biome.music(sound: Holder$Reference<SoundEvent>, minDelay: int, maxDelay: int, replaceCurrentMusic: boolean)sound: Holder$Refence<SoundEvent>: The music soundminDelay: int: The minimum delay between two music tracksmaxDelay: int: The maximum delay between two music tracksreplaceCurrentMusic: boolean: If currently playing music should be replaced
: Modifier for the temperature before calculating the height adjusted temperature.temperatureModifier(modifier: TemperatureModifier)Reveal/hide valid temperature modifiers
nonefrozen
- Defaults to
none
: Disables precipitation in the biome.withoutPrecipitation()
: The world carvers to use in the given carving step.carving(carvingStep: GenerationStep$Carving, carver: HolderSet<ConfiguredWorldCarver<?>>)carvingStep: GenerationStep$Carving: The carving stepReveal/hide valid carving steps
airliquid
carver: HolderSet<ConfiguredWorldCarver<?>>: The carvers that will carve during the givencarvingStep
: The placed features to place in the given decoration step.features(step: GenerationStep$Decoration, feature: HolderSet<PlacedFeature>)step: GenerationStep$Decoration: The decoration step to placefeatureinReveal/hide valid decoration steps
raw_generationlakeslocal_modificationsunderground_structuressurface_structuresstrongholdsunderground_oresunderground_decorationfluid_springsvegetal_decorationtop_layer_modification
feature: HolderSet<PlacedFeature>: The placed features that will be placed during the decorationstep
: Add a mob spawn.addSpawn(category: MobCategory, type: EntityType<?>, weight: int, minCount: int, maxCount: int)category: MobCategory: The category of the spawnReveal/hide valid mob categories
monstercreatureambientaxolotlsunderground_water_creaturewater_creaturewater_ambientmisc
type: EntityType<?>: The entity type to spawnweight: int: How often the mob should spawn. Higher values means more spawnsminCount: int: The minimum number of the mob to spawnmaxCount: int: The maximum number of the mob to spawn
: Add a spawn cost for an entity.addMobCharge(type: EntityType<?>, charge: number, energyBudget: number)type: EntityType<?>: The entity type to add a spawn cost forcharge: number: The charge of the mobenergyBudget: number: The mob’s maximum potential
: The probability of creatures being spawned during world generation.creatureSpawnProbability(probability: number)- Must be in the range
[0, 0.9999999] - Defaults to
0.1
- Must be in the range
Example
ServerEvents.registry('worldgen/biome', event => {
event.create('juice')
.temperature(0.4)
.downfall(2)
.fogColor('#e83581')
.waterColor('#e83581')
.waterFogColor('#e83581')
.skyColor('#e23aac')
.foliageColor('#e9c034')
.grassColor('#8662bb')
.ambientSound('kubejs:juice/ambient')
.moodSound('kubejs:juice/mood', 200, 4, 1.4)
.additionsSound('kubejs:juice/additions', 0.2)
.music('kubejs:juice/music', 200, 500, true)
.carving('air', '#kubejs:silly_straws')
.features('lakes', '#kubejs:juice_pools')
.features('underground_ores', '#kubejs:gushers')
.features('fluid_springs', '#kubejs:soda_machines')
.features('underground_structures', ['kubejs:juice_dungeon'])
.addSpawn('water_ambient', 'juice_mod:juice_fish', 100, 5, 17)
})