aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dev/isxander/yacl/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/dev/isxander/yacl/gui')
-rw-r--r--src/main/java/dev/isxander/yacl/gui/AbstractWidget.java4
-rw-r--r--src/main/java/dev/isxander/yacl/gui/OptionListWidget.java28
-rw-r--r--src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java9
3 files changed, 34 insertions, 7 deletions
diff --git a/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java b/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java
index 0886589..f81cc99 100644
--- a/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/AbstractWidget.java
@@ -26,6 +26,10 @@ public abstract class AbstractWidget implements Element, Drawable, Selectable {
this.dim = dim;
}
+ public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+
+ }
+
public void setDimension(Dimension<Integer> dim) {
this.dim = dim;
}
diff --git a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
index 5b80e51..d6a28f3 100644
--- a/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/OptionListWidget.java
@@ -140,6 +140,14 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
}
}
+ @Override
+ public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+ super.render(matrices, mouseX, mouseY, delta);
+ for (Entry entry : children()) {
+ entry.postRender(matrices, mouseX, mouseY, delta);
+ }
+ }
+
/* END cloth config code */
@Override
@@ -206,6 +214,10 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
}
public abstract class Entry extends ElementListWidget.Entry<Entry> {
+ public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+
+ }
+
public boolean isViewable() {
return true;
}
@@ -236,6 +248,11 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
}
@Override
+ public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+ widget.postRender(matrices, mouseX, mouseY, delta);
+ }
+
+ @Override
public boolean mouseScrolled(double mouseX, double mouseY, double amount) {
return widget.mouseScrolled(mouseX, mouseY, amount);
}
@@ -314,14 +331,17 @@ public class OptionListWidget extends ElementListWidget<OptionListWidget.Entry>
wrappedName.drawCenterWithShadow(matrices, x + entryWidth / 2, y + getYPadding());
- if (hoveredTicks >= YACLConstants.HOVER_TICKS) {
- screen.renderOrderedTooltip(matrices, wrappedTooltip, x - 6, y + entryHeight / 2 + 6 + (wrappedTooltip.size() * textRenderer.fontHeight) / 2);
- }
-
prevMouseX = mouseX;
prevMouseY = mouseY;
}
+ @Override
+ public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) {
+ if (hoveredTicks >= YACLConstants.HOVER_TICKS) {
+ screen.renderOrderedTooltip(matrices, wrappedTooltip, mouseX, mouseY);
+ }
+ }
+
public boolean isExpanded() {
return groupExpanded;
}
diff --git a/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java b/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java
index 498ecdd..54c426d 100644
--- a/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java
+++ b/src/main/java/dev/isxander/yacl/gui/controllers/ControllerWidget.java
@@ -64,12 +64,15 @@ public abstract class ControllerWidget<T extends Controller<?>> extends Abstract
drawHoveredControl(matrices, mouseX, mouseY, delta);
}
+ prevMouseX = mouseX;
+ prevMouseY = mouseY;
+ }
+
+ @Override
+ public void postRender(MatrixStack matrices, int mouseX, int mouseY, float delta) {
if (hoveredTicks > YACLConstants.HOVER_TICKS) {
screen.renderOrderedTooltip(matrices, wrappedTooltip, mouseX, mouseY);
}
-
- prevMouseX = mouseX;
- prevMouseY = mouseY;
}
protected void drawHoveredControl(MatrixStack matrices, int mouseX, int mouseY, float delta) {