No icon on the Scrapbox REI tab
BernardoGrigiastro opened this issue ยท 14 comments
No icon on the Scrapbox REI tab
Fabric 1.18-rc4
TR 5.1.0 b2
same thing on earlier 1.18 versions of both ^^
this is so strange.. must be some other mod interfering..
build latest in dev as of commit 347117b it works fine,
if i launch on beta5 release, its not fine ๐คทโโ๏ธ
Funnily enough, the error has maybe nothing to do with the scrapbox/scrap_box inaccurancy I think. I changed all occurances to scrap_box and the error persists. I think I mostly tracked it down though (just ignore wrong _ in the following, as I debugged in my corrected code):
In line 117 of TR's ReiPlugin the icon is registered via TRContent.SCRAP_BOX. This is done during MC Startup.
What interests us is the renderer field of REI's TabWidget class. One can check that by breaking at TabWidget#render(...), which is called continuously when a recipe is viewed via REI.
The renderer field is not set at construction, but lazily when needed. Two classes make use of TabWidget#setRenderer(...), the one that breaks when trying to render the scrap box in the tab is REI's CompositeDisplayViewingScreen#init(). There we call TR's AbstractMachineCategory#getIcon().
That method then uses the initially set-up, static iconMap field in TR's ReiPlugin and feeds the corresponding entry to REI's EntryStacks.of(...).
And now I have the icon. Wait, what? Yeah, the tab icon is definitely here... Let's test in Run. No icon, aha. Let's test in debug again. No icon. Cool.
Have fun with this. I swear the icon was there once. Will commit my stuff as "fixes sometimes"
On the other hand, I am convinced this is happening either because Scrap Box is not a block or because SCRAP_BOX is only a static field in TRContent instead of an enum entry like all the machines, because these are the only differences to the other tabs. 100% convinced this would work if we used the Scrapinator instead of Scrap Box as icon.