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

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

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

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

witch

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

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

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

ccr.jpg

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

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

cr1.png

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

2022-05-30_13.48.05.png

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

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

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

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

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

cr3.png

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

cr5.png

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步中定义的建筑新建出来:

cr6.png
我们的建筑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步中定义的生态群系里找到你的建筑,就说明你成功了!!!

ck.png

  • 6
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Jay_fearless

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值