CraftTweaker

CraftTweaker

151M Downloads

[Possible Bug] Bad local variable type

WesCook opened this issue ยท 2 comments

commented

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:

http://pastebin.com/BVXAGbLe

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:

http://pastebin.com/TZJW5bch

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:

https://gist.githubusercontent.com/WesCook/278c2624a13d5a6dec05d7789b5c2b69/raw/4e85c35b1ee702a038fca7af637fd72613e7ff97/gistfile1.txt

Warning, 18K lines.

commented

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

commented

Using output instead of bagsT3[i] (or item) indeed did the trick. I'm curious why that is, but at least I'll know for the future. Cheers, thank you for your help.