12.8 LootJS战利品表修改实例
onEvent("lootjs", (event) => {
event
.addLootTypeModifier(LootType.ENTITY) // 修改实体战利品表
.weatherCheck({
raining: true,// 检测当前天气为雨天
})
.thenModify(Ingredient.getAll(), (itemStack) => {
// 掉落物数量翻倍
return itemStack.withCount(itemStack.getCount() * 2);
});
});onEvent("lootjs", (event) => {
event
.addBlockLootModifier("#forge:ores") // 使用方块tag匹配战利品表
.matchEquip(EquipmentSlot.MAINHAND, Item.of("minecraft:netherite_pickaxe").ignoreNBT())
.thenAdd("minecraft:gravel");
});