skyecodes / IBE-Editor

A simple GUI mod to edit an item, a block or an entity in your current world.
https://www.curseforge.com/minecraft/mc-mods/ibe-editor
MIT License
39 stars 13 forks source link

guapi: Why does `VanillaTextFieldSkinDelegate#renderButton` clone most of `EditBox#renderButton`? #73

Open bluebear94 opened 1 year ago

bluebear94 commented 1 year ago

As I was looking into some incompatibilities between IBE Editor and Caxton, I noticed that VanillaTextFieldSkinDelegate#renderButton reimplements text field rendering instead of delegating to EditBox#renderButton. I thought that it was written that way to honor the textRendererProperty property, but given that EditBox#setFormatter is called every time that property is updated, it seems unnecessary to reimplement the method.

Similarly, mouseClicked reimplements the logic entirely instead of delegating to EditBox#mouseClicked. The reimplementation of these two methods is problematic for Caxton as they both rely on assumptions that don’t hold for complex text rendering. For that reason, Caxton mixes into EditBox#renderButton and EditBox#mouseClicked, but this does not affect the behavior of the analogous methods in VanillaTextFieldSkinDelegate.

Is there a good reason for copying the implementation of these methods rather than delegating to EditBox’s implementation?