Creating Active Blocks
An Active Block is a block that changes its model when the multiblock it is a part of is running, like the Engine Intake Casing or the Assembly Line casing.
You can create one in KubeJS's block registry event by adding 'gtceu:active'
as the block type.
The blockstate JSON will be autogenerated for you.
Three standard types are available, .simple()
, .firebox()
, and .bloom()
:
.simple(texture)
creates a block that uses the same texture on all 6 sides and switches between its inactive and active textures. The active texture must have the_active
suffix..firebox(bottom, side, top)
creates a firebox casing that will light up with flames when active..bloom(texture)
creates a block that lights up when active, like the Assembly Line casing. The bloom texture must have the_bloom
suffix.
When using these three standard types, the block's model JSON is automatically generated for you.
If you want to make a more intricate Active Block, you can omit the standard type and instead provide your own model JSON files.
You need two model files - one for the base state and one for the active state - placed at models/block/BLOCK_ID.json
and models/block/BLOCK_ID_active.json
in your KubeJS assets.
Example Script
StartupEvents.registry('block', event => {
event.create('custom_engine_intake_casing', 'gtceu:active')
.simple('kubejs:block/casings/custom_engine_intake')
// The active texture should be 'kubejs:block/casings/custom_engine_intake_active'
.displayName('Test Engine Intake')
.soundType('metal')
.resistance(6).hardness(5)
.tagBlock("mineable/pickaxe")
.tagBlock("forge:mineable/wrench")
.requiresTool(true)
event.create('custom_firebox', 'gtceu:active')
.firebox('gtceu:block/casings/solid/machine_casing_bronze_plated_bricks',
'gtceu:block/casings/firebox/machine_casing_firebox_bronze',
'gtceu:block/casings/solid/machine_casing_bronze_plated_bricks')
.displayName('Test Firebox')
.soundType('metal')
.resistance(6).hardness(5)
.tagBlock("mineable/pickaxe")
.tagBlock("forge:mineable/wrench")
.requiresTool(true)
event.create('custom_bloom', 'gtceu:active')
.bloom('gtceu:block/casings/fusion/superconducting_coil')
// The bloom texture should be 'gtceu:block/casings/fusion/superconducting_coil_bloom'
.displayName('Test Bloom')
.soundType('metal')
.resistance(6).hardness(5)
.tagBlock("mineable/pickaxe")
.tagBlock("forge:mineable/wrench")
.requiresTool(true)
})