Creating a custom machine with datapack

The basics of creating custom machine using json.

The json file

Custom Machines json files should be located in datapacks/<datapack>/data/<namespace>/machine/<machine>.json

  • <datapack> : The name of your datapack, can be whatever you want.

  • <namespace> : The namespace of your machine, must be lowercase without spaces or special characters.

  • <machine> : The id of your machine, must be lowercase without spaces or special characters except "_" and "/".

Each machines loaded in the game should have a different ID, in the example above the machine Id is : namespace:machine

You can put any number of machines under the same namespace or separate them.

You can also use subfolders like : datapacks/datapack/data/namespace/machine/tier1/machine.json so the machine ID will be namespace:tier1/machine

Just remember that all the machines json files should be under the machine folder.

Machine properties

The machine json has 1 mandatory property and 7 optional properties.

Mandatory properties

Name

Name : name

Description :

The name of the machine, not to be confused with the ID of the machine (which is the path to the machine json).

It will be the name of both the machine item and the jei category for this machine recipes.

It will also be displayed in The One Probe when the player is pointing the machine block.

The specified name must be a string, any characters are allowed (as long as Minecraft can parse it), it can also be a lang key or a Text Component to add more customization options.

Examples :

//Raw string
"name": "My cool machine"

//Lang key
"name": "machine.example.cool"

//Text component
"name": {
    "text": "My cool machine",
    "color": "red"
}

Optional properties

Tooltips

Name : tooltips

Description :

A list of tooltips that will be displayed when the player cursor hover the machine item in a gui.

The tooltips can be a raw string or a Text Component.

Each tooltips of the list will be displayed in a new line.

Examples :

//Raw string
"tooltips": "That machine is really cool"

//List of strings
"tooltips": ["That machine is really cool", "Try it and see"]

//Text component
"tooltips": {
    "text": "That machine is really cool",
    "color": "red"
}

//List of text components
"tooltips": [
    {
        "text": "That machine is really cool",
        "color": "red"
    },
    {
        "text": "Try it and see",
        "bold": true
    }
]

Empty template

An empty template of a machine json with all it's properties.

machine.json
{
    "name": "",
    "appearance": {},
    "tooltips": [],
    "components": [],
    "gui": [],
    "jei": [],
    "catalysts": []
}

Examples

You can download the test datapack here.

See a few examples of custom machines in the test datapack.

Last updated