Item modification
This page is still under construction! Please yell at ChiefArug for publishing it too early.
Item modification is a startup event.
ItemEvents.modification
is a startup script event used to modify various 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
})
})
Available properties:
Property | Value Type | Description |
maxStackSize | int | Sets the maximum stack size for items. Default is 64 for most items. |
maxDamage | int | Sets the maximum damage an item can take before it is broken. |
craftingRemainder | Item | Sets the item left behind in the crafting grid when this item is used as a crafting ingredient (like milk buckets in the cake recipe). Most items do not have one. |
fireResistant | boolean | If this item burns in fire and lava. Most items are false by default, but Ancient Debris and Netherite things are not. |
rarity | Rarity | Sets the items rarity. This is mainly used for the name colour. COMMON by default. Nether Stars and Elytra are UNCOMMON, Golden Apples are RARE and Enchanted Golden Apples are EPIC. |
burnTime | int | Sets the burn time (in ticks) in a regular furnace for this item. Note that Smokers and Blast Furnaces burn fuel twice as fast. Coal is 1600. |
foodProperties | FoodProperties | Sets the items food properties to the provided properties. Can be null to remove food properties. |
foodProperties |
Consumer<FoodBuilder>
|
Sets the properties according to the consumer. See example below //TODO ADD LINK |
digSpeed | float | Sets the items digging speed to the number provided. See table below for defaults. |
tier |
Consumer<MutableToolTier>
|
Sets the items tier according to the consumer. See example below //TODO ADD LINK |
attackDamage | double | Adds an attack damage bonus. If this is a tool-type item then you should modify the tier instead. Can be negative. |
attackSpeed | double | Adds an attack speed bonus. If this is a tool-type item then you should modify the tier instead. Can be negative. |
armorProtection | double | Adds an armor protection bonus. Can be negative. |
armorToughness | double | Adds an armor toughness bonus. Can be negative. |
armorKnockbackResistance
|
double | Add an armor knockback resistance bonus. Can be negative. 1 is full knockback resistance. |
Tool defaults
Tier | maxDamage | digSpeed | attackDamage (this is a bonus, not the final value) |
Wood |
59 | 2 | 0 |
Stone | 131 | 4 | 1 |
Iron | 250 | 6 | 2 |
Diamond | 1561 | 8 | 3 |
Gold | 32 | 12 | 0 |
Netherite | 2031 | 9 | 4 |
Armor defaults
All boxes with multiple values are formatted [head, chest, legs, feet]. Boxes with single values are the same for every piece.
Tier |
maxDamage |
armourProtection |
armorToughness | armorKnockbackResistance |
Leather | [65, 75, 80, 55] | [1, 2, 3, 1] | 0 | 0 |
Chain | [195, 225, 240, 165] |
[1, 4, 5, 2]
|
0 | 0 |
Iron | [195, 225, 240, 165] |
[2, 5, 6, 2]
|
0 | 0 |
Gold | [91 ,105, 112, 77] |
[1, 3, 5, 2]
|
0 | 0 |
Diamond | [429, 495, 528, 363] |
[3, 6, 8, 3]
|
2 | 0 |
Turtle (only has helmet) | [325, nil, nil. nil] |
[2, nil, nil, nil]
|
0 | 0 |
Netherite | [481, 555, 592, 407] |
[3, 6, 8, 3]
|
3 | 0.1 |
Elytra (not actually armor) | [nil, 432, nil, nil] | 0 | 0 | 0 |
Tier
Options for modifying tiers
Property | Value Type | Description |
uses | int | The maximum damage before this tool breaks. |
speed | float | The digging speed of this tool. |
attackDamageBonus | float | The bonus attack damage of this tool. |
level | int | The mining level of this tool. |
enchantmentValue | int | The enchanting power of this tool. The higher this is, the better the enchantments at an Enchanting Table are. |
repairIngredient | Ingredient | The material used to repair this tool in an anvil. |