【Java】让我们一起来制作Minecraft的Mod 1.14.4【7. 增加进展】

这篇文章是一系列解释性文章之一。

首篇文章:入门篇
前一篇文章:6. 添加菜谱
下一篇文章:8. 添加和生成矿石

添加进展

advancement_Minecraft.png

進度的追加相對簡單,並在1.14.4版本中以JSON為基礎進行管理。

\src\main\resources
   ├ assets
   └ data
      └ example_mod
         ├ advancements
         │  └ root.json
         ├ loot_tables
         └ recipes

创建一个名为 \src\main\resources\data\example_mod\advancements 的文件夹,并将文件放入其中。
首先,我们需要创建一个作为树根的进度任务。
详细信息请参考参考页面,并在撰写时参考该页面。

{
  "display": {
    "icon": {
      "item": "example_mod:example_ingot"
    },
    "title": {
      "translate": "advancements.root.title"
    },
    "description": {
      "translate": "advancements.root.description"
    },
    "frame": "task",
    "show_toast": true,
    "announce_to_chat": true,
    "hidden": false,
    "background": "minecraft:textures/block/stone.png"
  },
  "criteria": {
    "get_example_ingot": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "item": "example_mod:example_ingot"
          }
        ]
      }
    }
  }
}

这是一个获取example_ingot时会达到的进度示例。

我再次强调,参考页面上有足够的解释,请详细查看该页面。下面是简要说明:
frame是指定进度磁贴的框架。可以选择challenge、goal、task中的一个适当选项。默认为task。
show_toast和announce_to_chat分别指示在达到时是否在右上角显示消息和在聊天栏发布消息,接受true/false的值。默认为true。
hidden指示是否在达到一个进度之前隐藏选项卡…尽管写着false,但不知道为什么还是不显示。默认为false。
criteria用于定义进度的条件。将一个任意的独特名称作为标签名(在get_example_ingot部分),并在触发器中写入各种触发器,在条件中写入与触发器对应的详细条件描述。

关于标题和说明的翻译,我们将在语言文件中添加补充说明。

{
  "advancements.root.title": "Example Title",
  "advancements.root.description": "Example description."
}
{
  "advancements.root.title": "例タイトル",
  "advancements.root.description": "説明の例。"
}
キャプチャ.PNG


もう一つくらい例を見てみましょう。

{
  "parent": "example_mod:root",
  "display": {
    "icon": {
      "item": "example_mod:example_chestplate"
    },
    "title": {
      "translate": "advancements.obtain_armor.title"
    },
    "description": {
      "translate": "advancements.obtain_armor.description"
    },
    "frame": "task",
    "show_toast": true,
    "announce_to_chat": true,
    "hidden": false
  },
  "criteria": {
    "example_helmet": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "item": "example_mod:example_helmet"
          }
        ]
      }
    },
    "example_chestplate": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "item": "example_mod:example_chestplate"
          }
        ]
      }
    },
    "example_leggings": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "item": "example_mod:example_leggings"
          }
        ]
      }
    },
    "example_boots": {
      "trigger": "minecraft:inventory_changed",
      "conditions": {
        "items": [
          {
            "item": "example_mod:example_boots"
          }
        ]
      }
    }
  },
  "requirements": [
    [
      "example_helmet",
      "example_chestplate",
      "example_leggings",
      "example_boots"
    ]
  ],
  "rewards": {
    "experience": 100
  }
}
キャプチャ.PNG


進捗は自分の作るModがどう楽しめるか伝える良い手段ですので、効果的に活用しましょう。

补充记载

需要注意的是,在12年之前,进展和成就是两个不同的概念,因此在查找信息时要避免混淆。

请参照以下内容。

进展 – Minecraft 日本维基【已于8/4更新】- At Wiki

次の記事

8. 添加和生成矿石

bannerAds