Skip to content

CoreLib Actions

When EmakiItem is enabled, it adds main-hand update, rerender, repair, durability, and vanilla Data Component add/modify/remove actions to the CoreLib action registry.

This page documents only CoreLib actions registered by EmakiItem. CoreLib built-in actions are documented in CoreLib Actions. Current action IDs use only the canonical names below; historical aliases are not registered.

Action IDs

Action IDPurposeParameters
emakiitem_updateForces the main-hand item through EmakiItem's update service.none
emakiitem_rerenderRebuilds the main-hand item presentation through CoreLib item assembly.none
emakiitem_repair_amountRepairs the main-hand item by a damage amount.amount
emakiitem_damageAdds damage to the main-hand item.amount
emakiitem_set_damageSets the main-hand item's current damage value.value
emakiitem_set_durabilitySets the main-hand item's remaining durability value.value
emakiitem:component_addAdds one Data Component and fails if it is already present.component, value, optional slot
emakiitem:component_modifyModifies an existing Data Component and fails if it is absent.component, value, optional slot
emakiitem:component_removeRemoves one Data Component and idempotently skips if it is absent.component, optional slot

Parameters

ParameterTypeRequiredDefaultDescription
amountINTEGERRequired by repair/damage actions0Repair or damage amount. Negative values are treated as 0.
valueINTEGERRequired by durability set actions0Target damage value or target remaining durability value.
componentSTRINGRequired by component actionsnoneData Component ID. IDs without a namespace resolve as minecraft:.
valueSTRINGRequired by add/modifynoneJSON-ish value: JSON objects/arrays, quoted strings, booleans, numbers, null, and plain strings are supported. Malformed structured values fail validation.
slotSTRINGNoAutomatic target resolutionExplicit player inventory slot. An invalid explicit value fails instead of silently falling back.

Component target resolution

Component actions resolve their target in this order:

  1. An explicit action slot parameter.
  2. The standard mutable Action holder item_target (CoreActionItemTarget).
  3. Compatibility context keys: item, itemStack, item_stack, resultItem, result_item, targetItem, and target_item.
  4. The current player's main hand.

Forge and Strengthen result actions provide item_target. After component actions update that holder, the calling module waits for the action chain, reads the final stack, and performs delivery. The component action does not insert a result item into the inventory early.

Supported slots

  • Main hand: main, mainhand, main_hand, hand, held, held_item, selected
  • Off hand: offhand, off_hand
  • Armor: head / helmet / armor_head, chest / chestplate / armor_chest, legs / leggings / armor_legs, feet / boots / armor_feet
  • Numeric slots: 0 through 40, including slot_12 and inventory_12
  • Hotbar: hotbar_0 through hotbar_8

Examples

yaml
actions:
  - 'emakiitem_update'
  - 'emakiitem_repair_amount amount=25'
  - 'emakiitem:component_add component=max_stack_size value=16'
  - 'emakiitem:component_modify component=enchantment_glint_override value=true slot=mainhand'
  - 'emakiitem:component_remove component=custom_name slot=offhand'

Use Action quoting for values containing spaces or structured content:

text
emakiitem:component_modify component=custom_name value='<gold>Forged Blade</gold>'
emakiitem:component_add component=custom_data value='{"emaki":{"source":"forge"}}'

Notes

  • Update and durability actions require a player context and operate on the main-hand item; they return skipped when the main hand is empty.
  • Update and durability actions return changed, damage, and max_damage data.
  • emakiitem_set_durability makes no change when the item has no maximum durability. Damage values are clamped to [0, max_damage], and dropping below the maximum clears the repair disabled flag.
  • Component actions may target an explicit slot, a cross-module result holder, or a context ItemStack. They fail when no usable target exists.
  • Component patches are applied through CoreLib ConfiguredItemDefinition, preserving third-party source identity, PDC, and unrelated components.
  • Component actions return operation, component, target, changed, existed_before, warnings, and issues data for later actions and diagnostics.