Skip to main content

Resource

A resource defines a numeric entity resource that can be gained, consumed, converted or displayed, such as cultivation progress, spirit power or stamina.

File Location

Resource files go in data/<namespace>/mxt/resource/ within your datapack.

The filename corresponds to its ID. For example, data/example/mxt/resource/qi.json has the ID example:qi.

Fields

FieldTypeDefaultDescription
default_valueNumberProviderrequiredThe current value when the attachment is first created.
minNumberProvider0Lower bound of the resource.
maxNumberProviderrequiredDynamic upper bound; realm and absorbed aura variables may be used.
regenNumberProvider0Natural regeneration per tick.
burst_amountNumberProvider0When greater than 0 the resource can be consumed by the Fire Spirit Power keybind and is used as the value of each spirit power ray. Each datapack should configure only one default spirit power resource with this value greater than 0.
particle_colorRGBColor#FFFFFFParticle colour used by spirit power rays. May be written as #RRGGBB or as an integer in 0..16777215.
cultivation_to_resourceObjectmultiplier=1,max_per_tick=1Draws resource recovery from the cultivation progress counter.
resource_to_cultivationObjectmultiplier=1,max_per_tick=1Converts the resource back into cultivation progress, only while in cultivation mode.
barsList<ResourceBar>[]Inline resource bars; when empty, the resource is not displayed.
first_realmHolder<realm_stage>noneThe first realm of the realm chain this resource belongs to; it is only used to determine the target realm of a mortal's first breakthrough.
start_expNumberProvider0The cultivation progress required for a mortal's first breakthrough, and at the same time the cultivation progress cap of the mortal stage; once reached it no longer increases and only a breakthrough can be attempted.
start_cultivate_conditionsCultivateConditionsempty objectResource-level conditions checked when a mortal starts cultivating and before the first breakthrough; useful for conflict or identity restrictions. All resources that have a first realm must be satisfied before cultivation can start.
use_conditionEntityConditionmxt:always_trueControls whether the entity can actively consume the resource and decides whether the resource bars are shown; it does not affect cultivation, environmental absorption, natural regeneration or breakthrough.
show_cultivation_infoBooleantrueWhether the character information panel shows the realm and cultivation progress of this resource.

A CultivateConditions object contains conditions, optional triggers and an optional action. Starting cultivation and the breakthrough entry point check conditions immediately (all of them must be satisfied); only after the breakthrough stage is reached does the current resource register runtime subscriptions from triggers and attempt a breakthrough once a matching event fires. Subscriptions are never serialised directly: they are rebuilt from the cultivation state after a save is loaded or a datapack is reloaded.

cultivation_to_resource and resource_to_cultivation use the following two fields:

FieldTypeDefaultDescription
multiplierNumberProvider1Multiplier that converts the source value into the target value.
max_per_tickNumberProvider1Maximum source value consumed per tick; the limit applies to the source, not the target.

bars

bars is an inline array of resource, not a separate datapack registry.

context uses IDs from the built-in mxt:resource_bar_context registry. A context object extracts the current value, the minimum, the maximum and the time of the last change from the entity or the client state, and generates the display name from the resource ID that was passed in. Aura concentration contexts are split into mxt:environment_concentration (environment only) and mxt:actual_concentration (all sources); for example, when the language key of example:qi reads aura, the two contexts display environment aura concentration and actual aura concentration respectively. Built-in contexts also include mxt:self_hud, mxt:target_overlay and mxt:boss_overlay.

FieldTypeDefaultDescription
contextResourceBarContextmxt:self_hudContext built-in registry; extracts values, generates names and decides the layout.
anchorleft / rightrequiredLeft or right column of the self HUD.
orderInteger0Within the same column, a smaller value is closer to the vanilla hotbar.
visibilityResourceBarVisibilitymxt:alwaysWhether the bar is shown.
rendererResourceBarRendererrequiredHow the bar is drawn.
value_displaynone / current / current_and_maximum / percentagenoneHow the numeric text is displayed.
maximumPositive Doublecontext maximumOverrides only the display maximum of the bar; it does not change the server or context values.

Built-in renderers include mxt:boss_bar, mxt:textured_bar, mxt:segmented_bar, mxt:radial_bar and mxt:text_only. mxt:boss_bar accepts sprite_location, bar_index, icon_index and inverted, and uses mxt:textures/gui/resource_bar.png by default. Rendering is hooked in through the NeoForge GUI Layer; bars only appear in the left or right column and never occupy the centre of the screen.

Renderer parameters:

typeFieldsDefaultDescription
mxt:boss_barsprite_location, bar_index, icon_index, invertedsee aboveOrigins-style 71x8 bar and icon.
mxt:textured_barbackground_sprite, fill_sprite, width, height, fill_color, show_valuefill_color=#ffffff,show_value=falseUses two separate textures. Width and height range from 1 to 1024.
mxt:segmented_barsegments, gap, full_color, empty_colorgap=1,full_color=#ffffff,empty_color=#555555Segmented bar; segments ranges from 1 to 256.
mxt:radial_barradius, thickness, start_angle, end_angle, fill_colorstart_angle=0,end_angle=360,fill_color=#ffffffRadial bar.
mxt:text_onlyformat, color, show_maximum%current%,#ffffff,falseText only; the format supports %current%.

Visibility types: mxt:always, mxt:non_full, mxt:non_zero, mxt:recently_changed (hold_ticks defaults to 60), mxt:resource_range (requires min and max), mxt:and, mxt:or and mxt:not. mxt:non_zero is shown only while maximum - minimum > 0; when the difference is zero or negative the bar is hidden.

Example

Formulas in this table can use the resource and cultivation variables of this resource (realm, realm_rank, level, absorbed_aura, cultivation_progress) on top of the entity variables; the full list is in Formula Variables.

{
"default_value": 0,
"max": "100 + realm_rank * 20 + absorbed_aura * 0.1",
"regen": 0.25,
"burst_amount": 10,
"particle_color": "#66CCFF",
"cultivation_to_resource": {"multiplier": 1, "max_per_tick": 2},
"resource_to_cultivation": {"multiplier": 0.5, "max_per_tick": 1},
"bars": [
{
"context": "mxt:self_hud",
"anchor": "left",
"order": 0,
"renderer": {"type": "mxt:boss_bar", "bar_index": 1}
}
],
"first_realm": "example:foundation",
"start_exp": 100,
"use_condition": {
"type": "mxt:has_realm",
"resource": "example:qi"
},
"show_cultivation_info": true
}
Server-authoritative

Cultivation absorption by default only restores the resource that belongs to the current realm, and reverse conversion is allowed only while in the cultivation state. max and regen are evaluated on the server; the client takes no part in the settlement.

Aura concentration providers

The resource value providers mxt:environment_concentration and mxt:actual_concentration are computed on the server and synced to the client. The first returns only the environment template concentration, the second returns the final concentration including chunk stock, block and formation sources.

Display Names

Data-driven definitions no longer fill in a translation_key. Display names are generated automatically from the definition identifier through the vanilla Identifier.toLanguageKey, for example example:qi corresponds to resource.example.qi in the resource category; / in the path becomes .. Datapack authors only need to provide that key in their language file.