Suggestion: Make OptionListWidget.Entry a static inner class
Qendolin opened this issue ยท 2 comments
Non static inner classes are annoying to extend because you cannot do it in a separate file. If I want to customize the entries, I have to extend OptionListWidget
as well and I cannot split the code into multiple files.
I'm actually trying to avoid mixins. For my mod want the settings screen to be transparent when the player is in a world. I'm also fixing a few issues.
For example your mouseScrolled
scrolls the screen and then then the first element that consumes it. I have a (select) widget that consumes scroll input but the screen then also scrolls so I changed it to:
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
for (Entry child : children()) {
if (child.mouseScrolled(mouseX, mouseY, amount)) {
return true;
}
}
this.setScrollAmount(this.getScrollAmount() - amount * 20);
return true;
}
Also I'm replacing some entries after resetOptions
with a proxy entry that delegates all method calls to the original and provides an onBeforeRender
and onAfterRender
callback.
I'm also adding an blank entry at the bottom to add some padding to the list.