Custom Block/Item

Create a custom block and item for your machine

By default all machines share the same block (id: custommachinery:custom_machine_block) and the same item (id: custommachinery:custom_machine_item) and are differentiated by their NBT tag (like enchanted books for example).

This can cause issue when some mod can't differentiate blocks/items by NBT (questing mods, guidebook, ponders...).

However you can use KubeJS to create a custom block and custom item for the machine.

The following script MUST be put on the startup_scripts folder and be the same on both the server and the client.

//Subscribe to the block registry event.
//No need to use the item registry event, the item will be created automatically.
StartupEvents.registry('block', event => {
	//Syntax : event.create("namespace:block_id", "custommachinery").machine("namespace:machine_id)
	event.create("kubejs:stone_generator", "custommachinery").machine("custommachinery:stone_generator")
	
	//If the block id is the same than the machine id you don't have to use .machine()
	event.create("custommachinery:power_crusher", "custommachinery")
	
	//Add .occlude() to make the machine block full opaque (block light)
	//This may cause rendering issues
	event.create("custommachinery:power_crusher", "custommachinery").occlude()
})

Last updated