Botania

Botania

133M Downloads

[Storage Drawers] Mana Tablet Damage bar vanishing

EchoingZen opened this issue ยท 3 comments

commented

Full mana tablets lose their damage bars when placed into storage drawers. I placed a bug report with them and ended up back here to report the same issue.

Here is a link to the issue report: jaquadro/StorageDrawers#193

"So, the drawer indeed writes out a 0 damage value on NBT save. But the prototype stack stored within the drawer itself has the correct damage value of 1.

Vakii has an inconsistency in the mana tablet implementation. The item overrides the getDamage() accessor, and scales the internal mana value (range 0 - 500,000) to a damage value in the range (0 - 1000). If the mana is completely full, it calculates an inconsistent damage value of 0. This needs to be brought up there."

commented

Thank you for looking into that, blacksmithgu. :)

commented

Alright. Forge actually has a nicer method for showing durability - namely getDurabilityForDisplay, which works a lot more cleanly then getDisplayDamage and getDamage did. In fact, it works well enough that getDisplayDamage and getDamage as they exist currently are unnecessary.

Apparently, however, items with a damage of 0 won't show a durability bar regardless of getDurabilityForDisplay - hence, the magical solution was to set creative to damage 0, and the normal tablet to damage 1.

In order to resolve compatibility and upgrading issues, we can change getDamage so it returns a damage of 0 for creative stacks and 1 for normal ones.

Getting back to the actual issue posted, this should fix the problem with durability bars vanishing when placed into storage drawers. PR for the above changes is forthcoming.

commented

It looks like I can actually do better than that and discard the damage altogether. There is also a showDurabilityBar method which can be overriden, which obviates the need to play games with the damage values.

PR forthcoming.