CamperSamu / ItemCommander

A simple Serverside Fabric mod that allows you to assign commands to Item(Stacks)
Creative Commons Zero v1.0 Universal
3 stars 0 forks source link

Commander creates nbt on items without it on click #8

Closed MattiDragon closed 2 years ago

MattiDragon commented 2 years ago

You use ItemStack#getOrCreateNbt to get the stacks nbt for running commands, but this method has a problem. It creates the nbt if it's missing. Items with no nbt and empty nbt don't stack. The best solution is probably to not try to run a command when there isn't any nbt.

CamperSamu commented 2 years ago

Thanks for the suggestion! Forgot about this since before working on this mod I was working on a Minestom extension where the equivalent of this method doesn't cause this behavior.

Thanks @dragonmaus for fixing this issue while I wasn't able to work on mods. (#9)