WorldgenAddEventJS
This event isn't complete yet and can only do basic things. Adding dimension-specific features also isn't possible yet, but is planned.
Example script: (kubejs/startup_scripts/worldgen.js)
onEvent('worldgen.add', event => {
event.addLake(lake => { // Create new lake feature
lake.block = 'minecraft:diamond_block' // Block ID (Use [] syntax for properties)
lake.chance = 3 // Spawns every ~3 chunks
})
event.addOre(ore => {
ore.block = 'minecraft:glowstone' // Block ID (Use [] syntax for properties)
ore.spawnsIn.blacklist = false // Inverts spawn whitelist
ore.spawnsIn.values = [ // List of valid block IDs or tags that the ore can spawn in
'#minecraft:base_stone_overworld' // Default behavior - ores spawn in all stone types
]
ore.biomes.blacklist = true // Inverts biome whitelist
ore.biomes.values = [ // Biomes this ore can spawn in
'minecraft:plains', // Biome ID
'#nether' // OR #category, see list of categories below
]
ore.clusterMinSize = 5 // Min blocks per cluster (currently ignored, will be implemented later, it's always 1)
ore.clusterMaxSize = 9 // Max blocks per cluster
ore.clusterCount = 30 // Clusters per chunk
ore.minHeight = 0 // Min Y ore spawns in
ore.maxHeight = 64 // Max Y ore spawns in
// ore.square = false // Disable square shape for ores (Honestly, im not sure what this does, I assume it's what packs them together)
// ore.chance = 4 // Spawns the ore every ~4 chunks. You usually combine this with clusterCount = 1 for rare ores
})
event.addSpawn(spawn => { // Create new entity spawn
spawn.category = 'creature' // Category, can be one of 'creature', 'monster', 'ambient', 'water_creature' or 'water_ambient'
spawn.entity = 'minecraft:pig' // Entity ID
spawn.weight = 10 // Weight
spawn.minCount = 4 // Min entities per group
spawn.maxCount = 4 // Max entities per group
})
})
All values are optional. All feature types have biomes
field like addOre
example
Valid biome categories (#category):
- taiga
- extreme_hills
- jungle
- mesa
- plains
- savanna
- icy
- the_end
- beach
- forest
- ocean
- desert
- river
- swamp
- mushroom
- nether
This is the order vanilla worldgen happens:
- raw_generation
- lakes
- local_modifications
- underground_structures
- surface_structures
- strongholds
- underground_ores
- underground_decoration
- vegetal_decoration
- top_layer_modification