# Custom Block/Item

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](https://www.curseforge.com/minecraft/mc-mods/kubejs) to create a custom block and custom item for the machine.

{% hint style="warning" %}
The following script MUST be put on the `startup_scripts` folder and be the same on both the server and the client.
{% endhint %}

```java
//Subscribe to the block registry event.
//No need to use the item registry event, the item will be created automatically.
onEvent('block.registry', 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")
})
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://frinn.gitbook.io/custom-machinery-1.18/mod-integrations/kubejs/custom-block-item.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
