Minecraft 1.16.5模组开发(五十二) 修改原版生物战利品 (Loot Table)

我们今天尝试对原版中的一些生物的掉落物进行修改

1.我们本次修改的是原版中Zombie的掉落物,所以我们需要找到原版Zombie的战利品表:

zombie.json

{
  "type": "minecraft:entity",
  "pools": [
    {
      "rolls": 1.0,
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "functions": [
            {
              "function": "minecraft:set_count",
              "count": {
                "type": "minecraft:uniform",
                "min": 0.0,
                "max": 2.0
              },
              "add": false
            },
            {
              "function": "minecraft:looting_enchant",
              "count": {
                "type": "minecraft:uniform",
                "min": 0.0,
                "max": 1.0
              }
            }
          ],
          "name": "minecraft:rotten_flesh"
        }
      ]
    },
    {
      "rolls": 1.0,
      "bonus_rolls": 0.0,
      "entries": [
        {
          "type": "minecraft:item",
          "name": "minecraft:iron_ingot"
        },
        {
          "type": "minecraft:item",
          "name": "minecraft:carrot"
        },
        {
          "type": "minecraft:item",
          "functions": [
            {
              "function": "minecraft:furnace_smelt",
              "conditions": [
                {
                  "condition": "minecraft:entity_properties",
                  "predicate": {
                    "flags": {
                      "is_on_fire": true
                    }
                  },
                  "entity": "this"
                }
              ]
            }
          ],
          "name": "minecraft:potato"
        }
      ],
      "conditions": [
        {
          "condition": "minecraft:killed_by_player"
        },
        {
          "condition": "minecraft:random_chance_with_looting",
          "chance": 0.025,
          "looting_multiplier": 0.01
        }
      ]
    }
  ]
}

战利品的基本参数

          "type": "item",
          "name": "minecraft:gold_nugget",  # 掉落物的具体名称
          "weight": 5,  # 掉落权重
          "functions": [
            {
              "function": "set_count",
              "count": {
                "min": 0,   # 一次最少掉几个
                "max": 2    # 一次最多掉几个
              }
            }

2.找到模组的资源包,在src\main\resources\data下新建minecraft包->在minecraft包中新建loot_tables包->在loot_tables包中新建entities包->在entities包中新建我们的zombie.json文件:

cr1.jpg
zombie.json

{
"type": "minecraft:entity",
  "pools": [
    {
      "name": "main",
      "rolls": 1,
      "entries": [
        {
          "type": "item",
          "name": "minecraft:gold_nugget",
          "weight": 5,
          "functions": [
            {
              "function": "set_count",
              "count": {
                "min": 1,
                "max": 2
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 5,
          "name": "minecraft:diamond",
          "functions": [
            {
              "function": "set_count",
              "count": {
                "min": 1,
                "max": 2
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 3,
          "name": "minecraft:iron_ingot",
          "functions": [
            {
              "function": "set_count",
              "count": {
                "min": 1,
                "max": 1
              }
            }
          ]
        },
        {
          "type": "item",
          "weight": 5,
          "name": "minecraft:emerald",
          "functions": [
            {
              "function": "set_count",
              "count": {
                "min": 2,
                "max": 3
              }
            }
          ]
        }
      ]
    }
  ]
}

3.进入游戏调试:

我们给zombie设置为掉落钻石、绿宝石、铁锭等物品:
2022-07-25_19.08.06.png

击杀后掉落情况:

2022-07-25_19.08.22.png

所有掉落物都出现了,符合预期!

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

Jay_fearless

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

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

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

打赏作者

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

抵扣说明:

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

余额充值