Refactor cooking recipe containers into recipe data
Treeways opened this issue ยท 4 comments
Minecraft version
1.20.1
Farmer's Delight version
1.2.3
Forge version
47.1.47
Description
Cooking recipes are added via datapack, but their containers are still hardcoded. This would be much more convenient to have in datapack, so it can be read during KubeJS recipe porting.
Here's an analysis of the issue from the perspective of the codebase.
Notice how there is no container
key in this cooking recipe's data file:
When registering bowl items, they are registered as a bowlFoodItem
to take bowls as recipe remainders. There is seemingly no input for the container from the recipe data:
And vice-versa for drinkItem
:
The only exception is the Stuffed Pumpkin Block:
Also:
Steps to reproduce
No response
Mod list
Farmer's Delight
Logs
No response
Minimal instance
- I have tested this on a minimal instance
Performance and shader mods
- I am using performance or shader mods
However, contrary to what my (lengthy...) code analysis suggests, it looks like container support is quite easy to add via datapack out of the box.
The following data works just fine (and this is purely as a test):
kubejs/data/farmersdelight/recipes/cooking/squid_ink_pasta.json
{
"type": "farmersdelight:cooking",
"container": {
"item": "minecraft:glass_bottle"
},
"cookingtime": 200,
"experience": 1.0,
"ingredients": [
{
"tag": "forge:raw_fishes"
},
{
"tag": "forge:pasta"
},
{
"tag": "forge:crops/tomato"
},
{
"item": "minecraft:ink_sac"
}
],
"recipe_book_tab": "meals",
"result": {
"item": "farmersdelight:squid_ink_pasta"
}
}
Item containers are not an FD addition; they're a hardcoded item property from vanilla. When a contained item is consumed, it gives that item back.
The container
field in cooking recipe specs allows the recipe to "override" which container item is needed to extract the food from the Cooking Pot. This allows items to require a container without necessarily giving it back when consumed, such as the Stuffed Pumpkin, where the pumpkin is also eaten per serving.
It does not affect the item which is given back by the food itself. Doing so would require food items to host NBT data, thus making them unstackable or complicated for the end user.
The method you saw in the code snippets above are simplifications for item registry. Containers can't be added outside of item registration, as all vanilla systems utilize this item property for that.