[FABRIC] Classic item damage bar tweak breaks overrides to `Item.getBarColor`
coyo-t opened this issue · 1 comments
Version Information
Minecraft Version: 1.20.1
Fabric Loader Version: 0.14.22
Fabric API Version: 0.87.0
Nostalgic Tweaks Version: v2.0.0 Beta 8.4
Describe the Bug
When using the classic item damage bar colours tweak, items which override damage-bar related methods (Im assuming its Item.getBarColor
, but might also affect others like Item.getBarWidth
?) are busted, usually resulting in an entirely empty bar, but sometimes not! sometimes its entirely filled and green, depends.
Crash Report
N/a
Screenshots
Tweak disabled.
Four golden shovels, an AE2 Entropy Manipulator, a Tech Reborn Basic Drill, two vanilla bundles, and an AE2 Matter Cannon.
AE2's bars always seem to be at the empty stage...
...While Tech Reborn's seem to be largely always filled, except for some of the battery items which always appear empty
Edit: Just checked and the old damage bar tweak doesn't even touch Item.getBarColor
directly as it i guess is just drawing the old-style bar graphics over the modern one?
I think the easiest fix would be to draw the old bar background parts, check if the item type overrides getBarColor
, and return if it does before drawing the new coloured part. Maybe keep a map of itemtypes that do so too because idk how expensive the reflection is?
The solution I came up with was checking if the durability bar color matches the expected outcome based on the item's current durability. If it doesn't, then the item is using a special algorithm and that tells N.T to leave the item durability bar color alone. This fix is in beta.902/903. Thank you for submitting this issue!