开启辅助访问      

站内搜索

搜索
热搜: 下载 1.19 1.20

Minecraft(我的世界)苦力怕论坛

[BE教程] 附加包教程:27.地物

发表于 2023-3-5 08:00:51 来自手机 | 显示全部楼层 |阅读模式 IP:天津
本帖最后由 Cat_Anchor 于 2023-6-17 16:39 编辑

前言

现在我们来讲讲地物。常用的地物有好几种,分别是:结构模板地物、矿石地物、单方块地物、分散地物、树地物和晶洞地物。
地物

打开行为包根目录,打开features文件夹,这里用于存储地物。但是只有这个文件夹是不能生成任何地物的,因为这个地物没有生成规则。打开feature_rules文件夹,这里用于存储地物规则。
注意,所有地物和地物规则的ID必须和文件名匹配。比如地物ID是supplementary:chorus_tree1,那么文件名必须是chorus_tree1.json。
地物是一个比较难、类型很多的东西,但很多种地物只适用于一种或少量种情况。比如悬挂植物地物,几乎只能用来放置洞穴藤蔓和垂泪藤。又比如雕刻洞穴地物,只能用来放置下界的洞穴。所以,我在此只会细说我刚才列出的那些地物类型。
除此之外,我会在讲完地物之后讲地物规则。
结构模板地物


  1. {
  2.   "format_version": "1.16.0",
  3.   "minecraft:structure_template_feature": {
  4.     "description": {
  5.       "identifier": "supplementary:chorus_tree1" //地物ID
  6.     },
  7.     "structure_name": "mystructure:chorus_tree_1", //要放置的结构的名称,这就是我让你记住你导出的结构的名字的原因。
  8.     "facing_direction": "random", //方向
  9.     "adjustment_radius": 0, //“调整半径”,写0即可,官方文档上没有介绍。
  10.     "constraints": {
  11.       "grounded": {} //可以决定结构是着地的还是浮空的,把"grounded": {}换成"unburied": {},"block_intersection": {"block_allowlist": ["minecraft:air"]}可以让结构浮空。
  12.     }
  13.   }
  14. }
复制代码

矿石地物


  1. {
  2.   "format_version": "1.13.0",
  3.   "minecraft:ore_feature": {
  4.     "description": {
  5.       "identifier": "example:malachite_ore_feature" //地物ID
  6.     },
  7.     "count": 12, //要放置的矿石的最大数量。(其实要放的方块不是矿石也行)
  8.     "replace_rules": [
  9.       {
  10.         "places_block": "example:malachite_ore", //要放置的方块,下同
  11.         "may_replace": [
  12.           "minecraft:stone" //要替换的方块,下同
  13.         ]
  14.       },
  15.       {
  16.         "places_block": "example:granite_malachite_ore",
  17.         "may_replace": [
  18.           "minecraft:granite"
  19.         ]
  20.       },
  21.       {
  22.         "places_block": "example:andesite_malachite_ore",
  23.         "may_replace": [
  24.           "minecraft:andesite"
  25.         ]
  26.       }
  27.     ]
  28.   }
  29. }
复制代码

树地物


  1. {
  2.   "format_version": "1.13.0",
  3.   "minecraft:tree_feature": {
  4.     "description": {
  5.       "identifier": "supplementary:tree_v_birch_x_birch_tree" //地物ID
  6.     },
  7.     "trunk": { //树干部分
  8.       "trunk_height": { //树干高度
  9.         "range_min": 7, //最小是7
  10.         "range_max": 10 //最大是10
  11.       },
  12.       "trunk_block": {
  13.         "name": "minecraft:log", //树干方块,这里是白桦木
  14.         "states": {
  15.           "old_log_type": "birch" //指定是白桦木
  16.         }
  17.       }
  18.     },
  19.     "canopy": { //树冠部分
  20.       "canopy_offset": { //树冠的偏移量
  21.         "min": -3, //最小偏移-3
  22.         "max": 0 //最大偏移0
  23.       },
  24.       "variation_chance": [//变种机会,应该是指树叶的形状
  25.         { //这个对象代表了一个分数,下同
  26.           "numerator": 1, //分子
  27.           "denominator": 2 //分母
  28.         },
  29.         {
  30.           "numerator": 1,
  31.           "denominator": 2
  32.         },
  33.         {
  34.           "numerator": 1,
  35.           "denominator": 2
  36.         },
  37.         {
  38.           "numerator": 1,
  39.           "denominator": 1
  40.         }
  41.       ],
  42.       "leaf_block": {
  43.         "name": "minecraft:leaves", //树叶方块,这里是桦树叶
  44.         "states": {
  45.           "old_leaf_type": "birch"
  46.         }
  47.       }
  48.     },
  49.     "base_block": [ //指定底部的方块
  50.       "minecraft:dirt", //泥土
  51.       {
  52.         "name": "minecraft:dirt",
  53.         "states": {
  54.           "dirt_type": "coarse" //砂土
  55.         }
  56.       }
  57.     ],
  58.     "may_grow_on": [ //指定能长在……方块上
  59.       "minecraft:dirt", //泥土
  60.       "minecraft:grass", //草方块
  61.       "minecraft:podzol", //灰化土
  62.       {
  63.         "name": "minecraft:dirt",
  64.         "states": {
  65.           "dirt_type": "coarse" //砂土
  66.         }
  67.       },
  68.       {
  69.         "name": "minecraft:farmland",
  70.         "states": {
  71.           "moisturized_amount": 0 //干的耕地,moisturized_amount代表耕地湿润程度,0-7的值,7是湿润的
  72.         }
  73.       },
  74.       {
  75.         "name": "minecraft:farmland",
  76.         "states": {
  77.           "moisturized_amount": 1
  78.         }
  79.       },
  80.       {
  81.         "name": "minecraft:farmland",
  82.         "states": {
  83.           "moisturized_amount": 2
  84.         }
  85.       },
  86.       {
  87.         "name": "minecraft:farmland",
  88.         "states": {
  89.           "moisturized_amount": 3
  90.         }
  91.       },
  92.       {
  93.         "name": "minecraft:farmland",
  94.         "states": {
  95.           "moisturized_amount": 4
  96.         }
  97.       },
  98.       {
  99.         "name": "minecraft:farmland",
  100.         "states": {
  101.           "moisturized_amount": 5
  102.         }
  103.       },
  104.       {
  105.         "name": "minecraft:farmland",
  106.         "states": {
  107.           "moisturized_amount": 6
  108.         }
  109.       },
  110.       {
  111.         "name": "minecraft:farmland",
  112.         "states": {
  113.           "moisturized_amount": 7
  114.         }
  115.       }
  116.     ],
  117.     "may_replace": [ //树长成时会替换……方块
  118.       "minecraft:air", //空气
  119.       {
  120.         "name": "minecraft:leaves",
  121.         "states": {
  122.           "old_leaf_type": "oak" //橡树叶
  123.         }
  124.       },
  125.       {
  126.         "name": "minecraft:leaves",
  127.         "states": {
  128.           "old_leaf_type": "spruce" //云杉树叶
  129.         }
  130.       },
  131.       {
  132.         "name": "minecraft:leaves",
  133.         "states": {
  134.           "old_leaf_type": "birch" //桦树叶
  135.         }
  136.       },
  137.       {
  138.         "name": "minecraft:leaves",
  139.         "states": {
  140.           "old_leaf_type": "jungle" //丛林树叶
  141.         }
  142.       },
  143.       {
  144.         "name": "minecraft:leaves2",
  145.         "states": {
  146.           "new_leaf_type": "acacia" //金合欢树叶
  147.         }
  148.       },
  149.       {
  150.         "name": "minecraft:leaves2",
  151.         "states": {
  152.           "new_leaf_type": "dark_oak" //深色橡树叶
  153.         }
  154.       }
  155.     ],
  156.     "may_grow_through": [ //可以穿过……方块长成树
  157.       "minecraft:dirt", //泥土
  158.       "minecraft:grass", //草方块
  159.       {
  160.         "name": "minecraft:dirt",
  161.         "states": {
  162.           "dirt_type": "coarse" //砂土
  163.         }
  164.       }
  165.     ]
  166.   }
  167. }
复制代码

单方块地物


  1. {
  2.   "format_version": 1.13.0,
  3.   "minecraft:single_block_feature": {
  4.     "description": {
  5.       "identifier": "example:single_pumpkin_feature" //地物ID
  6.     },
  7.     "places_block": "example:pumpkin", //要放的方块。没错,这个地物就是在世界里放个方块,经常用于放小花小草之类的。
  8.     "enforce_placement_rules": true,
  9.     "enforce_survivability_rules": true,
  10.     "may_place_on": [
  11.       "example:grass" //会放在哪些方块上
  12.     ],
  13.     "may_replace": [
  14.       "example:air" //会替换哪些方块
  15.     ]
  16.   }
  17. }
复制代码

晶洞地物


  1. {
  2.   "format_version": "1.13.0",
  3.   "minecraft:geode_feature": {
  4.     "description": {
  5.       "identifier": "minecraft:diamond_geode_feature" //地物ID
  6.     },
  7.     "filler": "minecraft:air", //晶洞里面的方块,一般是空气
  8.     "inner_layer": "minecraft:diamond_block", //内层方块,像是紫水晶方块
  9.     "alternate_inner_layer": "minecraft:emerald_block", //内层方块,像是紫水晶母岩方块
  10.     "middle_layer": "minecraft:calcite", //中间层,像是方解石
  11.     "outer_layer": "minecraft:obsidian", //外层,像是平滑玄武岩
  12.     "inner_placements": [
  13.       {
  14.         "name": "minecraft:amethyst_cluster", //要放在紫水晶母岩上面的方块
  15.         "states": {
  16.           "amethyst_cluster_type": "small"
  17.         }
  18.       }
  19.     ],
  20.     "min_outer_wall_distance": 4,
  21.     "max_outer_wall_distance": 7,
  22.     "min_distribution_points": 3,
  23.     "max_distribution_points": 5,
  24.     "min_point_offset": 1,
  25.     "max_point_offset": 3,
  26.     "max_radius": 16, //最大半径
  27.     "crack_point_offset": 2.0,
  28.     "generate_crack_chance": 0.95, //裂开一个口子的几率,这里是95%
  29.     "base_crack_size": 2.0,
  30.     "noise_multiplier": 0.025,
  31.     "use_potential_placements_chance": 0.35,
  32.     "use_alternate_layer0_chance": 0.083,
  33.     "placements_require_layer0_alternate": true,
  34.     "invalid_blocks_threshold": 1
  35.   }
  36. }
复制代码

分散地物

这个地物是与其他地物一起使用的。

  1. {
  2.   "format_version": 1.13.0,
  3.   "minecraft:scatter_feature": {
  4.     "description": {
  5.       "identifier": "example:scatter_flowers_feature" //地物ID
  6.     },
  7.     "places_feature": "example:flower_feature", //要分散的地物ID
  8.     "iterations": 10, //地物的数量。
  9.     "x": {
  10.       "distribution": "uniform",
  11.       "extent": [ 0, 15 ] //范围,这里是0-15
  12.     },
  13.     "y": 64,
  14.     "z": {
  15.       "distribution": "uniform",
  16.       "extent": [ 0, 15 ] //范围,这里是0-15
  17.     }
  18.   }
  19. }
复制代码


地物规则


  1. {
  2.   "format_version": "1.13.0",
  3.   "minecraft:feature_rules": {
  4.     "description": {
  5.       "identifier": "supplementary:end_ruin_feature_rule", //地物规则的ID
  6.       "places_feature": "supplementary:end_ruin_feature" //这个地物规则管的地物ID
  7.     },
  8.     "conditions": {
  9.       "placement_pass": "first_pass",
  10.       "minecraft:biome_filter": [ //生物群系测试,只有在条件成立时才放置地物
  11.         {
  12.           "all_of": [ //其中所有成立才成立
  13.             {
  14.               "any_of": [ //其中任何一个成立就成立
  15.                 {
  16.                   "test": "has_biome_tag",
  17.                   "operator": "==",
  18.                   "value": "the_end" //末地
  19.                 }
  20.               ]
  21.             }
  22.           ]
  23.         }
  24.       ]
  25.     },
  26.     "distribution": {
  27.       "iterations": 1, //地物个数
  28.       "x": {
  29.         "distribution": "uniform",
  30.         "extent": [ //区块内的范围,0-16
  31.           0,
  32.           16
  33.         ]
  34.       },
  35.       "y": {
  36.         "distribution": "uniform",
  37.         "extent": [ //区块内的范围,45-75
  38.           45,
  39.           75
  40.         ]
  41.       },
  42.       "z": {
  43.         "distribution": "uniform",
  44.         "extent": [ //区块内的范围,0-16
  45.           0,
  46.           16
  47.         ]
  48.       }
  49.     }
  50.   }
  51. }
复制代码

这就是关于常用地物的讲解了。还有超级多的地物类型,可以通过官方发布的文档查看。有一点不便的是,官方的文档是英文的,还需要翻译一下才能看懂。(有时候翻译了也看不懂)
总结

这一期,我们学完了地物。下一期,我们就要讲交易了。


评分

参与人数 1铁粒 +64 收起 理由
WZMint + 64 我要这铁粒有何用

查看全部评分

苦力怕论坛,感谢有您~
回复

使用道具 举报

发表于 2023-3-5 10:51:58 来自手机 | 显示全部楼层 IP:福建省
感谢分享
2# 2023-3-5 10:51:58 回复 收起回复
苦力怕论坛,感谢有您~
回复 支持

使用道具 举报

发表于 2023-3-5 12:44:51 来自手机 | 显示全部楼层 IP:广东省
很细致的教程,但是我有个问题想请教:分散地物是什么
3# 2023-3-5 12:44:51 回复 收起回复
苦力怕论坛,感谢有您~
回复 支持

使用道具 举报

 楼主| 发表于 2023-3-5 17:46:09 来自手机 | 显示全部楼层 IP:天津
Baka_Bee 发表于 2023-3-5 12:44
很细致的教程,但是我有个问题想请教:分散地物是什么

我个人理解是起到类似于地物规则的效果,比如一个地物固定在区块0,0位置生成,那分散地物(Scatter Feature)的作用就是让它在区块内随机位置生成,或者使用q.noise根据柏林噪声依据地形进行生成

评分

参与人数 1铁粒 +50 收起 理由
YesNewBee + 50 感谢~

查看全部评分

4# 2023-3-5 17:46:09 回复 收起回复
苦力怕论坛,感谢有您~
回复 支持 1

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

本站
关于我们
联系我们
坛史纲要
官方
哔哩哔哩
技术博客
下载
网易版
安卓版
JAVA
反馈
意见建议
教程中心
更多
捐助本站
QQ群
QQ群

QQ群

访问手机版

访问手机版

手机版|小黑屋|系统状态|klpbbs.com

粤公网安备 44200002445329号 | 由 木韩网络 提供云服务 | GMT+8, 2024-5-6 10:55

声明:本站与Mojang以及微软公司没有从属关系

Powered by Discuz! X3.4 粤ICP备2023071842号