本篇教程由作者设定未经允许禁止转载。

做整合包的时候看到了mod,感觉好棒,但是只支持原版和Alex 的生物,这点可太可惜了,于是我试着用数据包添加新雕像,发现可行。

数据包基础格式不必多言,自行查阅wiki。

文件路径为data/trofers/trofers/<命名空间>.json

文件路径下的子文件夹可以读取data/trofers/trofers/<命名空间>/命名空间.json

以四季秘境的月育母为例子。

创建文件路径为

data/trofers/trofers/abundant_seasons_2/yue_yu_mu.json

接着是json文件内部

{

  "conditions": [

    {

      "modid": "abundant_seasons_2",//modid

      "type": "forge:mod_loaded"//这个是必填项,原版实体不需要这一行。

    }

  ],

  "name": {

    "color": "#C0C6FF",//颜色

    "translate": "trophy.trofers.composed",//必填项

    "with": [

      {

        "translate": "entity.abundant_seasons_2.yue_yu_mu"//按照对应实体lang文件里的填

      }

    ]

  },

  "display": {

    "offset": {

      "z": -1.5//z轴偏移,可以填x或者y,也可以删掉这一行)

    },

    "scale": 0.8//模型大小

  },

  "entity": {

    "type": "abundant_seasons_2:yue_yu_mu"

  },

  "colors": {

    "base": "#606060",

    "accent": "#C0C6FF"

  },

  "effects": {

    "sound": {

      "soundEvent": "minecraft:entity.spider.ambient"//音效

    },

    "rewards": {

      "lootTable": "trofers:trophies/abundant_seasons_2/yue_yu_mu",//获取途径,这个具体看后面。

      "cooldown": 9600//冷却时间

    }

  }

}

雕像的获取也需要写json文件

路径为data/trofers/loot_tables/trophies/<命名空间>/命名空间.json

我们写月育母的战利品表就是

{

  "pools": [

    {

      "rolls": 1.0,

      "bonus_rolls": 0.0,

      "entries": [

        {

          "type": "trofers:optional_item",

          "when": [

            {

              "modid": "abundant_seasons_2",//modid

              "type": "forge:mod_loaded"

            }

          ],

          "name": "abundant_seasons_2:yue_yu_mu"//实体注册名

        }

      ]

    }

  ]

}

紧接着要编写loot_modifiers,路径为data/trofers/loot_modifiers/<命名空间>_trophies.json

还是以刚才的月育母为例子。

文件内部文本:

{
  "conditions": [
    {
      "condition": "minecraft:killed_by_player"//获取条件,默认是被玩家击杀
    },
    {
      "condition": "trofers:random_trophy_chance"//必填
    }
  ],
  "trophyBase": "trofers:small_plate",//大小
  "trophies": [
    {
      "entity": "abundant_seasons_2:yue_yu_mu",//实体id
      "trophy": "trofers:abundant_seasons_2/yue_yu_mu"//路径
    }
  ],
  "type": "trofers:add_entity_trophy"//必填
}

然后要将我们写的loot_modifiers列入名单内

路径为data/forge/loot_modifiers/global_loot_modifiers.json

默认文本是

{
  "replace": false,
  "entries": [
    "trofers:vanilla_trophies",
    "trofers:alexsmobs_trophies"
  ]
}

我们添加一行

{
  "replace": false,
  "entries": [
    "trofers:vanilla_trophies",
    "trofers:alexsmobs_trophies",
    "trofers:abundant_seasons_2_trophies"
  ]
}

最后,加载数据包,打开游戏看成品。


用trofers添加其他生物雕像-第1张图片