JSON & Javascript#
Create a file, for example, a mine-crafter.hjson
, in the content/blocks
folder.
content/
├─ blocks/
│ ├─ mine-crafter.hjson
multicraft.MultiCrafter
.
type: multicraft.MultiCrafter
You can add recipes like this:
recipes:
[
{
input: ozone/1.5
output: {
items: [
copper/1
graphite/2
]
power: 2.5
}
craftTime: 250.0
}
{
input: {
items: [
cyber-io-ic/1 // You can add moded items or fluids
lead // the same as "lead/1"
]
}
output: {
fluids: [
cyber-io-cyberion/1.2
]
}
craftTime: 210.0
}
]
Create a file, for example, a mine-crafter.json
, in the content/blocks
folder.
content/
├─ blocks/
│ ├─ mine-crafter.json
multicraft.MultiCrafter
.
"type": "multicraft.MultiCrafter"
You can add recipes like this:
"recipes": [
{
"input": "ozone/1.5",
"output": {
"items": [
"copper/1",
"graphite/2"
],
"power": 2.5
},
"craftTime": 250.0
},
{
"input": {
"items": [
"cyber-io-ic/1",
"lead"
]
},
"output": {
"fluids": [
"cyber-io-cyberion/1.2"
]
},
"craftTime": 210.0
}
]
In a JavaScript file, you should import the MultiCrafter
class from multi-cafter
const multi = require("multi-crafter/lib")
const mineCrafter = multi.MultiCrafter("mine-crafter")
mineCrafter.recipes= [
{
input: "ozone/1.5",
output: {
items: ["copper/1","graphite/2"]
power: 2.5
},
craftTime: 250.0
},{
input: {
items: ["cyber-io-ic/1", "lead"]
},
output: {
fluids: ["cyber-io-cyberion/1.2"]
},
craftTime: 210.0
}]
Recipe#
A recipe has several fields:
Field | Type | Note |
---|---|---|
input | Object, String or List | alias: [in ,i ] |
output | Object, String or List | alias: [out ,o ] |
crafterTime | Number | unit: tick | how long to do a synthesis, can be 0. |
icon | String | such as Icon.lock-open . See Icon |
iconColor | String | a hex color for icon |
Input and Output#
String#
The input
or output
can be a String
.
If so, it will be considered as an item or fluid.
If there is no amount given, 1
will be the amount as default.
input: copper/2
output: water/1.2
"input": "copper/2",
"output": "water/1.2"
input: "copper/2",
output: "water/1.2"
List#
The input
or output
can be a List
.
If so, every element will be treated as an item or fluid.
input: [copper/2,lead/3]
output: slag/2.5
"input": ["copper/2","lead/3"],
"output": "slag/2.5"
input: ["copper/2","lead/3"],
output: "slag/2.5"
Object#
The input
or output
can be an Object
.
With this style, its power is unlimited.
Key | Type | Note |
---|---|---|
items | String or List | how much item for input/output, default: empty |
fluids | String or List | how much fluid for input/output, default: empty |
power | Number | unit: power/tick | how much power for input/output, default: 0 |
heat | Number | how much heat for input/output, default: 0 |
icon | String | such as Icon.lock-open . See Icon |
iconColor | String | a hex color for icon |
craftEffect | String | an independent craft effect for each recipe |
input: {
items: copper/10
heat: 5
}
output: {
items: moded-item/1
fluids: [
water/1.5, ozone/3
]
power: 1.5
}
"input": {
"items": "copper/10",
"heat": 5
}
"output": {
"items": "moded-item/1",
"fluids": [
"water/1.5", "ozone/3"
],
"power": 1.5
}
input: {
items: "copper/10",
heat: 5
},
output: {
items: "moded-item/1",
fluids: [
"water/1.5", "ozone/3"
],
power: 1.5
}
Icon#
You can customize which icon is used for your recipe selector menu.
If you don't set a dedicated icon, it will find the first one from the recipe.
For example:
icon: alphaaaa
iconColor: F30000
recipes: [
{
input: ozone/1.5
output:{
items : copper
power : 2
icon: alphaaaa
iconColor: "F30000"
}
craftTime : 250.0
}
{
input: copper
output:{
items : coal
icon: lock-open
}
craftTime : 120
}
]
icon = mono
menu: Simple
recipes:
[
{
input: copper
output: coal
craftTime : 60
icon: mono
}
{
input: copper
output: ozone
craftTime : 60
}
]
You can set it to a String
, it will find the proper icon automatically.
- For a built-in icon, it should start with
Icon.
, such asIcon.lock-open
orIcon.trash
. - For an icon from item, fluid, unit or block, it should be its name, such as
mono
,phase-heat
. - For any texture, it should be its name, such as
your-mod-icon
oralphaaaa
.