Skip to content

KubeJS


Introduction

All recipes of Thorium Reactors are normal data pack recipes (JSON). So KubeJS works without any extra integration: you add recipes with event.custom(...) and remove or replace them with the normal KubeJS filters.

All recipe types have the id thoriumreactors:<type>. Put the scripts in kubejs/server_scripts/ and reload with /reload.



Recipe types

Type Machine Input Output
thoriumreactors:thorium_crafting Thorium Crafting Table 5x5 pattern item
thoriumreactors:blasting Blast Furnace slot-0 (+ slot-1) slot-0 (+ slot-1 with chance)
thoriumreactors:alloying Alloy Smelter slot-0 (+ slot-1, slot-2), each with count slot-0 with count
thoriumreactors:plate_pressing / thoriumreactors:rod_pressing Plate Press / Rod Press slot-0 with count slot-0 with count
thoriumreactors:concentrating Concentrator slot-0 slot-0
thoriumreactors:decomposing Decomposer slot-0 + tank-0 tank-0
thoriumreactors:oxidizing Oxidizer slot-0 + tank-0 tank-0
thoriumreactors:fluid_enriching Fluid Enricher slot-0 + tank-0 tank-0
thoriumreactors:centrifuging Centrifuge tank-0 tank-0
thoriumreactors:crystallizing Crystallizer tank-0 slot-0
thoriumreactors:evaporating Evaporator tank-0 slot-0
thoriumreactors:electrolysing Electrolyzer tank-0 slot-0 (+ tank-0, chance)
thoriumreactors:salt_smelting Salt Melter slot-0 to slot-2 tank-0
  • Items are written as {item: 'mod:id'} or {tag: 'forge:ingots/iron'} (inputs), results as {item: 'mod:id', count: 2} where a count is supported.
  • Fluids are written as {FluidName: 'minecraft:water', Amount: 100} (Amount in mB).
  • ticks is the duration, temperature (blast furnace, salt melter) is limited to 2500 and ticks of the blast furnace to 2500.
  • operationAfterTicks (1 to 1000) says after how many ticks the fluid part is processed.
  • chance is the chance in percent (1 to 100, default 100) for the second / optional output.

Thorium Crafting Table

The pattern can be up to 5x5, the keys can be items or tags. Use event.custom because the recipe needs the larger pattern.

kubejs/server_scripts/thorium_crafting.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:thorium_crafting',
        pattern: [
            '  X  ',
            ' ARA ',
            ' EPE ',
            ' ARA ',
            '  X  '
        ],
        key: {
            A: { tag: 'forge:ingots/aluminum' },
            E: { tag: 'thoriumreactors:module_io' },
            P: { tag: 'thoriumreactors:redstone_processor' },
            R: { tag: 'forge:dusts/redstone' },
            X: { tag: 'forge:nuggets/iron' }
        },
        result: { item: 'thoriumreactors:acceleration_upgrade' }
    })
})

Machine recipes

Blast Furnace

blasting.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:blasting',
        ticks: 200,
        temperature: 700,
        input: { 'slot-0': { tag: 'forge:raw_materials/bauxite' } },
        output: {
            'slot-0': { item: 'thoriumreactors:aluminum_ingot' },
            'slot-1': { item: 'thoriumreactors:aluminum_nugget' },
            chance: 30
        }
    })
})

Alloy Smelter

Every input has its own amount (count), the metals are melted one after the other (the time follows their melting point) before ticks runs.

alloying.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:alloying',
        ticks: 300,
        input: {
            'slot-0': { tag: 'forge:ingots/steel', count: 6 },
            'slot-1': { tag: 'forge:ingots/chromium', count: 1 },
            'slot-2': { tag: 'forge:ingots/molybdenum', count: 1 }
        },
        output: { 'slot-0': { item: 'thoriumreactors:chromoly_steel_ingot', count: 8 } }
    })
})

Concentrator

concentrating.js
1
2
3
4
5
6
7
8
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:concentrating',
        ticks: 400,
        input: { 'slot-0': { item: 'minecraft:coal' } },
        output: { 'slot-0': { item: 'minecraft:diamond' } }
    })
})

Fluid machines (Decomposer, Oxidizer, Fluid Enricher)

These need an item and a fluid and produce a fluid. Change type to decomposing or fluid_enriching for the other machines.

oxidizing.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:oxidizing',
        ticks: 300,
        operationAfterTicks: 5,
        input: {
            'slot-0': { item: 'minecraft:iron_ingot' },
            'tank-0': { FluidName: 'minecraft:water', Amount: 100 }
        },
        output: { 'tank-0': { FluidName: 'minecraft:lava', Amount: 50 } }
    })
})

Centrifuge

centrifuging.js
1
2
3
4
5
6
7
8
9
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:centrifuging',
        ticks: 200,
        operationAfterTicks: 10,
        input: { 'tank-0': { FluidName: 'minecraft:water', Amount: 100 } },
        output: { 'tank-0': { FluidName: 'minecraft:lava', Amount: 100 } }
    })
})

Crystallizer and Evaporator

A fluid becomes an item. Use type: 'thoriumreactors:evaporating' for the Evaporator.

crystallizing.js
1
2
3
4
5
6
7
8
9
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:crystallizing',
        ticks: 300,
        operationAfterTicks: 10,
        input: { 'tank-0': { FluidName: 'minecraft:water', Amount: 1000 } },
        output: { 'slot-0': { item: 'minecraft:ice' } }
    })
})

Electrolyzer

The item and the second fluid are optional, chance (1 to 100) applies to the item.

electrolysing.js
1
2
3
4
5
6
7
8
9
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:electrolysing',
        ticks: 300,
        operationAfterTicks: 1,
        input: { 'tank-0': { FluidName: 'minecraft:lava', Amount: 1 } },
        output: { 'slot-0': { item: 'minecraft:gold_nugget' }, chance: 40 }
    })
})

Salt Melter

salt_smelting.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
ServerEvents.recipes(event => {
    event.custom({
        type: 'thoriumreactors:salt_smelting',
        ticks: 800,
        operationAfterTicks: 8,
        temperature: 700,
        input: {
            'slot-0': { tag: 'forge:raw_materials/potassium' },
            'slot-1': { tag: 'forge:raw_materials/thorium' },
            'slot-2': { tag: 'forge:raw_materials/sodium' }
        },
        output: { 'tank-0': { FluidName: 'thoriumreactors:molten_salt', Amount: 1 } }
    })
})

Remove and change recipes

The normal KubeJS filters work with every Thorium recipe:

remove.js
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
ServerEvents.recipes(event => {
    // one recipe by id
    event.remove({ id: 'thoriumreactors:blasting/aluminum_ingot_from_raw' })

    // all recipes of one machine
    event.remove({ type: 'thoriumreactors:concentrating' })

    // all recipes of the mod that craft an item
    event.remove({ mod: 'thoriumreactors', output: 'thoriumreactors:acceleration_upgrade' })
})

To change a recipe, remove it and add your own version with event.custom. You can also give your own recipe a fixed id:

event.custom({ /* ... */ }).id('kubejs:my_blast_recipe')

Tags and items

The mod uses tags for its ingredients (for example forge:ingots/aluminum, forge:raw_materials/thorium). Add your own items to them:

tags.js
1
2
3
ServerEvents.tags('item', event => {
    event.add('forge:ingots/aluminum', 'mymod:aluminium_ingot')
})

Note

Wrong values (like a pattern larger than 5x5 or a negative ticks) are rejected when the recipe loads and the recipe is skipped. The reason is written to logs/latest.log and kubejs/logs/server.log.