Features Documentation - minecraft:weighted_random_feature
minecraft:weighted_random_feature
randomly selects and places a feature based on a weight value. Weights are relative, with higher values making selection more likely.
Succeeds if the selected feature is placed.
Fails if the selected feature fails to be placed.
Schema
object "minecraft:weighted_random_feature" : opt
{
object "description"
{
string "identifier" // The name of this feature in the form 'namespace_name:feature_name'. 'feature_name' must match the filename.
}
array "features"[1,*]
{
array "<any array element>"[2] : opt // Collection of weighted features that placement will select from.
{
feature_reference "[0..0]" // Named reference to a feature.
float "[1..1]" // Weight used in random selection. Value is relative to other weights in the collection.
}
}
}
Example
Selecting and placing a variant of a flower
{
"format_version": "1.13.0",
"minecraft:weighted_random_feature": {
"description": {
"identifier": "example:select_flower_feature"
},
"features": [
[ "example:white_flower_feature", 1 ],
[ "example:red_flower_feature", 2 ],
[ "example:blue_flower_feature", 1 ],
[ "example:yellow_flower_feature", 4 ]
]
}
}
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈