Skip to content

JSON Instruction Format

legoj15 edited this page May 31, 2026 · 1 revision

JSON Instruction Format

Files should be located in [...] On the very first line should be

~{buildcraft/json/insn}

Everything else must be a function call or a comment. There are 6 different builtin functions: debug, add, remove, replace, overwrite, modify, and alias.


Function arguments

Functions can take 3 different types of arguments: either numbers, strings, or multi-line strings. Numbers cannot contain spaces. Strings must be started and finished with a quote (") Multi-line strings must be started and finished with backticks (`) For example with the function "remove":

remove "buildcraftunofficial:oil"
remove `
buildcraftunofficial:oil
`

The remove function

This function will remove the entry with the given name. This takes 1 argument, the name. For example:

remove "buildcraftunofficial:chipset_diamond"

It is probably easiest to find out the name of entries by turning on debugging with debug "all".


The add function

This function will add an additional entry with the given name. This either takes 1 argument (the name), or 2 arguments (the name and then the json). For example:

add "item/wrench" `{
    "title": "item.wrenchItem.name",
    "tag_type": "item",
    "tag_subtype": "tool"
}`

If the json is missing then it will be loaded from the file specified by the name. For example if the function call is:

add "wrench"

And the insn file is in

"assets/buildcraftunofficial/compat/buildcraft/guide.txt"

then the wrench guide page will be loaded from

"assets/buildcraftunofficial/compat/buildcraft/guide/item/wrench.md"

The replace function

This function will remove an entry with the first name, and add an entry with the second name but only if the first entry was actually added by something else. This function takes two arguments: the name to remove, and the name to add. This also takes an optional third argument, the json to add. (This acts in exactly the same way as the add function, if you ignore the first argument).


The modify function

This function acts in a very similar way to the replace function, except that this will inherit the json tags from the removed entry.

For example if we wanted to add a combustion engine fuel recipe for oil and then have an addon mod layer in residue generation as a follow-up modification, we might do it like this:

add "oil" `{
 "fuel": {
  "id": "buildcraftunofficial:oil", "amount": 4
 },
 "power": 3
}`

Then an entry in the addon mod could look like this:

modify "buildcraftunofficial:oil" "oil" `{
 "residue": {
  "id": "buildcraftunofficial:oil_residue",
  "amount": 2
 }
}`

Which would result in only a single fuel recipe being added under the modifying mod's namespace, e.g. "myaddon:oil"

{
 "fuel": {
  "id": "buildcraftunofficial:oil", "amount": 4
 },
 "residue": {
  "id": "buildcraftunofficial:oil_residue",
  "amount": 2
 },
 "power": 3
}

(Note: combustion engine fuel recipes aren't configurable this way quite yet - you'll have to wait for the MJ update before this is actually valid)


Custom functions with alias

(TODO: Explanation)

alias "add_fuel" 2 `
 add "%0" \`{
  "fuel": {
    "id": "${domain}:%0"
  }
 }\`
`

Using pre-made alias files

(TODO: Explanation)

import "buildcraftunofficial:util"

Imported files must start with

~{buildcraft/json/lib}

and may optionally include an argument count

~args 3

BuildCraft Wiki

Home

Blocks

Items

Pipes

Triggers

Actions

Concepts & Mechanics

Configuration

Clone this wiki locally