aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java')
-rw-r--r--src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java b/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java
new file mode 100644
index 0000000..e2f19bc
--- /dev/null
+++ b/src/main/java/dev/isxander/yacl3/gui/controllers/ControllerPopupWidget.java
@@ -0,0 +1,39 @@
+package dev.isxander.yacl3.gui.controllers;
+
+import dev.isxander.yacl3.api.Controller;
+import dev.isxander.yacl3.api.utils.Dimension;
+import dev.isxander.yacl3.gui.YACLScreen;
+import net.minecraft.client.gui.GuiGraphics;
+import net.minecraft.client.gui.components.events.GuiEventListener;
+import net.minecraft.network.chat.Component;
+
+public abstract class ControllerPopupWidget<T extends Controller<?>> extends ControllerWidget<Controller<?>> implements GuiEventListener {
+ public final ControllerWidget<?> entryWidget;
+ public ControllerPopupWidget(T control, YACLScreen screen, Dimension<Integer> dim, ControllerWidget<?> entryWidget) {
+ super(control, screen, dim);
+ this.entryWidget = entryWidget;
+ }
+
+ public ControllerWidget<?> entryWidget() {
+ return entryWidget;
+ }
+
+ public void renderBackground(GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTick) {}
+
+ @Override
+ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
+ return entryWidget.keyPressed(keyCode, scanCode, modifiers);
+ }
+
+ public void close() {}
+
+ public Component popupTitle() {
+ return Component.translatable("yacl.control.text.blank");
+ }
+
+ @Override
+ protected int getHoveredControlWidth() {
+ return 0;
+ }
+
+}