use of net.minecraft.client.gui.Element in project sodium-fabric by CaffeineMC.
the class SodiumOptionsGUI method rebuildGUI.
private void rebuildGUI() {
this.controls.clear();
this.children.clear();
this.drawable.clear();
if (this.currentPage == null) {
if (this.pages.isEmpty()) {
throw new IllegalStateException("No pages are available?!");
}
// Just use the first page for now
this.currentPage = this.pages.get(0);
}
this.rebuildGUIPages();
this.rebuildGUIOptions();
this.applyButton = new FlatButtonWidget(new Rect2i(10, this.height - 30, 80, 20), "Apply", this::applyChanges);
this.closeButton = new FlatButtonWidget(new Rect2i(96, this.height - 30, 80, 20), "Close", this::popScreen);
this.children.add(this.applyButton);
this.children.add(this.closeButton);
this.resetButton = new FlatButtonWidget(new Rect2i(this.width - 96, this.height - 30, 80, 20), "Reset", this::resetChanges);
this.children.add(this.resetButton);
for (Element element : this.children) {
if (element instanceof Drawable) {
this.drawable.add((Drawable) element);
}
}
}
use of net.minecraft.client.gui.Element in project SpeedRunIGT by RedLime.
the class SpeedRunOptionScreen method getToolTip.
public ArrayList<Text> getToolTip(int mouseX, int mouseY) {
ArrayList<Text> tooltipList = new ArrayList<>();
Optional<Element> e = buttonListWidget.hoveredElement(mouseX, mouseY);
if (e.isPresent()) {
Element element = e.get();
if (element instanceof ButtonScrollListWidget.Entry) {
ButtonScrollListWidget.Entry entry = (ButtonScrollListWidget.Entry) element;
AbstractButtonWidget buttonWidget = entry.getButtonWidget();
if (tooltips.containsKey(buttonWidget)) {
String text = tooltips.get(buttonWidget).get();
for (String s : text.split("\n")) {
tooltipList.add(new LiteralText(s));
}
return tooltipList;
}
}
}
if (SpeedRunIGTInfoScreen.UPDATE_STATUS == SpeedRunIGTInfoScreen.UpdateStatus.OUTDATED) {
tooltipList.add(new TranslatableText("speedrunigt.message.update_found"));
}
return tooltipList;
}
Aggregations