Skip to main content

Modify Crafting (Power Type)

Changes the result item of a recipe crafted in the player's inventory or at a crafting table.

Type ID: apoli:modify_crafting

Fields

FieldTypeDefaultDescription
recipeIdentifieroptionalIf set, only the result of the recipe with this ID changes.
item_actionItem Action TypeoptionalIf set, this action runs on the recipe's result item.
item_action_after_craftingItem Action TypeoptionalIf set, this action runs on the result item after the recipe is crafted.
entity_actionEntity Action TypeoptionalIf set, this action runs on the player when they craft the recipe.
block_actionBlock Action TypeoptionalIf set, this action runs on the block used to craft the recipe.
item_conditionItem Condition TypeoptionalIf set, result and the actions only apply when the recipe's result item passes this condition.
resultItem StackoptionalIf set, this item replaces the recipe's result.

When each field runs

FieldWhen
result, item_actionWhile the result is shown in the crafting output slot. The changed stack is what the player sees and what they take.
item_action_after_crafting, entity_action, block_actionWhen the player takes the crafted item out of the result slot.

block_action runs on the block the player is crafting at, so it only fires at a crafting table. The 2 by 2 grid in the player's own inventory has no block, so the action is skipped there.

recipe is matched against the recipe's ID, which includes recipes added by apoli:recipe. For those, use the id you gave inside that power's recipe object.

Examples

{
    "type": "apoli:modify_crafting",
    "recipe": "minecraft:wooden_sword",
    "result": {
        "item": "minecraft:diamond_sword"
    }
}

This replaces the result of the vanilla minecraft:wooden_sword recipe (data/minecraft/recipe/wooden_sword.json on 1.21.1, recipes/ on 1.20.1) with a diamond sword, only for the player that has the power.

{
    "type": "apoli:modify_crafting",
    "recipe": "example:fire_sword_crafting",
    "item_action": {
        "type": "apoli:modify",
        "modifier": "example:fire_sword_modifier"
    },
    "entity_action": {
        "type": "apoli:play_sound",
        "sound": "minecraft:block.anvil_use"
    }
}

This applies to a recipe added by an apoli:recipe power, where example:fire_sword_crafting is the id inside that power's recipe object. The item modifier is applied to the result shown in the output slot, and the sound plays when the item is taken.