Surface Rules
Generated page, edit
scripts/gen_schema_pages.py instead.PKL4MC, Surface rule helpers for Minecraft 1.20.1
Surface rules are embedded in noise_settings, not a standalone datapack file.
Recursive slots (sequence items, then_run, if_true, not invert) are typed Dynamic so PKL won’t reject them, you can still put typed rule/condition objects into those positions.
Usage
amends "@pkl4mc/surface_rules.pkl"Example
surface_rule
// Example: how to build a surface_rule using surface_rules.pkl helpers.
// Paste this surface_rule value into your noise_settings amend file.
//
// Pattern: bedrock floor → grass on top → dirt layer → stone everywhere else
import "pklmc:surface_rules.pkl" as sr
// This module just exports the rule object - evaluate it to get JSON you can
// embed in a noise_settings file as the surface_rule value.
local rule: sr.SequenceRule = new {
sequence = new Listing {
// Bedrock at the very bottom (probabilistic gradient)
new sr.ConditionRule {
if_true = new sr.VerticalGradientCondition {
random_name = "mymod:bedrock_floor"
true_at_and_below = new sr.AboveBottomAnchor { above_bottom = 0 }
false_at_and_above = new sr.AboveBottomAnchor { above_bottom = 5 }
}
then_run = new sr.BlockRule { result_state { Name = "minecraft:bedrock" } }
}
// Above preliminary surface: grass on top, dirt below surface, stone beneath
new sr.ConditionRule {
if_true = new sr.AbovePreliminarySurface {}
then_run = new sr.SequenceRule {
sequence = new Listing {
// Top surface block: grass
new sr.ConditionRule {
if_true = new sr.StoneDepthCondition {
offset = 0
surface_type = "floor"
add_surface_depth = false
secondary_depth_range = 0
}
then_run = new sr.BlockRule { result_state { Name = "minecraft:grass_block"; Properties { ["snowy"] = "false" } } }
}
// Dirt layer (4 blocks deep)
new sr.ConditionRule {
if_true = new sr.StoneDepthCondition {
offset = 0
surface_type = "floor"
add_surface_depth = true
secondary_depth_range = 0
}
then_run = new sr.BlockRule { result_state { Name = "minecraft:dirt" } }
}
}
}
}
// Everything else: stone
new sr.BlockRule { result_state { Name = "minecraft:stone" } }
}
}
output { renderer = new JsonRenderer {}; value = rule }