CT mistakes an IItemstack for a tag in a very specific circumstance.
Warhand opened this issue ยท 4 comments
Issue description
When trying to load my script, it got an error relating to "TagIngredient cannot be cast to IItemstack" which confused me because the line that was causing the issue had nothing to do with Tags, though it was around other lines that did include tags, after I moved the line (Which only contained IItemstack data) to before the tags, it began to work fine.
Steps to reproduce
Unsure specifically, aside from running the script.
Script used
https://gist.github.com/Warhand/ebe5f94cdcb4ceafbdbb6623608ab5d7
The crafttweaker.log file
https://gist.github.com/Warhand/cd785e60fa837a2f5f4270468b7f3cfe
Minecraft version
1.18
Modloader
Forge
Modloader version
40.1.51
CraftTweaker version
9.1.159
Other relevant information
Also requires the following mods:
Immersive engineering 8.0.2-149
FTB Industrial contraptions 1802.1.6-build.182
Malum 1.3.7
The latest.log file
https://gist.github.com/Warhand/4b4a406bff7a92c7c296b1bff3ed7b61
We would need all the scripts, specifically where one_to_one_map
is being used in crushing recipes.zs
Heres the full file https://gist.github.com/Warhand/2b8c7fa8527d28f3b9bea4f5e7594df3
But tbh the issue still occurs even with the shortened file, I've tested it and can confirm that, so I'm unsure what having the full file will do to help.
Also, the lengthened file will also require Undergarden, Ars nouveau, JAOPCA, Create, Beyond earth, Tconstruct, and likely a couple others as well, I shortened the file to lower the amount of required mods to test the issue.
Just so that I understand your issue:
Of these, which one(s) do and don't work?
val itemFirst as IItemStack[IIngredient] = {
item : item,
tag.asIIngredient() : item
};
val tagFirst as IItemStack[IIngredient] = {
tag.asIIngredient() : item
item : item
};
It seems that this is an issue with how ZC infers the type of the map.
Two things you can test to get around this:
- cast the item(s) to IIngredient as well `(item as IIngredient) : item
- add the
as
cast also to the map expressionval x as = IItemStack[IIngredient] = {...} as IItemStack[IIngredient]