Custom Items
This is a startup_scripts/ event
// Listen to item registry event
onEvent('item.registry', event => {
// The texture for this item has to be placed in kubejs/assets/kubejs/textures/item/test_item.png
// If you want a custom item model, you can create one in Blockbench and put it in kubejs/assets/kubejs/models/item/test_item.json
event.create('test_item', item => {
item.displayName('Test Item')
})
// or, in KubeJS 3 for MC 1.16:
event.create('test_item').displayName('Test Item')
})
Other methods item builder supports: [you can chain these methods after displayName()]
- type('itemType')
- tier('itemTier')
- maxStackSize(size)
- unstackable()
- maxDamage(damage)
- burnTime(ticks)
- containerItem(item_id)
- tool(type, level)
- miningSpeed(speed)
- attackDamage(damage)
- attackSpeed(speed)
- rarity('rarity')
- glow(true/false)
- tooltip(text...)
- group('group_id')
- color(index, colorHex)
- texture(customTexturePath)
- parentModel(customParentModel)
- food(foodBuilder => ...)
Valid item types:
- basic (default)
- sword
- pickaxe
- axe
- shovel
- hoe
- helmet
- chestplate
- leggings
- boots
Valid item tiers:
- Swords + Tools:
- wood
- stone
- iron
- gold
- diamond
- netherite
- Armor
- leather
- chainmail
- iron
- gold
- diamond
- turtle
- netherite
Valid group/creative tab IDs:
- search
- buildingBlocks
- decorations
- redstone
- transportation
- misc
- food
- tools
- combat
- brewing
Creating custom tool and armor tiers
All values are optional and by default are based on iron tier
onEvent('item.registry.tool_tiers', event => {
event.add('tier_id', tier => {
tier.uses = 250
tier.speed = 6.0
tier.attackDamageBonus = 2.0
tier.level = 2
tier.enchantmentValue = 14
tier.repairIngredient = '#forge:ingots/iron'
})
})
onEvent('item.registry.armor_tiers', event => {
// Slot indicies are [FEET, LEGS, BODY, HEAD]
event.add('tier_id', tier => {
tier.durabilityMultiplier = 15 // Each slot will be multiplied with [13, 15, 16, 11]
tier.slotProtections = [2, 5, 6, 2]
tier.enchantmentValue = 9
tier.equipSound = 'minecraft:item.armor.equip_iron'
tier.repairIngredient = '#forge:ingots/iron'
tier.toughness = 0.0 // diamond has 2.0, netherite 3.0
tier.knockbackResistance = 0.0
})
})