Skip to content

KubeJS Integration

Zetakron edited this page Oct 29, 2026 · 1 revision

KubeJS Integration Guide

1. Crusher Recipes (conveyorandautomation:crushing)

ServerEvents.recipes(event => {
  // Example 1: Standard Crushing (Raw Iron -> 2x Iron Dust)
  event.custom({
    type: 'conveyorandautomation:crushing',
    ingredient: { item: 'minecraft:raw_iron' },
    result: {
      id: 'conveyorandautomation:iron_dust',
      count: 2
    },
    crush_time: 100 // 5 seconds (20 ticks = 1 second)
  })

  // Example 2: Crushing with Secondary Bonus Output (25% chance for 3 Iron Nuggets)
  event.custom({
    type: 'conveyorandautomation:crushing',
    ingredient: { item: 'minecraft:iron_ore' },
    result: {
      id: 'conveyorandautomation:iron_dust',
      count: 2
    },
    secondary: {
      id: 'minecraft:iron_nugget',
      count: 3
    },
    secondary_chance: 0.25, // 0.25 = 25% drop rate
    crush_time: 120 // 6 seconds
  })

  // Example 3: Tag Input for Modpack Ore Unification
  event.custom({
    type: 'conveyorandautomation:crushing',
    ingredient: { tag: 'c:ores/gold' },
    result: {
      id: 'conveyorandautomation:gold_dust',
      count: 2
    },
    secondary: {
      id: 'minecraft:clay_ball',
      count: 1
    },
    secondary_chance: 0.10, // 10%
    crush_time: 80
  })
})

Parameter Reference

Parameter Type Required Default Notes
type String Yes — 'conveyorandautomation:crushing'
ingredient Object Yes — Item ({ item: '...' }) or Tag ({ tag: '...' })
result Object Yes — Primary result: { id: '...', count: 1 }
secondary Object No empty Bonus result: { id: '...', count: 1 }
secondary_chance Float No 0.0 Probability between 0.0 and 1.0 (e.g. 0.2 = 20%)
crush_time Integer No 80 Duration in ticks (20 ticks = 1 second)

2. Conveyor Smelter Recipes (conveyorandautomation:conveyor_smelting)

ServerEvents.recipes(event => {
  // Example 1: Fast In-line Smelting (3 seconds instead of vanilla 10s)
  event.custom({
    type: 'conveyorandautomation:conveyor_smelting',
    ingredient: { item: 'conveyorandautomation:copper_dust' },
    result: {
      id: 'minecraft:copper_ingot',
      count: 1
    },
    experience: 0.7, // XP awarded upon completion
    cookingtime: 60  // 3 seconds
  })

  // Example 2: In-line Recipe using Item Tags
  event.custom({
    type: 'conveyorandautomation:conveyor_smelting',
    ingredient: { tag: 'c:dusts/iron' },
    result: {
      id: 'minecraft:iron_ingot',
      count: 1
    },
    experience: 0.7,
    cookingtime: 80
  })
})

Parameter Reference

Parameter Type Required Default Notes
type String Yes — 'conveyorandautomation:conveyor_smelting'
ingredient Object Yes — Item or Tag object
result Object Yes — Output item: { id: '...', count: 1 }
experience Float No 0.1 Amount of XP dropped
cookingtime Integer No 100 Smelting duration in ticks (100 = 5s)

3. Removing Recipes

You can selectively remove recipes using KubeJS filter options:

ServerEvents.recipes(event => {
  // 1. Remove by Recipe Type (e.g. wipe all default crushing recipes)
  // event.remove({ type: 'conveyorandautomation:crushing' })

  // 2. Remove by Recipe Output
  event.remove({
    type: 'conveyorandautomation:crushing',
    output: 'conveyorandautomation:iron_dust'
  })

  // 3. Remove by Input
  event.remove({
    type: 'conveyorandautomation:crushing',
    input: 'minecraft:raw_gold'
  })

  // 4. Remove by exact Recipe ID
  event.remove({ id: 'conveyorandautomation:crushing/iron_ore' })
  event.remove({ id: 'conveyorandautomation:crushing/gold_ore' })
})

4. Managing Machine Tags via KubeJS

You can add or remove items from the mod's functional tags inside ServerEvents.tags:

// ServerEvents.tags('item', event => { ... })
ServerEvents.tags('item', event => {
  // Add custom modded fuel to all Conveyor & Automation machines
  event.add('conveyorandautomation:machine_fuels', 'my_mod:compressed_coal')
  event.add('conveyorandautomation:machine_fuels', 'my_mod:bio_pellet')

  // Prevent Item Vacuum from picking up junk items
  event.add('conveyorandautomation:vacuum_blacklist', 'minecraft:cobblestone')
  event.add('conveyorandautomation:vacuum_blacklist', 'minecraft:dirt')

  // Register custom modded boots to have belt slip immunity
  event.add('conveyorandautomation:conveyor_boots', 'my_mod:steel_boots')
})

// ServerEvents.tags('entity_type', event => { ... })
ServerEvents.tags('entity_type', event => {
  // Prevent Auto Slasher from attacking specific entities
  event.add('conveyorandautomation:slasher_blacklist', 'minecraft:iron_golem')
  event.add('conveyorandautomation:slasher_blacklist', 'minecraft:villager')
})