-
Notifications
You must be signed in to change notification settings - Fork 90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InputItem serializes to only the item, ignores count despite supporting count #845
Comments
This happens because the InputItem RecipeComponent delegates to RecipeJS#writeInputItem and RecipeJS#readInputItem: KubeJS/common/src/main/java/dev/latvian/mods/kubejs/recipe/component/ItemComponents.java Lines 38 to 46 in fc38ad0
For writing, RecipeJS delegates to the Ingredient, which won't write the count because that is held in the InputItem. For reading it delegates to InputItem#of, which will actually read the count if it is there (I misread that in the Discord thread). KubeJS/common/src/main/java/dev/latvian/mods/kubejs/recipe/RecipeJS.java Lines 611 to 618 in fc38ad0
|
This is intentional, as (up to 1.20.4), there is no unified standard for serialising ingredient stacks and some recipes actively broke if there was an invalid field present in the ingredient. You would need to override writeInputItem to respect the count (probably serialising it as "amount" or "count"?) in your schema using a custom recipe class |
Rip writing schemas from scripts. |
Can confirm that the recipes I'm looking for use "count", so how would one go about doing this? |
Minecraft Version
1.20.1
KubeJS Version
2001.6.5-build.7
Rhino Version
2001.2.2-build.18
Architectury Version
9.2.14
Forge/Fabric Version
Forge 47.2.30
Describe your issue
I'm trying to set up recipeSchemaRegistry for a mod that supports stacked items in its machine's recipes. Particularly, Biomancy's Bio Forge.
According to what we know, the following KubeJS Startup code should work:
The following recipe in Server Events was used to test:
However, when InputItem is serialized, despite InputItem.of() accepting a count, it does not return the count, as evidenced by this part of KubeJS's code
Supporting Discord thread
Crash report/logs
No response
The text was updated successfully, but these errors were encountered: