『KubeJS入门教程』修改你的工具/武器/盔甲属性 | 我的世界 Min...

onEvent("item.modification", event => {
//Supports any tool that has a damage, like shovel, pickaxe
event.modify("diamond_sword", modification => {
modification.setAttackDamage(1000)
//Note that bare hand speed is 4, you need to add
//a negative number to make it lower.
modification.setAttackSpeed(0.1)
})
//Only supports pickaxe, hoe, axe, etc.
event.modify("diamond_shovel", modification => {
modification.setDigSpeed(1000)
})
//Only supports armor
event.modify("diamond_chestplate", modification => {
modification.setArmorProtection(1)
modification.setArmorToughness(10)
modification.setArmorKnockbackResistance(2)
})
/**
* Generic attribute modification supports any tool / armor(but not any item),
* and addition/removal of any attribute.
* Adding attributes to different items with same UUID can cause problems,
* as attributes are removed/added by UUID in Mojang code.
*/
event.modify(["diamond_chestplate", "diamond_axe"], modification => {
modification.addAttribute("minecraft:generic.movement_speed", "d685b34c-8e34-4f4c-be7a-3e306e6656ee", "Sus speed", 1, "addition")
modification.addAttribute("forge:entity_gravity", "1f12ad16-2bc8-40c1-952d-19412bb666ac", "Sus gravity", 20, "multiply_total")
})
})