aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <kasperi.kauppi@gmail.com>2020-06-18 10:54:26 +0300
committerJuuxel <kasperi.kauppi@gmail.com>2020-06-18 10:54:26 +0300
commit6b613ed909e06f4d043f14d37db3c74b2fb14c86 (patch)
tree0f9cb9097d8123913dfb51337eac5b29dfe89c9e
parentda58f177401b99f59bfe4178c3fee5537f59c194 (diff)
downloadLibGui-6b613ed909e06f4d043f14d37db3c74b2fb14c86.tar.gz
LibGui-6b613ed909e06f4d043f14d37db3c74b2fb14c86.tar.bz2
LibGui-6b613ed909e06f4d043f14d37db3c74b2fb14c86.zip
Move WWidget.addTooltip to use StringRenderables
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java3
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java6
3 files changed, 7 insertions, 6 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java
index 45426b4..bcc2584 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java
@@ -17,7 +17,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
-import net.minecraft.text.Text;
+import net.minecraft.text.StringRenderable;
import net.minecraft.util.Identifier;
public class TestClientGui extends LightweightGuiDescription {
@@ -39,7 +39,7 @@ public class TestClientGui extends LightweightGuiDescription {
this.setRootPanel(root);
WLabel title = new WLabel(new LiteralText("Client Test Gui"), WLabel.DEFAULT_TEXT_COLOR) {
@Override
- public void addTooltip(List<Text> tooltip) {
+ public void addTooltip(List<StringRenderable> tooltip) {
tooltip.add(new LiteralText("Radical!"));
}
};
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
index 999effc..af09893 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
@@ -5,6 +5,7 @@ import net.fabricmc.api.Environment;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.screen.PropertyDelegate;
import net.minecraft.text.LiteralText;
+import net.minecraft.text.StringRenderable;
import net.minecraft.text.Text;
import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
@@ -162,7 +163,7 @@ public class WBar extends WWidget {
}
@Override
- public void addTooltip(List<Text> information) {
+ public void addTooltip(List<StringRenderable> information) {
if (tooltipLabel!=null) {
int value = (field>=0) ? properties.get(field) : 0;
int valMax = (max>=0) ? properties.get(max) : maxValue;
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
index 7476c71..7c1245a 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
@@ -9,7 +9,7 @@ import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.Text;
+import net.minecraft.text.StringRenderable;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.lwjgl.glfw.GLFW;
@@ -348,7 +348,7 @@ public class WWidget {
*/
@Environment(EnvType.CLIENT)
public void renderTooltip(MatrixStack matrices, int x, int y, int tX, int tY) {
- List<Text> info = new ArrayList<>();
+ List<StringRenderable> info = new ArrayList<>();
addTooltip(info);
if (info.size() == 0)
@@ -370,7 +370,7 @@ public class WWidget {
* Adds lines to this widget's tooltip. If the lines remain empty after this call, no tooltip will be drawn.
* @param tooltip List containing all previous tooltip data.
*/
- public void addTooltip(List<Text> tooltip) {
+ public void addTooltip(List<StringRenderable> tooltip) {
}
/**