Issues with fabric:components custom ingredient type
vico93 opened this issue ยท 5 comments
I think i'm the only one that uses the very niche "fabric:type": "fabric:components"
custom ingredient that Fabric introduces for .json recipes to fine-grained ingredient picking (basically, select only item with specific components - or NBT for older versions).
I did a recipe to make mud with a dirt block and a water bottle with the following .json:
{
"type": "minecraft:crafting_shapeless",
"ingredients": [
{
"item": "minecraft:dirt"
},
{
"fabric:type": "fabric:components",
"base": {
"item": "minecraft:potion"
},
"components": {
"minecraft:potion_contents": {
"potion": "minecraft:water"
}
},
"strict": true
}
],
"result": {
"id": "minecraft:mud",
"count": 1
}
}
Although it worked - shows in REI and when i manually put the dirt and the water bottle on the crafting it outputs the mud block - i noticed some issues with this recipe:
First thing is that the water potion isn't pulled to the crafting table (while the other "normal" ingredient - dirt - goes normally) when the recipe is select with either the vanilla recipe book or REI:
While the recipe is shown normally on REI's recipe preview (but clicking on + gives the same issue of the recipe book):
The other thing is that, at least with water bottles, an empty bottle isn't returned to the inventory when the crafting is done - similar to how crafting with water/lava/milk buckets works. Maybe adding another field to specify the "return" item could be a solution to achieve consistency between bottle and bucket recipes, or just defining internally that filled bottles should return empty ones would be enough.
MC 1.21.1, Fabric 0.16.7 and Fabric API 0.106.0+1.21.1
Hi, this sounds like a valid problem, I do wonder how this behaves in 1.21.2 as the recipe book works quite diffrently now.
I expect REI has its own logic for this so might be worth seeing if anyone has had this issue before over there?
As for the empty bottle, this is up to the item to impliment getRecipeRemainder() this is unlikely something we would do for potions.
Hi, this sounds like a valid problem, I do wonder how this behaves in 1.21.2 as the recipe book works quite diffrently now.
I expect REI has its own logic for this so might be worth seeing if anyone has had this issue before over there?
As for the empty bottle, this is up to the item to impliment getRecipeRemainder() this is unlikely something we would do for potions.
So for the water bottle to leave a empty bottle that would require a separate mod?
Okay, seems like on 1.21.3 (and without REI), the action of assembling the recipe via recipe book worked sucessfully!
Here's the .json that worked for me (i'm doing some tests for a recipe for a mod i requested on Discord):
{
"type": "minecraft:crafting_shapeless",
"category": "food",
"ingredients": [
"lovelycrops:grapes",
{
"fabric:type": "fabric:components",
"base": "minecraft:potion",
"components": {
"minecraft:potion_contents": {
"potion": "minecraft:water"
}
},
"strict": true
}
],
"result": {
"id": "lovelycrops:grape_juice"
}
}
But i noticed some "artifacts" yet:
- When ticking the "Show craftable" button, even with all the ingredients present (including the water bottle), the recipe book will not show the recipe as available to craft:
- When a water bottle and a potion are present on the inventory and i try to click on the recipe on the book (with "Show craftable" ticked off, of course), it will try to pull the potion instead of water - in other words, seems like the
strict
property isn't being respected on the book: