Durability

Use the durability requirement in a KubeJS recipe

Use one of these methods to add a Durability Requirement to the recipe.

.damageItem(item, amount)
.damageItem(item, amount, "slot")

//Don't break the item if its durability reach 0
.damageItemNoBreak(item, amount)
.damageItemNoBreak(item, amount, "slot")

.damageItemTag("tag", amount)
.damageItemTag("tag", amount, nbt)
.damageItemTag("tag", amount, "slot")
.damageItemTag("tag", amount, nbt, "slot")

//Don't break the item if its durability reach 0
.damageItemTagNoBreak("tag", amount)
.damageItemTagNoBreak("tag", amount, nbt)
.damageItemTagNoBreak("tag", amount, "slot")
.damageItemTagNoBreak("tag", amount, nbt, "slot")

.repairItem(item, amount)
.repairItem(item, amount, "slot")

.repairItemTag("tag", amount)
.repairItemTag("tag", amount, nbt)
.repairItemTag("tag", amount, "slot")
.repairItemTag("tag", amount, nbt, "slot")
  • The item param must be created using Item.of() KubeJS method. Example : Item.of("minecraft:diamond", 42)

  • The slot param must be a string corresponding to a slot id defined in a custom machine json Item Component slot property.

  • The tag param must be a string starting with # defining a valid tag id. Example : "#forge:stone"

  • The amount param must be a positive integer.

  • The nbt param must be a map. Example: {nbt1: 1, nbt2: "something"}.

Example

ServerEvents.recipes(event => {

  event.recipes.custommachinery.custom_machine("custommachinery:power_crusher", 100)
  .damageItem(Item.of("minecraft:cobblestone"), 1)
  
})

Last updated