diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java index 53effc029..9a95c46f2 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/ClickableLabelWidget.java @@ -11,46 +11,46 @@ import me.shedaniel.rei.impl.ScreenHelper; import java.util.Optional; public abstract class ClickableLabelWidget extends LabelWidget { - + public boolean focused; private boolean clickable = true; private int hoveredColor; - + @Deprecated public ClickableLabelWidget(int x, int y, String text, boolean clickable) { this(new Point(x, y), text, clickable); } - + @Deprecated public ClickableLabelWidget(int x, int y, String text) { this(new Point(x, y), text, true); } - + @Deprecated public ClickableLabelWidget(Point point, String text, boolean clickable) { this(point, text); clickable(clickable); } - + public ClickableLabelWidget(Point point, String text) { super(point, text); this.hoveredColor = ScreenHelper.isDarkModeEnabled() ? -1 : 0xFF66FFCC; } - + public LabelWidget hoveredColor(int hoveredColor) { this.hoveredColor = hoveredColor; return this; } - + public LabelWidget clickable(boolean clickable) { this.clickable = clickable; return this; } - + public boolean isClickable() { return clickable; } - + @Override public void render(int mouseX, int mouseY, float delta) { int color = getDefaultColor(); @@ -75,11 +75,11 @@ public abstract class ClickableLabelWidget extends LabelWidget { else if (focused) ScreenHelper.getLastOverlay().addTooltip(QueuedTooltip.create(pos, getTooltips().get().split("\n"))); } - + public int getHoveredColor() { return hoveredColor; } - + @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { if (button == 0 && isClickable() && containsMouse(mouseX, mouseY)) { @@ -88,11 +88,11 @@ public abstract class ClickableLabelWidget extends LabelWidget { } return false; } - + public Optional<String> getTooltips() { return Optional.empty(); } - + @Override public boolean keyPressed(int int_1, int int_2, int int_3) { if (!isClickable() || !focused) @@ -102,7 +102,7 @@ public abstract class ClickableLabelWidget extends LabelWidget { this.onLabelClicked(); return true; } - + @Override public boolean changeFocus(boolean boolean_1) { if (!isClickable()) @@ -110,11 +110,11 @@ public abstract class ClickableLabelWidget extends LabelWidget { this.focused = !this.focused; return true; } - + public boolean isHovered(int mouseX, int mouseY) { return isClickable() && (containsMouse(mouseX, mouseY) || focused); } - + public abstract void onLabelClicked(); - + } |
