diff options
Diffstat (limited to 'src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java')
| -rw-r--r-- | src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java | 40 |
1 files changed, 37 insertions, 3 deletions
diff --git a/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java b/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java index a878f45be..376a49e65 100644 --- a/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java +++ b/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java @@ -23,9 +23,10 @@ package me.shedaniel.rei.gui.widget; -import me.shedaniel.math.api.Point; +import me.shedaniel.math.Point; import me.shedaniel.math.api.Rectangle; import me.shedaniel.rei.api.REIHelper; +import me.shedaniel.rei.api.widgets.Widgets; import net.minecraft.client.gui.Element; import org.jetbrains.annotations.ApiStatus; @@ -35,6 +36,12 @@ import java.util.Optional; import java.util.function.Consumer; import java.util.function.Supplier; +/** + * @see Widgets#createLabel(Point, String) + * @see Widgets#createClickableLabel(Point, String, Consumer) + */ +@Deprecated +@ApiStatus.ScheduledForRemoval public class LabelWidget extends WidgetWithBounds { private Point pos; @@ -45,6 +52,11 @@ public class LabelWidget extends WidgetWithBounds { private Supplier<String> tooltipSupplier; @ApiStatus.Internal + public LabelWidget(me.shedaniel.math.api.Point point, String text) { + this((Point) point, text); + } + + @ApiStatus.Internal public LabelWidget(Point point, String text) { this.pos = point; this.text = text; @@ -55,6 +67,14 @@ public class LabelWidget extends WidgetWithBounds { return new LabelWidget(point, text); } + public static LabelWidget create(me.shedaniel.math.api.Point point, String text) { + return new LabelWidget(point, text); + } + + public static ClickableLabelWidget createClickable(me.shedaniel.math.api.Point point, String text, Consumer<ClickableLabelWidget> onClicked) { + return createClickable((Point) point, text, onClicked); + } + public static ClickableLabelWidget createClickable(Point point, String text, Consumer<ClickableLabelWidget> onClicked) { ClickableLabelWidget[] widget = {null}; widget[0] = new ClickableLabelWidget(point, text) { @@ -110,11 +130,25 @@ public class LabelWidget extends WidgetWithBounds { this.defaultColor = defaultColor; } - public Point getPosition() { + /** + * @return the position of this label + * @deprecated Use {@link #getLocation()} + */ + @Deprecated + @ApiStatus.ScheduledForRemoval + public me.shedaniel.math.api.Point getPosition() { + return new me.shedaniel.math.api.Point(getLocation()); + } + + public Point getLocation() { return pos; } - public LabelWidget setPosition(Point position) { + public LabelWidget setPosition(me.shedaniel.math.api.Point position) { + return setLocation(position); + } + + public LabelWidget setLocation(Point position) { this.pos = position; return this; } |
