Minecraft 1.18.1、1.18.2模组开发 19.拼图结构建筑(JigSaw Structure)

本教程同样适用于1.16.5的JigSaw Structure Generation。 如果你看过之前的结构方块建筑教程的话,想必会更好理解这篇教程。 如果你玩过暮色森林等经典模组的话,你一定

本教程同样适用于1.16.5的JigSaw Structure Generation。

如果你看过之前的结构方块建筑教程的话,想必会更好理解这篇教程。

如果你玩过暮色森林等经典模组的话,你一定会惊讶于巫妖王高塔、地下迷宫这些建筑究竟是如何生成的,今天我们就尝试使用拼图方块来生成非常大型的建筑。

Q:为什么不直接用结构方块生成大型建筑?

A:因为结构方块只能生成最大32×32×32的立方体大小的建筑,所以我们要使用其他的手段来生成长宽高上百的建筑。

1.我们本期准备生成的建筑分为4块,所以首先需要用4个结构方块将整个建筑包括起来:

2.之后我们需要用指令拿出拼图方块:

give @p minecraft:jigsaw
我们需要对拼图顺序做一个大致的设计:

来到1、2的衔接点,将我们的结构方块摆放如下:

右键建筑1的结构方块,在该方块中输入如下信息:

建筑1要找到建筑2拼图,所以它的Target PoolTarget Name中要是建筑2的名称。

右键建筑2的结构方块,在该方块中输入如下信息:

建筑2只需要被建筑1找到,不需要找别的建筑。所以它没有Target,只有自己的名字,和建筑1的Target Name一样。

同理,我们把另外两个衔接点都给完成。
我们将所有的衔接工作搞完后,将所有的建筑保存为.nbt文件:

3.在你的地图存档中的generated\minecraft\structures下找到所有的.nbt文件,存放到resources\data\re8joymod\structures路径下:

4.和之前一样,在data\你的modid\tags\worldgen\biome\has_structure中新建文件说明我们的建筑在哪些生态群系生成:

bene_house.json

{
  "replace": false,

  "_comment": " This biome tag can specify the biome directly. Or specify another biome tag by starting with # ",
  "values": [
    "minecraft:plains",
    "re8joymod:re8_ehills_biome"
  ]
}
data\你的modid\worldgen\configured_structure_feature中新建文件,说明你的建筑内生成什么生物

bene_house.json

{
  // The base structure class to use for the behavior of the structure. (Like extra terrain checks and such)
  "type": "minecraft:village",

  "config": {
    // the path to the template pool json file to use
    //指明你的建筑生成文件地址
    "start_pool": "re8joymod:bene_house/start_pool",

    // This is how many pieces away from the starting piece a piece of the structure can spawn
    // Think of it like the length of the branch of the structure
    //从起点开始的拼图生成最大衔接点个数,我们从起点1到2之间有一个,2到3之间有一个,一共两个
    "size": 2
  },

  // The biome tag to use for what biomes that this structure can spawn in"
  "biomes": "#re8joymod:has_structure/bene_house",

  // If true, land will be add around the bottom of the structure. (Based on the starting piece's y value)
  "adapt_noise": true,

  // What mobs can spawn over time in the structure.
  // 你的建筑内生成的生物
  "spawn_overrides": {
    "creature": {
      "bounding_box": "piece",
      "spawns": [
        {
          "type": "minecraft:bat",
          "weight": 1,
          "minCount": 1,
          "maxCount": 2
        }
      ]
    }
  }
}
data\你的modid\worldgen\structure_set中新建文件,说明你的建筑生成间距、建筑生成id等内容:

bene_house.json

{
  // What structures to pick to try and spawn if a spot passes the placement check.
  // If two or more structures in this list can spawn in a biome at a spot, a random one based on weight is chosen to spawn
  "structures": [
    {
      "structure": "re8joymod:bene_house",
      "weight": 1
    }
  ],
  "placement": {
    // Make sure this is unique and does not match any other structure set's salt
    //找一个介于int间的数,不要和其他的建筑一样
    "salt": 36694,

    // The average distance apart in chunks for spawn attempts
    //平均几个区块的距离生成一个这种建筑
    "spacing": 24,

    // Minimum distance apart in chunks for spawn attempts
    // MUST ALWAYS BE SMALLER THAN spacing ABOVE
    "separation": 20,

    // The kind of placement to use. The other kind is ring based like strongholds use.
    "type": "minecraft:random_spread"
  }
}
resources\data\re8joymod\worldgen\template_pool中新建我们的建筑文件夹bene_house,将我们第2步中定义的建筑新建出来:


我们的建筑1作为整个大型建筑的开头,需要命名为start_pool
start_pool.json

{
  //作为建筑的start_pool
  "name": "re8joymod:bene_house/start_pool",

  "fallback": "minecraft:empty",

  "elements": [
    {

      "weight": 1,
      "element": {

        //第3步中我们第一个建筑保存的名称
        "location": "re8joymod:bene_house",

        "processors": "minecraft:empty",


        "projection": "rigid",


        "element_type": "minecraft:single_pool_element"
      }
    }
  ]
}
第二个建筑作为拼图,命名为side_pool2

side_pool2.json

{
  //建筑2作为拼图,命名为side_pool2
  "name": "re8joymod:bene_house/side_pool2",
  "fallback": "minecraft:empty",
  "elements": [
    {
      "weight": 1,
      "element": {

        //第3步中我们第2个建筑的名称
        "location": "re8joymod:bene_house2",
        "processors": "minecraft:empty",
        "projection": "rigid",
        "element_type": "minecraft:single_pool_element"
      }
    }
  ]
}
第三个、第四个同理:

side_pool3.json

{
  "name": "re8joymod:bene_house/side_pool3",
  "fallback": "minecraft:empty",
  "elements": [
    {
      "weight": 1,
      "element": {


        "location": "re8joymod:bene_house3",
        "processors": "minecraft:empty",
        "projection": "rigid",
        "element_type": "minecraft:single_pool_element"
      }
    }
  ]
}

side_pool4.json

{
  "name": "re8joymod:bene_house/side_pool4",
  "fallback": "minecraft:empty",
  "elements": [
    {
      "weight": 1,
      "element": {


        "location": "re8joymod:bene_house4",
        "processors": "minecraft:empty",
        "projection": "rigid",
        "element_type": "minecraft:single_pool_element"
      }
    }
  ]
}

5.保存所有文件 -> 运行游戏

如果你能在你第4步中定义的生态群系里找到你的建筑,就说明你成功了!!!

发布者:admin,转转请注明出处:http://www.yc00.com/web/1755047451a5232917.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信