Skip to content

Instantly share code, notes, and snippets.

@Kroppeb
Last active July 9, 2020 13:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Kroppeb/329d218b182391af6b2e2736bc472f71 to your computer and use it in GitHub Desktop.
Save Kroppeb/329d218b182391af6b2e2736bc472f71 to your computer and use it in GitHub Desktop.
/*
* $xxx = Identifier // Registry for xxx
* $|xxx = ($xxx | xxx)
*/
Biome{
// inline enum
precipitation: ("none"|"rain"|"snow")
// reference enum
category: Biome.Category
depth: Float
scale: Float
temperature: Float
downfall: Float
effects: BiomeEffects
sky_color: Int
surface_builder: $|ConfiguredSurfaceBuilder
carvers: Map<GenerationStep.Carver, List< $|ConfiguredCarver>>
features: List< $|ConfiguredFeature>
starts: List< $|ConfiguredStructureFeature>
spawners: Map<SpawnGroup, List<Biome.SpawnEntry>>
parent: String?
spawn_costs: Map< $EntityType, Biome.SpawnDensity>
}
// listing
Biome.Category = ("none"|"taiga"|"extreme_hills"|"jungle"|"mesa"|"plains"|"savanna"|"icy"|"the_end"|"beach"|"forest"|"ocean"|"desert"|"river"|"swamp"|"mushroom"|"nether")
// enum def
GenerationStep.Carver = enum{
air
liquid
}
BiomeEffects{
fog_color: int
water_color: int
water_fog_color: int
particle: BiomeParticleConfig?
ambient_sound: SoundEvent?
mood_sound: BiomeMoodSound?
additions_sound: BiomeAdditionsSound?
music: MusicSound?
}
BiomeParticleConfig{
options: ParticleTypes
probability: Float
}
ParticleTypes = dispatch("type"){
ambient_entity_effect
angry_villager
barrier
block = BlockStateParticleEffect
bubble
cloud
crit
damage_indicator
dragon_breath
dripping_lava
falling_lava
landing_lava
dripping_water
falling_water
dust{
r: Float
g: Float
b: Float
scale: Float
}
effect
elder_guardian
enchanted_hit
enchant
end_rod
entity_effect
explosion_emitter
explosion
falling_dust = BlockStateParticleEffect
firework
fishing
flame
soul_fire_flame
soul
flash
happy_villager
composter
heart
instant_effect
item = ItemStackParticleEffect
item_slime
item_snowball
large_smoke
lava
mycelium
note
poof
portal
rain
smoke
sneeze
spit
squid_ink
sweep_attack
totem_of_undying
underwater
splash
witch
bubble_pop
current_down
bubble_column_up
nautilus
dolphin
campfire_cosy_smoke
campfire_signal_smoke
dripping_honey
falling_honey
landing_honey
falling_nectar
ash
crimson_spore
warped_spore
dripping_obsidian_tear
falling_obsidian_tear
landing_obsidian_tear
reverse_portal
white_ash
}
BlockStateParticleEffect = BlockState
ItemStackParticleEffect = ItemStack
SoundEvent = Identifier
BiomeMoodSound{
sound: SoundEvent
tick_delay: Int
block_search_extend: Int
offset: Double
}
BiomeAdditionsSound{
sound: SoundEvent
tick_chance: Double
}
MusicSound{
sound: SoundEvent
min_delay: Int
max_delay: Int
replace_current_music: Bool
}
/**
* will always be like
* ConfiguredSurfaceBuilder{
* name: Identifier
* config: TernarySurfaceConfig
* }
*/
ConfiguredSurfaceBuilder = dispatch("name"){
default = SurfaceBuilderConfig
mountain = SurfaceBuilderConfig
shattered_savanna = SurfaceBuilderConfig
gravelly_mountain = SurfaceBuilderConfig
giant_tree_taiga = SurfaceBuilderConfig
swamp = SurfaceBuilderConfig
badlands = SurfaceBuilderConfig
wooded_badlands = SurfaceBuilderConfig
eroded_badlands = SurfaceBuilderConfig
frozen_ocean = SurfaceBuilderConfig
nether = SurfaceBuilderConfig
nether_forest = SurfaceBuilderConfig
soul_sand_valley = SurfaceBuilderConfig
basalt_deltas = SurfaceBuilderConfig
nope = SurfaceBuilderConfig
}
SurfaceBuilderConfig{
config: TernarySurfaceConfig
}
TernarySurfaceConfig{
top_material: BlockState
under_material: BlockState
underwater_material: BlockState
}
ConfiguredCarver = dispatch("name"){
cave = Carver
nether_cave = Carver
canyon = Carver
underwater_canyon = Carver
underwater_cave = Carver
}
Carver{
config: ProbabilityConfig
}
ProbabilityConfig{
probability: Float[0.0<=x<=1.0]
}
ConfiguredFeature = dispatch("name"){
no_op{config: DefaultFeatureConfig}
tree{config: TreeFeatureConfig}
flower{config: RandomPatchFeatureConfig}
random_patch{config: RandomPatchFeatureConfig}
block_pile{config: BlockPileFeatureConfig}
spring_feature{config: SpringFeatureConfig}
chorus_plant{config: DefaultFeatureConfig}
emerald_ore{config: EmeraldOreFeatureConfig}
void_start_platform{config: DefaultFeatureConfig}
desert_well{config: DefaultFeatureConfig}
fossil{config: DefaultFeatureConfig}
huge_red_mushroom{config: HugeMushroomFeatureConfig}
huge_brown_mushroom{config: HugeMushroomFeatureConfig}
ice_spike{config: DefaultFeatureConfig}
glowstone_blob{config: DefaultFeatureConfig}
freeze_top_layer{config: DefaultFeatureConfig}
vines{config: DefaultFeatureConfig}
monster_room{config: DefaultFeatureConfig}
blue_ice{config: DefaultFeatureConfig}
iceberg{config: SingleStateFeatureConfig}
forest_rock{config: SingleStateFeatureConfig}
disk{config: DiskFeatureConfig}
ice_patch{config: DiskFeatureConfig}
lake{config: SingleStateFeatureConfig}
ore{config: OreFeatureConfig}
end_spike{config: EndSpikeFeatureConfig}
end_island{config: DefaultFeatureConfig}
end_gateway{config: EndGatewayFeatureConfig}
seagrass{config: ProbabilityConfig}
kelp{config: DefaultFeatureConfig}
coral_tree{config: DefaultFeatureConfig}
coral_mushroom{config: DefaultFeatureConfig}
coral_claw{config: DefaultFeatureConfig}
sea_pickle{config: SeaPickleFeatureConfig}
simple_block{config: SimpleBlockFeatureConfig}
bamboo{config: ProbabilityConfig}
huge_fungus{config: HugeFungusFeatureConfig}
nether_forest_vegetation{config: BlockPileFeatureConfig}
weeping_vines{config: DefaultFeatureConfig}
twisting_vines{config: DefaultFeatureConfig}
basalt_columns{config: BasaltColumnsFeatureConfig}
delta_feature{config: DeltaFeatureConfig}
netherrack_replace_blobs{config: NetherrackReplaceBlobs}
fill_layer{config: FillLayerFeatureConfig}
bonus_chest{config: DefaultFeatureConfig}
basalt_pillar{config: DefaultFeatureConfig}
no_surface_ore{config: OreFeatureConfig}
random_selector{config: RandomFeatureConfig}
simple_random_selector{config: SimpleRandomFeatureConfig}
random_boolean_selector{config: RandomBooleanFeatureConfig}
decorated{config: DecoratedFeatureConfig}
decorated_flower{config: DecoratedFeatureConfig}
}
DefaultFeatureConfig = Unit
TreeFeatureConfig{
trunk_provider: BlockStateProvider
leaves_provider: BlockStateProvider
foliage_placer: FoliagePlacer
trunk_placer: TrunkPlacer
minimum_size: FeatureSize
decorators: List<TreeDecorator>
max_water_depth: Int = 0
ignore_vines: Bool = false
heightmap: Heightmap.Type
}
Heightmap.Type = enum{
WORLD_SURFACE_WG
WORLD_SURFACE
OCEAN_FLOOR_WG
OCEAN_FLOOR
MOTION_BLOCKING
MOTION_BLOCKING_NO_LEAVES
}
// dispatch{...} = dispatch("type"){...}
BlockStateProvider = dispatch{
simple_state_provider{state:BlockState}
weighted_state_provider = WeightedList<BlockState>
plain_flower_provider
forest_flower_provider
rotated_block_provider{state:BlockState}
}
FoliagePlacer = dispatch{
blob_foliage_placer = BlobFoliagePlacer
spruce_foliage_placer = SpruceFoliagePlacer
pine_foliage_placer = PineFoliagePlacer
acacia_foliage_placer = AcaciaFoliagePlacer
bush_foliage_placer = BushFoliagePlacer
fancy_foliage_placer = LargeOakFoliagePlacer
jungle_foliage_placer = JungleFoliagePlacer
mega_pine_foliage_placer = MegaPineFoliagePlacer
dark_oak_foliage_placer = DarkOakFoliagePlacer
}
FoliagePlacer{
radius: bounded_class_5428(0,8,8)
offset: bounded_class_5428(0,8,8)
}
BlobFoliagePlacer: FoliagePlacer{
height: Int[0<=x<=16]
}
SpruceFoliagePlacer: FoliagePlacer{
trunk_height: bounded_class_5428(0,16,8)
}
PineFoliagePlacer: FoliagePlacer{
height: bounded_class_5428(0,16,8)
}
// equivalent to `AcaciaFoliagePlacer = FoliagePlacer`?
// I think this can lead to errors going unnoticed elsewhere though
// makes every `=` able to be a `:`
// maybe only `AcaciaFoliagePlacer: FoliagePlacer{}`?
AcaciaFoliagePlacer: FoliagePlacer
BushFoliagePlacer: BlobFoliagePlacer{}
LargeOakFoliagePlacer: BlobFoliagePlacer{}
JungleFoliagePlacer: FoliagePlacer{
height: Int[0<=x<=16]
}
MegaPineFoliagePlacer: FoliagePlacer{
crown_height: bounded_class_5428(0,16,8)
}
DarkOakFoliagePlacer: FoliagePlacer{}
TrunkPlacer = dispatch{
straight_trunk_placer = TrunkPlacerBase
forking_trunk_placer = TrunkPlacerBase
giant_trunk_placer = TrunkPlacerBase
mega_jungle_trunk_placer = TrunkPlacerBase
dark_oak_trunk_placer = TrunkPlacerBase
fancy_trunk_placer = TrunkPlacerBase
}
TrunkPlacerBase{
base_height: Int[0<=x<=32]
height_rand_a: Int[0<=x<=24]
height_rand_b: Int[0<=x<=24]
}
FeatureSize = dispatch{
two_layers_feature_size = TwoLayersFeatureSize
three_layers_feature_size = ThreeLayersFeatureSize
}
TwoLayersFeatureSize : FeatureSizeBase{
limit: Int[0<=x<=81] = 1
lower_size: Int[0<=x<=16] = 0
upper_size: Int[0<=x<=16] = 1
}
TwoLayersFeatureSize{
limit: Int[0<=x<=81] = 1
lower_size: Int[0<=x<=16] = 0
middle_size: Int[0<=x<=16] = 1
upper_size: Int[0<=x<=16] = 1
}
FeatureSizeBase{
min_clipped_height: Int?[0<=x<=80]
}
ConfiguredDecorator = dispatch("name", wrap="config"){
/// Don't place anything
nope
/// Try to place in 1/chance of cases it is called
chance = ChanceDecoratorConfig
/// Try to place at least count.base and at most count.base + count.spread
count = CountDecoratorConfig
/// Uses the foliage noise to determine how many tries it will do
count_noise{
/// The noise threshold
noise_level: Double
/// Amount of tries if `noise < noise_level`
below_noise: Int
/// Amount of tries if `noise >= noise_level`
above_noise: Int
}
/// Uses the foliage noise to scale how many tries it will do
/// Tries `ceil( (noise_offset + noise) * noise_to_count_ratio )` times
count_noise_biased{
///
noise_to_count_ratio: Int
/// x and z scale for noise frequency. count_noise uses 200
noise_factor: Double
/// offsets the noise
noise_offset: Double = 0
}
/// Tries to place `count` times and has a `extra_chance` chance to try an `extra_count` times more
count_extra{
count: Int
extra_chance: Double
extra_count: Int
}
/// Adds 2 values between 0..15 to the x and z.
/// Only use once to place randomly in the chunk.
/// Using more then once is not advised
square
/// Only tries if the Motion Blocking Heightmap has a y > 0
/// Moves the y coordinate to this top value
heightmap
/// Only tries if the Motion Blocking Heightmap has a y > 0
/// Moves the y coordinate randomly between 0 (inclusive) and the top value * 2 (exclusive)
heightmap_spread_double
/// Only tries if the Ocean Floor WG Heightmap has a y > 0
/// Moves the y coordinate to this top value
top_solid_heightmap
/// Only tries if the World Surface WG Heightmap has a y > 0
/// Moves the y coordinate to this top value
heightmap_world_surface
/// changes the y to be random between bottom_offset (inclusive) and maximum - top_offset + bottom_offset (exclusive)
/// IDK why please
/// wtf
range = RangeDecoratorConfig
/// "runs" the `range` to get a `y` value and chooses a new `y`
/// between 0 (inclusive) and the old `y` (exclusive)
range_biased = RangeDecoratorConfig
/// "runs" the `range_biased` to get a `y` value, and returns a new `y` between
/// 0 (inclusive) and the old `y` + bottom_offset
range_very_biased = RangeDecoratorConfig
/// Moves the y to be baseline-spread (inclusive) and baseline+spread-2 (inclusive)
depth_average{
baseline: Int
spread: Int
}
/// Moves the y to be between 0 (inclusive) and `y` + 32 (exclusive)
spread_32_above
/// Tries every block in the corresponding carver mask with a probability
carving_mask{
step: GenerationStep.Carver
probability: Float
}
/// Like count, but also randomizes the blocks to be random in the chunk
/// with y values between 4 (inclusive) and 124 (exclusive)
/// can be done with a square and a range too
fire = CountDecoratorConfig
/// Changes y to be between seaLevel - 5 (inclusive) and seaLevel + 5 (exclusive)
magma
/// Will try between 3 (inclusive) and 9 (exclusive) times in a chunk with
/// y values between 4 (inclusive) and 32 (exclusive)
emerald_ore
/// Will try with a probability of 1 / floor(chance / 10) to
/// select a block in the chunk with y value between 8 and 8 + max (exclusive)
/// with max a random number between 0 (inclusive) and maxYLevel - 8 (exclusive)
/// maxYLevel is the max y level from the chunk generator (possition independend)
/// if this y value is below seal level, this will work, else it has a 1 / floor(chance / 8) chance of succeeding
/// might crash if the maxYLevel is < 8?
lava_lake = ChanceDecoratorConfig
/// Will try with a probability of 1 / chance to
/// select a block in the chunk with y value between 0 (inclusive) and maxYLevel (exclusive)
/// maxYLevel is the max y level from the chunk generator (possition independend)
water_lake = ChanceDecoratorConfig
/// Tries between 0 (inclusive) and [a value between 0 (inclusive) and
/// [a value between count.base (inclusive) and count.base + count.spread (inclusive)
/// ](inclusive)
/// ](exclusive)
/// Moves the block randomly in the chunk with y between 4 (inclusive) and 124 (exclusive)
glowstone = CountDecoratorConfig
/// Tries with a probability of 1 in 700 to place randomly in the chunk
/// with a y between 3 (inclusive) and 10 (exclusive) blocks above
/// the Motion Blocking Heightmap
end_gateway
/// Tries for each 4*4 to place with a y value of the Motion Blocking HeightMap
dark_oak_tree
/// Offsets both x and z with a random value between 4 (inclusive) and 12 (exclusive)
iceberg
/// Tries with a probability of 1 / 14 to pick a block in the chunk
/// with y value between 55 (inclusive) and 71 (exclusive) and a second one
/// in 1/4 of the successful cases
end_island
/// first applies the inner one, then the outer one.
decorated{
outer: ConfiguredDecorator,
inner: ConfiguredDecorator
}
/// searches for no air/liquid blocks below
/// where the motionblocking heightmap gives an air/liquid block
/// tries between count.base and count.base + count.spread tries for each depth
/// stops if a depth doesn't have any?
count_multilayer = CountDecoratorConfig
}
RangeDecoratorConfig{
bottom_offset: Int = 0
top_offset: Int = 0
maximum: Int = 0
}
CountDecoratorConfig{
count: bounded_class_5428(-10, 128, 128)
}
ChanceDecoratorConfig{
chance: Int
}
WeightedList<T> = List<WeightedList.Entry<T>>
WeightedList.Entry<T>{
data: T
weight: Int = 1
}
Unit{}
// TODO recheck class_5428 mappings
class_5428 = (Int|Complex_class_5428) // the int case is short for spread = 0
Complex_class_5428{
base: Int
spread: Int[0<=x]
}
bounded_class_5428(minBase, maxBase, maxSpread) = class_5428.with{
base[minBase<=x<=maxBase]
spread[x<=maxSpread]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment