aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
diff options
context:
space:
mode:
authorDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:52 +0800
committerDanielshe <shekwancheung0528@gmail.com>2019-11-03 14:44:59 +0800
commit9f5a9eae9a7863412cc5eb433bf15e5ee71da616 (patch)
tree0e6b0b94af061c5e9023b1ff19f339a6c30149be /src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
parent3e3e25855b9f6df507a7d4c8a07c64b9a502fae2 (diff)
downloadRoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.gz
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.tar.bz2
RoughlyEnoughItems-9f5a9eae9a7863412cc5eb433bf15e5ee71da616.zip
3.2.1
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.java25
1 files changed, 24 insertions, 1 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 f7869cedf..ad1e0223d 100644
--- a/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
+++ b/src/main/java/me/shedaniel/rei/gui/widget/LabelWidget.java
@@ -6,6 +6,7 @@
package me.shedaniel.rei.gui.widget;
import me.shedaniel.math.api.Rectangle;
+import me.shedaniel.rei.impl.ScreenHelper;
import net.minecraft.client.gui.Element;
import java.util.Collections;
@@ -16,11 +17,30 @@ public class LabelWidget extends WidgetWithBounds {
public int x;
public int y;
public String text;
+ private int defaultColor;
+ private boolean hasShadows = true;
public LabelWidget(int x, int y, String text) {
this.x = x;
this.y = y;
this.text = text;
+ this.defaultColor = ScreenHelper.isDarkModeEnabled() ? 0xFFBBBBBB : -1;
+ }
+
+ public boolean isHasShadows() {
+ return hasShadows;
+ }
+
+ public void setHasShadows(boolean hasShadows) {
+ this.hasShadows = hasShadows;
+ }
+
+ public int getDefaultColor() {
+ return defaultColor;
+ }
+
+ public void setDefaultColor(int defaultColor) {
+ this.defaultColor = defaultColor;
}
@Override
@@ -36,7 +56,10 @@ public class LabelWidget extends WidgetWithBounds {
@Override
public void render(int mouseX, int mouseY, float delta) {
- drawCenteredString(font, text, x, y, -1);
+ int width = font.getStringWidth(text);
+ if (hasShadows)
+ font.drawWithShadow(text, x - width / 2, y, defaultColor);
+ else font.draw(text, x - width / 2, y, defaultColor);
}
}