Skip to main content

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,You incan KubeJSchain 3builder formethods MCas 1.16:much as you like
  event.create('test_item'test_item_2').displayName(maxStackSize(16).glow(true)
  
  // You can specify item type as 2nd argument in create(), some types have different available methods
  event.create('Testcustom_sword', Item''sword').tier('diamond').attackDamageBaseline(10.0)
})

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

    ValidOther methods item tiers:builder supports: [you can chain these methods after create()]

    • SwordsmaxStackSize(size)
    +unstackable() Tools:maxDamage(damage) burnTime(ticks) containerItem(item_id) rarity('rarity') tool(type, level) glow(true/false) tooltip(text...) group('group_id') color(index, colorHex) texture(customTexturePath) parentModel(customParentModel) food(foodBuilder => ...)

    Methods available if you use 'sword', 'pickaxe', 'axe', 'shovel' or 'hoe' type:

      tier('toolTier') modifyTier(tier => ...) // Same syntax as custom tool tier, see below attackDamageBaseline(damage) // You only want to modify this if you are creating a custom weapon such as Spear, Battleaxe, etc. attackDamageBonus(damage) speedBaseline(speed) // Same as attackDamageBaseline, only modify for custom weapon types speed(speed)

      Valid tool tiers:

      • wood
      • stone
      • iron
      • gold
      • diamond
      • netherite

      Methods available if you use 'helmet', 'chestplate', 'leggings' or 'boots' type:

        tier('armorTier') ArmormodifyTier(tier => ...) // Same syntax as custom armor tier, see below

        Valid armor tiers:

        • 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
          })
        })