Skip to content

Unit

Currency System

Units are items that hold a value, and as such are the heart of the system. These items are exchanged, and have the option of providing randomly generated reward items whilst exchanging.

File path: <namespace>:currency/units.json

Warning

Unit recursion is unchecked, so it's possible to create items that automatically exchange into each other. It's highly recommended to avoid creating units that have equal values, as this could cause the items to swap every tick.

Format

File

Field Type Default Description
namespace:path Unit A unit entry. The field name must be a unique Identifier.

Unit

Field Type Default Description
item Identifier The unit's associated item.
value Integer The unit's value.
drops Boolean false Whether this unit drops rewards.
exchanges Object optional Controls cross-exchange rates for currency systems from other datapacks.

Exchanges

Field Type Default Description
namespace Integer The unit's value in the system defined by a datapack whose namespace is equal to the field name.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
{
    "astral:stick": {
        "item": "minecraft:stick",
        "value": 1
    },
    "astral:wood": {
        "item": "minecraft:oak_planks",
        "value": 4
    },
    "astral:log": {
        "item": "minecraft:oak_log",
        "value": 16,
        "drops": true
    }
}

A currency system that uses sticks, planks, and logs as its items. Rewards will be dropped when exchanging into logs.


Added: v1.2.0, Last Updated: v1.7.0