Crash when adding EMC values to stacks with NBT
buttilda opened this issue ยท 2 comments
Adding an EMC value to a stack that has NBT causes a crash at launch.
Crash report:
http://pastebin.com/u3rjPtd9
Code example that generates the crash:
ItemStack stack = new ItemStack(Item.skull);
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setString("SkullOwner", "ganymedes01");
AddonHandler.sendPreValueAssignment(stack, new EmcValue(10)):
(Before anyone complains, no I wasn't trying to assign a value to my head... that's is just an example code that also generates the same crash)
Also noticed that stacks with NBT don't get matched for EMC values
Example:
If I register an item to have a certain EMC value it will have that value as long as that item doesn't have a NBT tag with data in it.
That's a desirable outcome, but it would be nice to have some sort of wild card so that I can specify certain items to ignore NBT values when getting their EMC values determined.
The crash is because a JsonSerializer needs to be written for the NBT side of things. As for the assignment of values to ItemStacks with NBT - I'm not surprised it's not working as I had very little to test with at the time (was more aiming to get it working for the majority of items)
Now that we have some test cases - it will be easier to sort out the bugs and get it solid :)