Skip to content

Process

Strengthening combines target equipment, a recipe, materials, success chance, and failure results. Follow the flow when debugging: first check whether the recipe matches, then materials and costs, and finally PDC writes and presentation refresh.

Standard flow

text
┌─────────────────────────────────────────────────────────────┐
│ 1. Player opens the strengthen GUI                           │
│ 2. Insert target equipment → read current star and temper    │
│ 3. Match an available recipe through the match rules         │
│ 4. Validate materials, costs, conditions, and star limit     │
│ 5. Compute success rate (base + temper bonus, clamped)       │
│ 6. Fire StrengthenPreAttemptEvent (cancellable, rate-writable)│
│ 7. Roll the outcome → success / failure                      │
│ 8. Rebuild the item and write the strengthen layer           │
│ 9. Charge economy costs                                      │
│ 10. Fire JavaScript result hooks and StrengthenAttemptEvent  │
│ 11. Run that star's actions.success / actions.failure        │
│ 12. Broadcast on first reach of a broadcast star             │
│ 13. Settle escrow on the owner thread, refresh GUI/inventory │
└─────────────────────────────────────────────────────────────┘

Troubleshooting entry points

SymptomCheck first
GUI says strengthening is unavailableRecipe match, current star, limits.max_star, and the stars node.
Insufficient materials after clickingmaterials, item sources, amounts, and the player's actual inventory.
Currency shortage or charge issueseconomy.currencies, the economy provider, and cost_formula.
Star level does not changeWhether the strengthen layer was written, and whether failure downgrade or a protection material applied.
Lore is not refreshedWhether CoreLib assembly ran; use /estrengthen refresh if needed.

Stage details

Stages 1-2: opening the GUI and item recognition

After opening the strengthen GUI, the player places the target item into the designated slot. The module:

  • Reads the item's current strengthen layer (star, temper level, milestone flags, success/failure counts, branch path).
  • Treats an item without a strengthen layer as +0.

Stage 3: recipe matching

The recipe match node supports the following rules:

RuleDescription
source_idsBind exactly to EmakiItem / ItemSource identifiers. Recommended.
source_typesMatch by item source type.
source_patternsMatch by item source pattern.
slot_groupsCoarse slot/equipment type groups (weapon/armor/offhand/generic), not concrete equipment slots.
lore_containsLore contains the given text.
stats_anyHas any of the given attributes.

The current star must also be below limits.max_star, and the target star must have a matching entry in stars.

Stage 4: validation

CheckFailure behavior
Required material amountsReports insufficient materials and blocks the attempt.
Economy balanceA failed charge returns an uncommitted result.
Condition checkReturns strengthen.error.condition_not_met when conditions are unmet.
Star limitBlocks the attempt once limits.max_star is reached.

Protection materials and temper materials are detected here but never required.

Stage 5: success rate

text
rate = target-star base rate + effective temper × temper_chance_bonus_per_level
final rate = clamp(rate, 0, success_chance_cap)
  • The target-star base rate is taken from the recipe success_rates entry for that star; when the recipe does not define one, it falls back to the global success_rates in config.yml.
  • Effective temper = clamp(current temper + material temper_boost, 0, max_temper).

Stages 6-7: event and roll

StrengthenPreAttemptEvent fires on the main thread. It is cancellable and its success rate can be rewritten with setSuccessRate. A random number in [0, 100) is then drawn; a value below the rate means success.

Stage 8: writing the strengthen layer

OutcomeStarTemper
SuccessRaised to the target starReset to 0
Failure (target star < 6)UnchangedTemper gain added
Failure (target star ≥ 6, no protection)Drops 1 star, floor 0Temper gain added
Failure (protection material used)UnchangedTemper gain added

Temper gain is +1 when the target star is 8 or below and +2 above 8, then clamped to limits.max_temper.

Both success and failure update the item's success count, failure count, and last attempt time; success additionally records first-reach star milestones.

Stages 9-13: charging, actions, and safe settlement

  • Economy costs are charged only after the item rebuild succeeds; a failed charge leaves the attempt uncommitted.
  • JavaScript result hooks and StrengthenAttemptEvent fire during settlement.
  • That star's actions.success / actions.failure receive a mutable item_target, and the final item is read only after the action chain completes.
  • Reaching a star in broadcast.local_stars or broadcast.global_stars for the first time sends a broadcast; see Broadcast.
  • The final item, unconsumed materials, and other escrow content are settled only on the player's owner thread, after which the GUI and inventory refresh.

Pending settlement and recovery

A completed result is retained as pending settlement when the player is offline or entity scheduling is rejected. The module does not deliver early or discard escrow:

  • A player join retries settlement on that player's owner thread.
  • Opening the strengthen GUI also retries pending settlement.
  • Closing the GUI or reloading configuration does not clear committed pending settlement.
  • Settlement records completion phases. If the result item was delivered but a later material-return step failed, a retry resumes the remaining phase without delivering the result item again.
  • A pending entry is removed only after every settlement phase completes, keeping retries idempotent.

The pending queue is an in-process recovery mechanism; this page does not claim persistence across a full server restart.

Temper

Temper is a level accumulated on failure that compensates for losing streaks:

  • Each failure adds 1 or 2 temper levels depending on the target star, capped at limits.max_temper.
  • Each temper level raises the next attempt's success rate by limits.temper_chance_bonus_per_level.
  • Temper resets to 0 after a successful strengthen.
  • Materials can define temper_boost to supply extra temper bonus for the current attempt.
  • Administrators can clear the main-hand item's temper with /estrengthen clearcrack.

Temper state is stored in the strengthen layer PDC.

Milestone stars

stars.<star>.name names a star for GUI display. The item state records the set of stars reached for the first time, which prevents duplicate broadcasts.

At a milestone star you can trigger the following through that star's effects and actions:

  • Extra attributes (ea_attribute) and skill attachment (es_skill).
  • Name prefixes or lore markers (name_action / lore_action).
  • Success actions such as broadcasts, sounds, and titles.

Action nodes

The actions node of a star stage supports two keys:

NodeTrigger
actions.successAfter a successful strengthen at that star.
actions.failureAfter a failed strengthen at that star.

Action example

yaml
stars:
  8:
    name: "<gold>Damage Boost</gold>"
    actions:
      success:
        - 'sendtitle title="<gold><bold>+8 Damage Boost</bold></gold>" subtitle="<yellow>Bonus damage unlocked</yellow>"'
        - "playsound sound=minecraft:entity.player.levelup volume=1.1 pitch=1.2"
      failure:
        - 'sendmessage text="<red>Strengthening failed, currently +%star%.</red>"'
        - "playsound sound=minecraft:block.anvil.destroy volume=1 pitch=0.8"

See Placeholders for the placeholders available in action lines.