Item Modification

Modifying existing items


You can change properties of existing items:
ItemEvents.modification(event => {
  event.modify('minecraft:ender_pearl', item => {
    item.maxStackSize = 64
    item.fireResistant = true
    item.rarity = 'UNCOMMON'
  })

  event.modify('minecraft:ancient_debris', item => {
    item.rarity = 'RARE'
    item.burnTime = 16000
  })

  event.modify('minecraft:turtle_helmet', item => {
    item.rarity = 'EPIC'
    item.maxDamage = 481
    item.craftingRemainder = Item.of('minecraft:scute').item
  })
})
You can find full list of MutableItem properties here.

#Tool Defaults

TierlevelmaxDamagedigSpeedattackDamageenchantmentValue
Wood0592015
Stone1131415
Iron22506214
Diamond315618310
Gold03212022
Netherite420319415
attackDamage is a bonus modified by the tool type value, not the final value

#Armor Defaults

All boxes with multiple values are formatted head | chest | legs | feet.
TiermaxDamagearmorProtectionarmorToughnessarmorKnockbackResistance
Leather65758055123100.0
Chain95225240165145200.0
Iron195225240165256200.0
Gold9110511277135200.0
Diamond429495528363368320.0
Turtle325---2---00.0
Netherite481555592407368330.1
Elytra-432---0--00.0
Turtle only has helmet slot and Elytra only has chestplate slot.

#Tier

Broken at the moment! Use the non tier methods instead.

#Tools

ItemEvents.modification(event => {
  event.modify('minecraft:golden_sword', item => {
    item.tier = tier => {
        tier.speed = 12
        tier.attackDamageBonus = 10
        tier.repairIngredient = '#forge:storage_blocks/gold'
        tier.level = 3
    }
  })

  event.modify('minecraft:wooden_sword', item => {
    item.tier = tier => {
        tier.enchantmentValue = 30
    }
  })
})
You can find full list of MutableToolTier properties here.

#Armor

Doesnt actually exist/work at the moment. Sorry.

#Food

ItemEvents.modification(event => {
  event.modify('minecraft:diamond', item => {
    item.foodProperties = food => {
        food.hunger(2)
        food.saturation(3)
        food.fastToEat()
        food.eaten(foodData => foodData.player.tell('you ate')) // this is broken, use ItemEvents.foodEaten instead.
    }
  })

  event.modify('minecraft:pumpkin_pie', item => {
    item.foodProperties = null // make pumpkin pies inedible
  })
})
You can find full list of FoodBuilder methods here.