MC百科社群

标题: 1.12.2关于魔改, 配方成功出A失败出B,怎么实现 [打印本页]

作者: QQ酱55487    时间: 2024-1-4 19:32
标题: 1.12.2关于魔改, 配方成功出A失败出B,怎么实现
如题

作者: minecraft_32768    时间: 2024-1-9 11:52
注意:代码chatgpt写的,质量不敢保证



在 Minecraft 1.12.2 中,实现魔改配方成功出A失败出B,你可以通过使用 Mod 或自定义插件来实现。以下是一个简单的方法:

1. 首先,确保你已经安装了 Forge 或者另一个 Mod 加载器,以便在你的游戏中添加自定义内容。

2. 创建一个 JSON 文件,例如 `my_custom_recipe.json`,然后将以下内容添加到该文件中:
[spoiler=代码]
  1. ```json
  2. {
  3.   "minecraft:block/block_id": {
  4.     " crafting_table": {
  5.       "output": [
  6.         {
  7.           "minecraft:item/item_id": "A"
  8.         },
  9.         {
  10.           "minecraft:item/item_id": "B"
  11.         }
  12.       ],
  13.       "ingredients": [
  14.         {
  15.           "minecraft:item/item_id": "ingredient_1"
  16.         },
  17.         {
  18.           "minecraft:item/item_id": "ingredient_2"
  19.         }
  20.       ]
  21.     }
  22.   }
  23. }
  24. ```
复制代码
[/spoiler]

在这个例子中,我们将创建一个配方,当玩家在合成表中使用 "ingredient_1" 和 "ingredient_2" 合成时,会成功获得 "A" 物品,同时也会失败获得 "B" 物品。

3. 将 JSON 文件转换为 JSON 文件夹,以便 Minecraft 可以识别它。你可以在 `mods` 文件夹中创建一个新文件夹,例如 `my_custom_mod`,然后在其中创建一个名为 `assets` 的文件夹。将 `my_custom_recipe.json` 放入 `assets/minecraft/recipes` 文件夹。

4. 加载游戏,你将看到一个新的合成表配方。使用相应的材料进行合成,你会发现成功合成 "A" 物品的同时,也会失败获得 "B" 物品。

5. 如果你希望自定义配方在游戏开始时就已经存在,你可以将 JSON 文件中的内容添加到 `crafting_table.json` 文件中。为此,你需要在 JSON 文件中添加以下内容:
[spoiler=代码]
  1. ```json
  2. {
  3.   "minecraft:block/block_id": {
  4.     " crafting_table": {
  5.       "output": [
  6.         {
  7.           "minecraft:item/item_id": "A"
  8.         },
  9.         {
  10.           "minecraft:item/item_id": "B"
  11.         }
  12.       ],
  13.       "ingredients": [
  14.         {
  15.           "minecraft:item/item_id": "ingredient_1"
  16.         },
  17.         {
  18.           "minecraft:item/item_id": "ingredient_2"
  19.         }
  20.       ],
  21.       "init_entries": [
  22.         {
  23.           "json_id": "my_custom_recipe",
  24.           "ingredients": [
  25.             {"count": 1, "item": "ingredient_1"},
  26.             {"count": 1, "item": "ingredient_2"}
  27.           ],
  28.           "output": [
  29.             {"count": 1, "item": "A"},
  30.             {"count": 1, "item": "B"}
  31.           ]
  32.         }
  33.       ]
  34.     }
  35.   }
  36. }
  37. ```
复制代码

[/spoiler]

这将确保在游戏开始时,合成表中已经包含了你的自定义配方。

通过这种方法,你可以在 Minecraft 1.12.2 中实现魔改配方,使它在成功合成物品 A 的同时,也会失败合成物品 B。你可以根据需要调整 JSON 文件中的内容,以创建更多的自定义配方。




欢迎光临 MC百科社群 (https://bbs.mcmod.cn/) MC百科|最大的MineCraft中文模组百科