[1.18.1] Contained ingredients not returning their container in custom recipes
zack-emmert opened this issue ยท 6 comments
Description
I'm attempting to add a cooking pot recipe to make purified water bottles from Survive. The only ingredient is a bottle of water. However, because a glass bottle is required as a container, and the bottle from the ingredient does not eject out the top of the pot as expected, an extra glass bottle is consumed.
Steps to reproduce:
Include the below JSON recipe in a datapack, and place a water bottle in a ready cooking pot.
{
"type": "farmersdelight:cooking",
"ingredients": [
{
"item": "minecraft:potion",
"nbt": "{Potion:\"minecraft:water\"}"
}
],
"result": {
"item": "survive:purified_water_bottle"
},
"container": {
"item": "minecraft:glass_bottle"
},
"cookingtime": 200
}
Expected behavior:
Because a water bottle is one of the ingredients, a glass bottle should be ejected out the top of the cooking pot. However, this does not happen.
Mod list:
Farmer's Delight 1.0.3
Survive 6.1.12
Forge 39.1.2
This might be a vanilla issue.
The Cooking Pot will eject a container if the ingredient item has one defined in code. However, many vanilla items which should have defined containers do not.
Looking at the code, minecraft:potion
doesn't define a container. When consumed, it's hard-coded to swap the stack for a Glass Bottle, instead of handing it as a container. Because of that, the Cooking Pot has no good way of knowing it should throw a bottle out for these.
I'm actually surprised you got the water bottle to be an ingredient, given all the NBT shenanigans! I kinda wanted to use them for crafting, but it always became an Uncraftable Potion. :(
Having done some further experimentation, I've discovered that any potion works with that JSON recipe. Guess the NBT shenanigans got to me after all lol.
As for the container issue, is there anything you can do on your end to just kinda make it work anyway?
I'm afraid the only feasible solution is hard-coding the pot to drop Glass Bottles if a potion was used as an ingredient... which is kinda hacky, and not a clean/scalable solution. :(
I can put this on the backlog and think of some alternative later, though.
Really needs a solution from mojang. Rn NBT is just kinda hacky on it's own and doesn't work as well as it could
I'm afraid the only feasible solution is hard-coding the pot to drop Glass Bottles if a potion was used as an ingredient... which is kinda hacky, and not a clean/scalable solution. :(
I can put this on the backlog and think of some alternative later, though.
Maybe a config setting to define what item the pot should drop if a specific ingredient is used? That'd at least let pack makers hard-code their own fixes as needed.
Hey @zack-emmert, just a quick update on this old issue. ๐
Commit 6db0ee3 implements a provisory solution to this problem, by specifying "sensible" remainders for current vanilla items. Though this isn't very scalable, it doesn't break anything, and should at least allow for the usage of such items as ingredients. I'm still deciding whether it's worth opening this to datapacks, since it's reasonable to assume modders can define remainders on their own mod's items; this refactor was added to my backlog for consideration.
However, I have recently abandoned 1.18 support, so this change will start from 1.19 and higher. Sorry for the long delay over this; I hope it's still useful for your projects. ๐