Fix trade limit - #40
Conversation
| nbt.setTag( | ||
| "displayItem", | ||
| (displayItem != null ? displayItem : new BigItemStack(ItemPlaceholder.placeholder)) | ||
| .writeToNBT(new NBTTagCompound())); |
There was a problem hiding this comment.
If displayItem is null, shouldn't this just not add a tag? The loading logic says "if there's no tag, displayItem is null". This logic says "If displayItem is null, the tag is a placeholder." These two functions are no longer inverses of each other.
Is this intentional? Maybe the readFromNBT was also supposed to have placeholder logic?
(On first load, displayItem is null. On second load, displayItem is a placeholder.)
There was a problem hiding this comment.
you're right. it technically should never be null, but i just wrote that to be safe in case readFromNBT somehow makes it a null value. I'll remove this additional logic here.
There was a problem hiding this comment.
I'll add the null check at the assignment for displayItem instead.
Fixes trade limit resetting on server restart.