生成自定义矿石
experimental
ore_feature(矿石特征)是基础但重要的功能!它们可以通过替换生成位置的方块来形成方块簇。本教程将展示如何制作自然生成的矿物矿石。
使用特征和特征规则需要在世界设置中启用"创建自定义生物群系"。如果你的方块没有生成,请确保已启用该选项!
TIP
本教程将使用两种自定义方块:钛铁矿(Titanite Ore)和深板岩钛铁矿(Deepslate Titanite Ore)。关于如何制作自定义方块,请访问方块介绍页面。
特征文件
BP/features/titanite_ore_feature.json
json
{
"format_version": "1.17.0",
"minecraft:ore_feature": {
"description": {
"identifier": "wiki:titanite_ore_feature"
},
"count": 8, // 放置尝试次数
"replace_rules": [
{
// 将所有石质变种(安山岩、花岗岩和闪长岩)替换为钛铁矿
"places_block": "wiki:titanite_ore",
"may_replace": ["minecraft:stone"]
},
{
// 将深板岩替换为深板岩钛铁矿
"places_block": "wiki:deepslate_titanite_ore",
"may_replace": ["minecraft:deepslate"]
}
]
}
}特征规则
BP/feature_rules/overworld_underground_titanite_ore_feature.json
json
{
"format_version": "1.13.0",
"minecraft:feature_rules": {
"description": {
"identifier": "wiki:overworld_underground_titanite_ore_feature",
"places_feature": "wiki:titanite_ore_feature" // 来自特征文件的标识符
},
"conditions": {
"placement_pass": "underground_pass",
"minecraft:biome_filter": [
// 在主世界各处散布矿石
{
"any_of": [
{
"test": "has_biome_tag",
"operator": "==",
"value": "overworld"
},
{
"test": "has_biome_tag",
"operator": "==",
"value": "overworld_generation"
}
]
}
]
},
"distribution": {
"iterations": 10, // 矿簇的放置尝试次数,不是矿石方块
"coordinate_eval_order": "zyx",
"x": {
"distribution": "uniform",
"extent": [0, 16]
},
"y": {
"distribution": "uniform", // 可以使用"triangle"使矿石在范围中部更常见
"extent": [
0, // 矿石生成的最低y层
62 // 矿石生成的最高y层
]
},
"z": {
"distribution": "uniform",
"extent": [0, 16]
}
}
}
}测试
你可以通过探索洞穴来寻找矿石,但如果你的矿石很稀有,可以使用命令来检查它们是否生成。只需将这个命令放入循环命令方块,然后四处飞行:
execute @a ~ ~ ~ fill ~8 ~8 ~8 ~-8 ~-8 ~-8 air 0 replace wiki:titanite_ore
石质矿石:

深板岩矿石:




