Adrenix/Nostalgic-Tweaks

[FABRIC] Classic item damage bar tweak breaks overrides to `Item.getBarColor`

Opened this issue · 0 comments

coyo-t commented

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.
image

Tweak enabled.
image

AE2's bars always seem to be at the empty stage...
image

...While Tech Reborn's seem to be largely always filled, except for some of the battery items which always appear empty
image

Tweak disabled for reference:
image

image

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?