import type { Registry } from 'sandstone/arguments/generated/registry.ts' import type { RootNBT } from 'sandstone/arguments/nbt.ts' import type { NBTDouble, NBTFloat, NBTInt, NBTList, NBTLong, TagClass } from 'sandstone' export type BiomeNoiseEntry = { biome: Registry['minecraft:worldgen/biome'], parameters: ClimateParameters, } export type BiomeSource = NonNullable<({ [S in Extract, string>]?: ({ type: S, } & (S extends keyof SymbolBiomeSource ? SymbolBiomeSource[S] : RootNBT)) }[Extract])> export type Checkerboard = { /** * Value: * Range: 0..62 */ scale?: NBTInt<{ min: 0, max: 62, }>, biomes: ( | Array | ( | Registry['minecraft:worldgen/biome'] | `#${Registry['minecraft:tag/worldgen/biome']}` | TagClass<'worldgen/biome'>)), } /** * *either* * * Range: -2..2 * * *or* * * List length range: 2 */ export type ClimateParameter = (NBTFloat<{ leftExclusive: false, rightExclusive: false, }> | NBTList, { leftExclusive: false, rightExclusive: false, min: 2, max: 2, }>) export type ClimateParameters = { temperature: ClimateParameter, humidity: ClimateParameter, continentalness: ClimateParameter, erosion: ClimateParameter, weirdness: ClimateParameter, depth: ClimateParameter, /** * Value: * Range: 0..1 */ offset: NBTFloat<{ leftExclusive: false, rightExclusive: false, min: 0, max: 1, }>, } export type DirectMultiNoise = { biomes: Array<{ biome: Registry['minecraft:worldgen/biome'], parameters: ClimateParameters, }>, } export type Fixed = { biome: Registry['minecraft:worldgen/biome'], } export type MultiNoise = NonNullable<({ [S in Extract, string>]?: (MultiNoiseBase & { preset?: S, } & (S extends undefined ? SymbolMultiNoiseBiomeSource<'%none'> : (S extends keyof SymbolMultiNoiseBiomeSource ? SymbolMultiNoiseBiomeSource[S] : SymbolMultiNoiseBiomeSource<'%unknown'>))) }[Extract])> export type MultiNoiseBase = Record export type MultiNoiseBiomeSourceParameterList = { /** * Value: * * - Nether(`nether`) * - Overworld(`overworld`) */ preset: (MultiNoisePreset | `minecraft:${MultiNoisePreset}`), } export type MultiNoisePreset = ('nether' | 'overworld') export type NoiseParameters = { /** * Value: * Range: -32..32 */ base_octave: NBTInt<{ min: -32, max: 32, }>, /** * Defaults to 1.0. * * Value: * Range: 0..1000000 */ base_amplitude?: (NBTDouble<{ leftExclusive: false, rightExclusive: false, min: 0, }> | number), /** * Defaults to 1. * * Value: * Range: 1..32 */ octave_count?: NBTInt<{ min: 1, max: 32, }>, /** * Defaults to `true`. */ normalize?: boolean, /** * When empty or not present, defaults to all 1.0. \ * Otherwise, the size must match `octave_count`. * * Value: * List length range: ..32 */ amplitude_modifiers?: NBTList<(NBTDouble<{ leftExclusive: false, rightExclusive: false, min: 0, }> | number), { rightExclusive: false, }>, } export type TheEnd = Record export type VanillaLayered = { seed: NBTLong, large_biomes?: boolean, legacy_biome_init_layer?: boolean, } type BiomeSourceDispatcherMap = { 'checkerboard': BiomeSourceCheckerboard, 'minecraft:checkerboard': BiomeSourceCheckerboard, 'fixed': BiomeSourceFixed, 'minecraft:fixed': BiomeSourceFixed, 'multi_noise': BiomeSourceMultiNoise, 'minecraft:multi_noise': BiomeSourceMultiNoise, 'the_end': BiomeSourceTheEnd, 'minecraft:the_end': BiomeSourceTheEnd, } type BiomeSourceKeys = keyof BiomeSourceDispatcherMap type BiomeSourceFallback = (BiomeSourceCheckerboard | BiomeSourceFixed | BiomeSourceMultiNoise | BiomeSourceTheEnd) type BiomeSourceCheckerboard = Checkerboard type BiomeSourceFixed = Fixed type BiomeSourceMultiNoise = MultiNoise type BiomeSourceTheEnd = TheEnd export type SymbolBiomeSource = CASE extends 'map' ? BiomeSourceDispatcherMap : CASE extends 'keys' ? BiomeSourceKeys : CASE extends '%fallback' ? BiomeSourceFallback : never type MultiNoiseBiomeSourceDispatcherMap = {} type MultiNoiseBiomeSourceKeys = keyof MultiNoiseBiomeSourceDispatcherMap type MultiNoiseBiomeSourceFallback = (MultiNoiseBiomeSourceFallbackType) export type MultiNoiseBiomeSourceFallbackType = Record type MultiNoiseBiomeSourceNoneType = DirectMultiNoise export type SymbolMultiNoiseBiomeSource = CASE extends 'map' ? MultiNoiseBiomeSourceDispatcherMap : CASE extends 'keys' ? MultiNoiseBiomeSourceKeys : CASE extends '%fallback' ? MultiNoiseBiomeSourceFallback : CASE extends '%none' ? MultiNoiseBiomeSourceNoneType : CASE extends '%unknown' ? MultiNoiseBiomeSourceFallbackType : never