r8420 / MoreOverlays-updated

MC Mod : Brings back some of the NEI Overlays ( Mob Spawns, Chunk Bounds, Item Search)
MIT License
5 stars 6 forks source link

Make reflection into JEI more resiliant #53

Closed mezz closed 1 year ago

mezz commented 1 year ago

This is a follow-up to https://github.com/mezz/JustEnoughItems/issues/3064

I was thinking about adding the edit box in the API, but I realized that what More Overlays wants to do with it is actually really hacky. I don't really want to encourage other mods to use the search bar directly, they may misunderstand why I am exposing it to the API and do something weird by accident.

This PR adds a function that uses reflection to find the EditBox without caring about the field's name. It'll just search through all the fields and pick the first EditBox field. I think that will be safer against renames or class name changes in the future, and it allows MoreOverlays to work without compiling against JEI's internals.