[Possible Bug] Bad local variable type
WesCook opened this issue ยท 2 comments
Issue Description:
Returning an ItemStack in a function is only working when using the <mod:item>
syntax. If I try to use my ItemStack from a foreach loop it throws an error.
I'm not sure if this is an error in my script, or unexpected behavior in CraftTweaker. I'm still a novice with CraftTweaker, so hopefully this isn't just me being silly.
What happens:
ModTweaker throws an error regarding "Bad local variable type".
What you expected to happen:
The item to be accepted in the loop.
Script used:
These are bags from the Bagginses mod. I'm customizing the upgrade cost to make them more expensive. They need to retain their NBT data however, so I decided to create a loop and map from the "T2" (tier 2) to T3 Items.
Replacing line 9 with return <minecraft:dirt>.withTag(inputs.bag.tag);
resolves the problem and the script works (but isn't ideal for obvious reasons).
Minetweaker.log file:
See line 338 and below.
Affected Versions:
- Minecraft: 1.10.2
- Forge: 12.18.3.2185
- Crafttweaker: 1.10.2-3.0.15
Your most recent log file where the issue was present:
Warning, 18K lines.
I made this a gist so I can point to line numbers easily: https://gist.github.com/jaredlll08/85cd0e71c2f92aaf16e366668cacc5f9
So over here: https://gist.github.com/jaredlll08/85cd0e71c2f92aaf16e366668cacc5f9#file-gistfile1-txt-L8
You can just use "item", no need to call "bagsT3[i]"
Then over here: https://gist.github.com/jaredlll08/85cd0e71c2f92aaf16e366668cacc5f9#file-gistfile1-txt-L9
Just use return output.withTag(inputs.bag.tag);
since output
is the item being outputed anyway