From 9e990de7685960391d78ca2cca0ff68bebe1a8cd Mon Sep 17 00:00:00 2001 From: shedaniel Date: Mon, 16 Mar 2020 16:19:25 +0800 Subject: 4.0.13 Signed-off-by: shedaniel --- .../java/me/shedaniel/rei/api/widgets/Widgets.java | 77 +++++++++++++++------- 1 file changed, 54 insertions(+), 23 deletions(-) (limited to 'src/main/java/me/shedaniel/rei/api/widgets/Widgets.java') diff --git a/src/main/java/me/shedaniel/rei/api/widgets/Widgets.java b/src/main/java/me/shedaniel/rei/api/widgets/Widgets.java index 286120716..da1f1ad02 100644 --- a/src/main/java/me/shedaniel/rei/api/widgets/Widgets.java +++ b/src/main/java/me/shedaniel/rei/api/widgets/Widgets.java @@ -43,96 +43,127 @@ import java.util.function.Consumer; public final class Widgets { private Widgets() {} - public static Widget createDrawableWidget(DrawableConsumer drawable) { + @NotNull + public static Widget createDrawableWidget(@NotNull DrawableConsumer drawable) { return new DrawableWidget(drawable); } - public static Widget createTexturedWidget(Identifier identifier, Rectangle bounds) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, @NotNull Rectangle bounds) { return createTexturedWidget(identifier, bounds, 0, 0); } - public static Widget createTexturedWidget(Identifier identifier, int x, int y, int width, int height) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, int x, int y, int width, int height) { return createTexturedWidget(identifier, x, y, 0, 0, width, height); } - public static Widget createTexturedWidget(Identifier identifier, Rectangle bounds, float u, float v) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, @NotNull Rectangle bounds, float u, float v) { return createTexturedWidget(identifier, bounds, u, v, 256, 256); } - public static Widget createTexturedWidget(Identifier identifier, int x, int y, float u, float v, int width, int height) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, int x, int y, float u, float v, int width, int height) { return createTexturedWidget(identifier, x, y, u, v, width, height, 256, 256); } - public static Widget createTexturedWidget(Identifier identifier, Rectangle bounds, float u, float v, int textureWidth, int textureHeight) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, @NotNull Rectangle bounds, float u, float v, int textureWidth, int textureHeight) { return createTexturedWidget(identifier, bounds.x, bounds.y, u, v, bounds.width, bounds.height, bounds.width, bounds.height, textureWidth, textureHeight); } - public static Widget createTexturedWidget(Identifier identifier, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, int x, int y, float u, float v, int width, int height, int textureWidth, int textureHeight) { return createTexturedWidget(identifier, x, y, u, v, width, height, width, height, textureWidth, textureHeight); } - public static Widget createTexturedWidget(Identifier identifier, Rectangle bounds, float u, float v, int uWidth, int vHeight, int textureWidth, int textureHeight) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, @NotNull Rectangle bounds, float u, float v, int uWidth, int vHeight, int textureWidth, int textureHeight) { return createTexturedWidget(identifier, bounds.x, bounds.y, u, v, bounds.width, bounds.height, uWidth, vHeight, textureWidth, textureHeight); } - public static Widget createTexturedWidget(Identifier identifier, int x, int y, float u, float v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight) { + @NotNull + public static Widget createTexturedWidget(@NotNull Identifier identifier, int x, int y, float u, float v, int width, int height, int uWidth, int vHeight, int textureWidth, int textureHeight) { return createDrawableWidget(new TexturedDrawableConsumer(identifier, x, y, width, height, u, v, uWidth, vHeight, textureWidth, textureHeight)); } - public static Widget createFilledRectangle(Rectangle rectangle, int color) { + @NotNull + public static Widget createFilledRectangle(@NotNull Rectangle rectangle, int color) { return createDrawableWidget(new FillRectangleDrawableConsumer(rectangle, color)); } - public static Label createLabel(Point point, @NotNull String text) { + @NotNull + public static Label createLabel(@NotNull Point point, @NotNull String text) { return new LabelWidget(point, text); } - public static Label createClickableLabel(Point point, @NotNull String text, @Nullable Consumer