Name & Lore Operations
CoreLib provides a unified item name and lore operation system. All Emaki plugins use name_actions and lore_actions configuration sections to precisely control item name and description display.
The operation system is stateless — each render executes the full operation chain from scratch. When state changes (e.g., enhancement rollback), the system re-executes the operation chain with new variable values, automatically producing the correct display.
Name Operations (name_actions)
Execute precise modifications on item names. Operations execute in configuration order.
replace
Completely replace the item name. Clears all previous prefixes and suffixes.
name_actions:
- action: "replace"
value: "<gold>%quality_name% Flame Sword</gold>"prepend_prefix
Add a prefix before the name.
name_actions:
- action: "prepend_prefix"
value: "<red>[+%star%] </red>"append_suffix
Add a suffix after the name.
name_actions:
- action: "append_suffix"
value: " <gray>[%quality_name%]</gray>"regex_replace
Perform regex replacement on the name. Only effective after the name has been set via replace.
name_actions:
- action: "regex_replace"
regex_pattern: "\\[\\+\\d+\\]"
replacement: "[+%star%]"Lore Operations (lore_actions)
Execute precise modifications on item lore. Operations execute in configuration order.
append
Add content after the last lore line.
lore_actions:
- action: "append"
content:
- ""
- "<gray>Enhancement: <gold>+%star%</gold></gray>"prepend
Add content before the first lore line.
lore_actions:
- action: "prepend"
content:
- "<gradient:#F2C46D:#C9703D>Enhancement +%star%</gradient>"
- ""insert_below
Insert content below the matching line. Aliases: search_insert_below, search_insert.
lore_actions:
- action: "insert_below"
anchor: "Physical Damage"
content:
- "<gray>Enhancement bonus: <gold>+%physical_attack%</gold></gray>"insert_above
Insert content above the matching line. Alias: search_insert_above.
lore_actions:
- action: "insert_above"
anchor: "Quality"
content:
- ""
- "<yellow>Enhancement Effects:</yellow>"replace_line
Replace the first matching line.
lore_actions:
- action: "replace_line"
anchor: "Enhancement Level"
content:
- "<gradient:#F2C46D:#C9703D>Enhancement +%star%</gradient>"delete_line
Delete all matching lines.
lore_actions:
- action: "delete_line"
anchor: "Old enhancement info"regex_replace
Perform regex replacement on all lore lines.
lore_actions:
- action: "regex_replace"
regex_pattern: "\\+\\d+"
replacement: "+%star%"Match Fields
The match text in insert_below, insert_above, replace_line, and delete_line operations supports multiple field names (by priority):
| Field | Priority | Description |
|---|---|---|
target_pattern | Highest | Match target text |
pattern | Medium | Match target text |
anchor | Lowest | Match target text |
Matching uses contains matching, not exact matching.
Variable Substitution
All value, content, anchor, replacement, and regex_pattern fields support %variable_name% format variable substitution.
Available variables depend on the plugin using the operations:
| Plugin | Available Variables |
|---|---|
| EmakiStrengthen | %star%, %temper%, %max_temper%, %temper_color%, and all variables values |
| EmakiForge | %quality%, %quality_name%, %multiplier%, %player_name%, %player_uuid%, and all forge attribute values |
| EmakiGem | %slot_index%, %slot_type%, %gem_name%, %gem_level% |
Rollback Mechanism
The operation system is stateless. Each render executes the full operation chain from scratch.
When enhancement rolls back (e.g., +10 fails back to +9):
- System recalculates variables with the rolled-back star level (
%star%=9, attribute values decrease accordingly) - Re-executes the entire
name_actionsandlore_actionsoperation chain - Automatically produces the correct +9 display
No "undo" operation is needed — re-execution produces the correct result. This is the core design advantage of the operation system.
Full Configuration Examples
EmakiStrengthen Recipe
name_actions:
- action: "append_suffix"
value: " <yellow>[+%star%]</yellow>"
lore_actions:
- action: "append"
content:
- ""
- "<gradient:#F2C46D:#C9703D>Enhancement +%star%</gradient>"
- "<gray>Temper: %temper_color%%temper%/%max_temper%</gray>"
- action: "insert_below"
anchor: "Physical Damage"
content:
- "<gray> Enhancement bonus: <gold>+%physical_attack%</gold></gray>"EmakiForge Recipe
name_actions:
- action: "prepend_prefix"
value: "<light_purple>[%quality_name%]</light_purple> "
lore_actions:
- action: "append"
content:
- ""
- "<gray>Forge Quality: <white>%quality_name%</white></gray>"
- "<gray>Quality Multiplier: <white>x%multiplier%</white></gray>"
- "<gray>Forged by: <white>%player_name%</white></gray>"