Skip to content

Commit

Permalink
fix: gui tooltip updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Theta-Dev committed Feb 15, 2023
1 parent f1b9c91 commit 2df42cd
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ private void createButton(int cx, int cy, IOption<?> option) {
Button button = Button.builder(getButtonLabel(option), bt -> clickButton(bt, option))
.pos(getX(cx), getY(cy))
.size(BUTTON_WIDTH, BUTTON_HEIGHT)
.tooltip(Tooltip.create(Component.translatable(option.getDescTranslation())))
.tooltip(getButtonTooltip(option))
.build();

button.active = option.isEnabled();
Expand All @@ -76,6 +76,7 @@ private void clickButton(Button button, IOption<?> option) {
option.next();
ConstructionWand.instance.HANDLER.sendToServer(new PacketWandOption(option, false));
button.setMessage(getButtonLabel(option));
button.setTooltip(getButtonTooltip(option));
}

private int getX(int n) {
Expand All @@ -89,4 +90,8 @@ private int getY(int n) {
private Component getButtonLabel(IOption<?> option) {
return Component.translatable(option.getKeyTranslation()).append(Component.translatable(option.getValueTranslation()));
}

private Tooltip getButtonTooltip(IOption<?> option) {
return Tooltip.create(Component.translatable(option.getDescTranslation()));
}
}

0 comments on commit 2df42cd

Please sign in to comment.