Resources, energy and fluids
Everything a machine stores or moves is a resource: energy, a fluid, an item, or whatever an addon adds (Mekanized adds chemicals and heat).
- A resource category is a kind of resource with its own unit: energy, fluids, items. Amounts are whole numbers in the category's base unit.
- A resource type is one resource of a category:
machineengine:fluid/waterin the fluid category.
Resources never turn into each other by themselves: a machine converts them explicitly, through a recipe.
What MachineEngine provides
| Key | What | Unit (config) |
|---|---|---|
machineengine:energy | The one shared energy | J |
machineengine:fluid | The fluid category, shared by all | mB |
machineengine:fluid/water | Water | mB |
machineengine:fluid/lava | Lava | mB |
machineengine:items | The item category: any Minecraft or CraftEngine item | items |
Every addon and definition uses the same energy and fluids, so any energy cable
or fluid pipe carries them. Units, decimal digits and the bucket size are set
under resources: in config.yml (restart to apply).
Your own resources
In any definitions file (plugins/MachineEngine/definitions/*.yml, see
YAML definitions):
A new fluid joins the global fluid category, so every fluid pipe and port takes it:
resource-types:
mypack:fluid/oil: {category: machineengine:fluid, color: '#2B2118'}
A resource of a new kind needs its own category first:
resource-categories:
mypack:mana: {unit: MP, scale: 0}
resource-types:
mypack:mana: {category: mypack:mana, color: '#7B5CFF'}
| Key | Meaning |
|---|---|
category | The category the type belongs to. |
color | Optional. Its color in menus, "#RRGGBB" (quote it): tinted bars and slot colors. |
unit (category) | Unit shown after amounts. |
scale (category) | Decimal digits shown, 0 to 18: with 3, an amount of 1500 is shown as 1.500. |
Resource types and categories need a restart to change.
A type's color is part of the type. Water and lava take theirs from
resources.fluid.water-color and lava-color in config.yml. A type without a
color shows white. Menus read it with the placeholder storage_<id>_color.
Tags
Tags group resources or items under one key, so a filter or recipe can accept
any of them. Like recipes, they reload with /machineengine reload tags.
item-tags:
c:ores/osmium: [mekanized:osmium_ore, '#minecraft:iron_ores'] # #tag includes another tag
resource-tags:
mypack:hot_fluids: [machineengine:fluid/lava, mypack:fluid/oil]
Filters
Storages, ports and recipe inputs take a filter: which resources fit.
| Filter | Matches |
|---|---|
{ any: true } | Anything |
{ type: machineengine:energy } | One resource type |
{ types: [a:x, a:y] } | Any of these types |
{ category: machineengine:fluid } | Any resource of a category |
{ tag: mypack:hot_fluids } | A resource tag |
{ item: minecraft:raw_iron } | One item (Minecraft or CraftEngine id) |
{ item-tag: c:ores/osmium } | An item tag |
{ all: [ … ] }, { any-of: [ … ] } | All of, or any of, other filters |
{ not: { … } } | Anything the inner filter does not match |
In a recipe input, the same map takes an amount:
{ item: minecraft:raw_iron, amount: 2 }.
Items that hold resources
Batteries, tanks and canisters are CraftEngine items with
machineengine:energy_item or machineengine:resource_item — see
Blocks and items.