Wireless Crafting Terminal

Wireless Crafting Terminal

48M Downloads

Crash when switching terminal style without magnet card

eslym opened this issue ยท 7 comments

commented

Mod Version: 1.12.2-3.8.52
Crash Report

When trying to swith the terminal style from small to tall, the game would crash by NullPointerException, it seens like trying to get item damage from the magnet card which doesn't exist

P/S: It happened sometimes after insert magnet card once and removed, but it always happened if never insert a magnet card since game start.

commented

@ruifung you are definitely correct here, but it goes beyond that I think. I am unable to reproduce in 3.8.54, but I haven't made any changes on that end afaik, so that shouldn't make a difference. I'd really like too be able to reproduce this. There's also a bug with transferStackInSlot and updating stuff on client side...

I tried adding writeToNBT() & detectAndSendChanges() to force update the client, but it doesn't work..seems like the client is a bit behind no matter what I do...
I've fixed the nbt stuff. Also fixed the glint rendering on the button if magnetMode==-1 (return by WCTUtils#getMagnetMode)
I'll push a commit now with the changes I've made, but I don't plan to push to curse until i sort the client update thing. Thanks to both of you!

commented

What's odd is that Container#slotClick updates fine (This is because I call writeToNBT() to update the WCT stack and then an extra detectAndSendChanges() to resync.) But as I said, when I replicate this in ContainerWCT#transferStackInSlot, nothing happens.

commented

it's too early..disregard that last commit lol...fixing my fix now on the nbt..

commented

ok..fixed ItemMagnet#getDamageUnsafe in current commit

commented

I'm leaving for work now, I'll have to look more into this when I get home..if you can fix @ruifung I'll throw you some CP-all that's needed is the transferStackInSlot syncing

commented

Looking at

return stack.getTagCompound().getInteger(WCTUtils.MAGNET_MODE_NBT);

I'd say either stack is null, or stack.getTagCompound() is returning null.
Probably because stack is empty, therefore the code to set a new TagCompound doesn't get run.
And then it attempts to getInteger on a non-existent TagCompound, which therefore leads us to NPE-hell.

commented

omg..i have worked on this last part ever since I got home 7 hours ago..just got it XD