[Suggestion] Allow emptied crates with the same (or no) upgrades to stack
md5i opened this issue ยท 3 comments
If you have been using a set of crates for different things and then empty them (unlocked), those crates no longer stack in inventories.
It would be nice if, after removing all items and upgrades from unlocked crates, those empty crates would stack. Alternatively, maybe there could be a way to craft a crate back into pristine NBT status?
This may have to do with what had found out in #6. Quoting there, a newly crafted crate has this NBT:
<bdsandm:wood_crate>.withTag({crateCap: {maxCap: 1024, objColors: [-1, -1] as int[], oreDict: 0 as byte, overflow: 0 as byte, refStack: {id: "minecraft:air", Count: 1 as byte, Damage: 0 as short}, count: 0, locked: 0 as byte, stackCap: 64}})
While an emptied crate has this NBT:
<bdsandm:wood_crate>.withTag({crateCap: {maxCap: 1024, objColors: [-1, -1] as int[], oreDict: 0 as byte, overflow: 0 as byte, refStack: {id: "minecraft:air", Count: 0 as byte, tag: {}, Damage: 0 as short}, count: 0, locked: 0 as byte, stackCap: 64
The difference is Count: 1 as byte versus Count: 0 as byte, and the latter has another empty compound tag named "tag". Essentially, a newly crafted crate have one air with no tag "stored" in the crate, but when it's used then emptied, it has zero air with an empty tag "stored."
Don't know whether this happens due to CraftTweaker script or not, though; but looking at the investigation of DarkPacks/SkyFactory-4#407 it seems like there's some interaction in it.
Other mods get around this type of issue by allowing you to shift click an item in the air, or craft it by itself in a crafting grid to reset it's settings (NBT data.) Maybe an empty crate placed in a crafting grid could give back any upgrades it has as secondary output and craft into a version with the same NBT as a newly crafted crate? This would also fix issues like #6 where even if a modpack messes with recipes and settings, you can reset an empty crate in a crafting grid and then it would stack with others and be usable in recipes again.