diff options
| author | shedaniel <daniel@shedaniel.me> | 2022-06-26 21:45:36 +0800 |
|---|---|---|
| committer | shedaniel <daniel@shedaniel.me> | 2023-05-29 21:06:47 +0800 |
| commit | 30557360a886875b5e953d32ac577706ede3c8e2 (patch) | |
| tree | 334ec0c96db4194a45c4d17c6c8ff11838250496 /api/src/main/java | |
| parent | 14d3f79a9df125525956660b3bdda594005ef653 (diff) | |
| download | RoughlyEnoughItems-30557360a886875b5e953d32ac577706ede3c8e2.tar.gz RoughlyEnoughItems-30557360a886875b5e953d32ac577706ede3c8e2.tar.bz2 RoughlyEnoughItems-30557360a886875b5e953d32ac577706ede3c8e2.zip | |
Primitive tags category implementation
Diffstat (limited to 'api/src/main/java')
3 files changed, 22 insertions, 5 deletions
diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java index 1c70c616d..df350c9c7 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widget.java @@ -85,7 +85,7 @@ public abstract class Widget extends AbstractContainerEventHandler implements ne Point mouse = mouse(); Vector4f mouseVec = new Vector4f(mouse.x, mouse.y, 0, 1); mouseVec.transform(pose); - return pushMouse(mouse); + return pushMouse(new Point(mouseVec.x(), mouseVec.y())); } public int getZ() { diff --git a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widgets.java b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widgets.java index 02c839ba6..32f73431f 100644 --- a/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widgets.java +++ b/api/src/main/java/me/shedaniel/rei/api/client/gui/widgets/Widgets.java @@ -304,15 +304,30 @@ public final class Widgets { return ClientInternals.getWidgetsProvider().concatWidgets(widgets); } - public static Widget noOp() { + public static WidgetWithBounds noOp() { return ClientInternals.getWidgetsProvider().noOp(); } @ApiStatus.Experimental - public static Widget overflowed(Rectangle bounds, WidgetWithBounds widget) { + public static WidgetWithBounds overflowed(Rectangle bounds, WidgetWithBounds widget) { return ClientInternals.getWidgetsProvider().wrapOverflow(bounds, widget); } + @ApiStatus.Experimental + public static WidgetWithBounds padded(int padding, WidgetWithBounds widget) { + return padded(padding, padding, padding, padding, widget); + } + + @ApiStatus.Experimental + public static WidgetWithBounds padded(int padX, int padY, WidgetWithBounds widget) { + return padded(padX, padX, padY, padY, widget); + } + + @ApiStatus.Experimental + public static WidgetWithBounds padded(int padLeft, int padRight, int padTop, int padBottom, WidgetWithBounds widget) { + return ClientInternals.getWidgetsProvider().wrapPadded(padLeft, padRight, padTop, padBottom, widget); + } + public static <T> Iterable<T> walk(Iterable<? extends GuiEventListener> listeners, Predicate<GuiEventListener> predicate) { return () -> new AbstractIterator<T>() { Stack<Iterator<? extends GuiEventListener>> stack; diff --git a/api/src/main/java/me/shedaniel/rei/impl/ClientInternals.java b/api/src/main/java/me/shedaniel/rei/impl/ClientInternals.java index ca1797dbd..0e75c6bc5 100644 --- a/api/src/main/java/me/shedaniel/rei/impl/ClientInternals.java +++ b/api/src/main/java/me/shedaniel/rei/impl/ClientInternals.java @@ -188,8 +188,10 @@ public final class ClientInternals { Widget concatWidgets(List<Widget> widgets); - Widget noOp(); + WidgetWithBounds noOp(); - Widget wrapOverflow(Rectangle bounds, WidgetWithBounds widget); + WidgetWithBounds wrapOverflow(Rectangle bounds, WidgetWithBounds widget); + + WidgetWithBounds wrapPadded(int padLeft, int padRight, int padTop, int padBottom, WidgetWithBounds widget); } } |
