-
-
Notifications
You must be signed in to change notification settings - Fork 11
7 ‐ Datapack Support
As of v2.4.5, filling, emptying and infecting recipes are data-driven alongside Metamorpher recipes, and custom recipes may be added via datapacks. This page provides a guide on recipe formatting for datapack makers.
id field in result (where the item id of the result itemstack is passed in) is called item instead.
A standard Metamorpher recipe looks like this:
{
"type": "cognition:molecular_metamorphosis",
"ingredient1": {
"item": "cognition:astute_assembly"
},
"count1": 1,
"ingredient2": {
"tag": "minecraft:saplings"
},
"count2": 1,
"ingredient3": {
"item": "minecraft:gold_ingot"
},
"count3": 1,
"result": {
"id": "cognition:primordial_assembly",
"count": 1
},
"cost": 315,
"processTime": 100,
"id": "cognition:primordial_assembly"
}
Each of the ingredient fields accept either a singular item or an item tag representing a set of valid items. For instance, this recipe would accept any vanilla or modded item tagged with minecraft:saplings for the second ingredient. Each of the count fields represent the number of each ingredient required in each input slots for the recipe to be initiated. The result of the recipe goes in the result field, where additional data may be added to the result item stack using data components. Lastly, the cost field describes the cost of the recipe in experience points, while the processTime field describes the number of ticks it takes for the Metamorpher to process it.
All JSON Metamorpher recipes are shapeless, which is to say the arrangement of the ingredients in the Metamorpher's input slots does not matter. The only exceptions are the name formatting recipes, which are shaped (in order to make it clear to the Metamorpher which of the three inputs is the target item).
Should your recipe require only one or two input slots, one or more of the ingredients may be left blank by passing in an empty array [] as follows:
{
"type": "cognition:molecular_metamorphosis",
"ingredient1": {
"item": "minecraft:copper_ingot"
},
"count1": 1,
"ingredient2": {
"item": "cognition:cognitive_flux"
},
"count2": 2,
"ingredient3": [],
"count3": 0,
"result": {
"id": "cognition:cognitive_alloy",
"count": 1
},
"cost": 16,
"processTime": 20,
"id": "cognition:cognitive_alloy_metamorphosis"
}
A typical infecting recipe looks like this:
{
"type": "cognition:infecting",
"input": {
"tag": "c:bookshelves"
},
"result": {
"id": "cognition:infected_bookshelf",
"count": 1
},
"infectionCount": 1,
"id": "cognition:infected_bookshelf"
}
The input field accepts either a singular item or item tag, while the result field accepts an item stack. Both the input and result items must be block items for the recipe to work.
Two things of note:
- The
infectionCountfield exists only for convenience purposes when displaying recipes in JEI and does not do anything in-game. The property of being infected more than once for conversion is intrinsic to Fluorescent Agar, and counts greater than 1 will be ignored for any other block. - Even though this recipe deals with blocks, ingredient fields don't support block tags, meaning that only item tags can be used. You will have to make your own item tags if they don't already exist.
Typical filling recipes look like this:
{
"type": "cognition:filling",
"ingredient": {
"item": "minecraft:glass_bottle"
},
"result": {
"id": "minecraft:experience_bottle",
"count": 1
},
"cost_mB": 250,
"id": "cognition:experience_bottle_filling"
}
The ingredient field, once again, accepts either a singular item or tag, while the result field accepts an item stack. The amount of Cognitium in mB that is consumed from the Obelisk is set in the cost_mB field.
Emptying recipes are much the same, with the gain_mB field describing how much Cognitium is added to the Obelisk when the experience item is emptied.
The sole important difference is the hasResultStack field. When set to false, this will tell the Fountain to consume the experience item without leaving behind a result item. A valid item stack has to be present in the result field regardless, or the recipe will fail to parse.
{
"type": "cognition:emptying",
"ingredient": {
"item": "minecraft:experience_bottle"
},
"result": {
"id": "minecraft:glass_bottle",
"count": 1
},
"hasResultStack": true,
"gain_mB": 250,
"id": "cognition:experience_bottle_emptying"
}
A sample recipe that does not have a result item:
{
"type": "cognition:emptying",
"ingredient": {
"item": "forbidden_arcanus:xpetrified_orb"
},
"result": {
"id": "minecraft:barrier",
"count": 1
},
"hasResultStack": false,
"gain_mB": 1820,
"id": "cognition:xpetrified_orb_emptying"
}
Cognition adds loot to desert temple, ruined portal, mineshaft and stronghold library chests using the add_single_item loot modifier, which as you may have guessed, adds a single item to the specified loot table. A typical loot modifier looks like this:
{
"type": "cognition:add_single_item",
"conditions": [ ],
"id": "cognition:forgotten_dust",
"appear_chance": 1.0,
"min_quantity": 8,
"max_quantity": 27,
"bias": -0.4,
"path": "stronghold_library"
}
The id field designates what item to insert into the loot table. appear_chance specifies the chance that the items will be added to a given chest. It takes in a float value from 0.0 to 1.0, with a 1.0 chance meaning that items will always be added. The min_quantity field specifies the minimum amount of items to add, while the max_quantity field specifies the maximum amount of items.
The bias field is used in the weighted random function that decides how many items to ultimately add, and determines whether the distribution is skewed towards more or less items. It takes in a float value from -1 to 1 inclusive. A bias of 1 means that the function is twice as likely to add the maximum number of items than the minimum number of items. Conversely, a bias of -1 means that the function is half as likely to add the maximum number of items than the minimum number of items. In concise notation, a bias of 1 means P(max) = 2 * P(min), and a bias of -1 means that P(max) = 0.5 * P(min). If you're not sure what any of this means, set the bias to 0. This will use an unweighted random function which means that any quantity of items within the bounds you've set is equally likely to appear.
Lastly, the path field specifies what loot table to insert the items into. The global loot modifier will perform this modification to all loot table paths that contain the path specified as a substring. For instance, if you've simply used the string "stronghold" as the path variable, the loot table will add your specified items to stronghold_library, stronghold_corridor and stronghold_crossing chests.