-
Notifications
You must be signed in to change notification settings - Fork 0
JSON API
Recipe Patcher is server-side dependency, which means that it should be installed only server-side, for example, when you host server or playing single-player. When you add integration with this library, make sure to notify users of your mod about this!
Recipe Patcher implements its own patching system. Any recipe can be patched (at the moment only grid recipes are supported!)
Patches are loaded from assets/<modid>/config/recipepatches
folder. Example.
There are currently three types of patches, each of them have their specific reasons to be used:
-
Replace
- replaces ingredients without changing output. -
Copy
- copies original recipe and then replaces ingredients and output. -
CopyReplaceIngredients
- copies original recipe and then replaces ingredients, but without changing output.
When all patches are applied, it will write log to server-main.txt
, for example:
28.4.2024 11:04:24 [Notification] [Recipe Patcher] RecipePatch Loader: completed in 131 ms, 516 patches total, successfully replaced 61 recipes, successfully created 183 recipes, unmet conditions on 322 patches
Replace
patches applied first, Copy
patches applied last.
Example:
{
"type": "Copy",
"conditions": [{ "when": "VanillaVariants_ArmorStand_Enabled", "isValue": "true" }],
"dependsOn": [{ "modid": "wildcrafttree" }],
"outputCode": "armorstand",
"outputCodeNew": "wildcrafttree:armorstand-{wood}",
"ingredients": [{ "ingredientCode": "plank-*", "Code": "wildcrafttree:plank-*", "Name": "wood", "SkipVariants": ["oak"] }]
}
If set to false
, patch won't be applied. For example:
"enabled": false
Available types: Replace
, Copy
, CopyReplaceIngredients
. For example:
"type": "Replace"
You need code for this to work.
Applies patch only if all config values in world config were matched. For example:
"conditions": [{ "when": "SomethingEnabled", "isValue": "true" }]
Applies patch only when specific mods are loaded / not loaded. For example:
"dependsOn": [{ "modid": "wildcrafttree" }]
Example for not loaded mod:
"dependsOn": [{ "modid": "wildcrafttree", "invert": true }]
Applies patch only when output code is matched. Supports wildcards and regex. For example:
"OutputCode": "bed-wood-head-north"
Example for wildcard:
"OutputCode": "log-*"
Changes output code to new code. For example:
"OutputCode": "bed-wood-head-north",
"OutputCodeNew": "modid:bed-{wood}-head-north",
In this example I used {wood}, because some ingredients have "name": "wood"
property
Applies patch only when output quantity is matched. For example:
"quantity": 1
Changes quantity of output. For example:
"quantityNew": 4
Applies patch only when attributes of output are matched. For example:
"attributes": { "type": "normal-generic" }
Changes attributes of output. For example:
"attributesNew": { "wood": "purpleheart" }
Changes recipe group of recipe. For example:
"recipeGroup": 2
Applies patch only to ingredients which code
matches IngredientCode
.
Applies patch only to ingredients that match code. Supports wildcards and regex. For example:
"ingredientCode": "log-placed-oak-ud"
Example for wildcard:
"ingredientCode": "log-*"
Will be marked as obsolete and renamed to
IngredientCodeNew
in the future
Changes matched ingredient code to new code. If not set, IngredientCode
will be used instead. For example:
"ingredientCode": "log-placed-*-ud"
Changes Name
property in matched ingredient to new name.
If not set, typed recipes with output code like "game:table-{wood}"
won't work. For example:
"name": "wood"
Applies patch only to ingredient that matches attributes. For example:
"attributes": { "type": "normal-generic" }
Changes attributes of matched ingredient. For example:
"attributesNew": { "wood": "purpleheart" }
Sets AllowedVariants
of matched ingredient, used in tandem with Name
and typed OutputCodeNew
. For example:
"allowedVariants": ["acacia", "maple", "pine"]
Sets SkipVariants
of matched ingredient, used in tandem with Name
and typed OutputCodeNew
. For example:
"skipVariants": ["oak"]