我们今天尝试对原版中的一些生物的掉落物进行修改
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
文件:
src\main\resources\data
minecraft
minecraft
loot_tables
loot_tables
entities
entities
zombie.json
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设置为掉落钻石、绿宝石、铁锭等物品:
击杀后掉落情况:
所有掉落物都出现了,符合预期!
版权声明:本文为Jay_fearless原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。