aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
authorJuuxel <kasperi.kauppi@gmail.com>2020-06-17 23:09:32 +0300
committerJuuxel <kasperi.kauppi@gmail.com>2020-06-17 23:09:32 +0300
commitdfb7f3a11a11c786e6c4ef66f6324f7f52d1d864 (patch)
treeca6a1b80416e76c9728052354c64997c8461b4de /src/main
parent3becd05a21ce997e197b7381f8100205959cef65 (diff)
downloadLibGui-dfb7f3a11a11c786e6c4ef66f6324f7f52d1d864.tar.gz
LibGui-dfb7f3a11a11c786e6c4ef66f6324f7f52d1d864.tar.bz2
LibGui-dfb7f3a11a11c786e6c4ef66f6324f7f52d1d864.zip
Update to pre8
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java10
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java14
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java18
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java12
8 files changed, 39 insertions, 39 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
index 4891765..0b2daa1 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java
@@ -249,7 +249,7 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
@Override
protected void drawForeground(MatrixStack matrices, int mouseX, int mouseY) {
if (description != null) {
- this.textRenderer.draw(matrices, this.title, (float) this.field_25267, (float) this.field_25268, description.getTitleColor());
+ this.textRenderer.draw(matrices, this.title, (float) this.titleX, (float) this.titleY, description.getTitleColor());
}
// Don't draw the player inventory label as it's drawn by the widget itself
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java
index b4ae9d3..cde778a 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java
@@ -2,12 +2,12 @@ package io.github.cottonmc.cotton.gui.client;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
-import net.minecraft.class_5348;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.text.StringRenderable;
import net.minecraft.util.Identifier;
import org.lwjgl.opengl.GL11;
@@ -364,7 +364,7 @@ public class ScreenDrawing {
* @param color the text color
* @since 1.9.0
*/
- public static void drawString(MatrixStack matrices, class_5348 text, Alignment align, int x, int y, int width, int color) {
+ public static void drawString(MatrixStack matrices, StringRenderable text, Alignment align, int x, int y, int width, int color) {
switch(align) {
case LEFT: {
MinecraftClient.getInstance().textRenderer.draw(matrices, text, x, y, color);
@@ -428,7 +428,7 @@ public class ScreenDrawing {
* @param width the width of the string, used for aligning
* @param color the text color
*/
- public static void drawStringWithShadow(MatrixStack matrices, class_5348 text, Alignment align, int x, int y, int width, int color) {
+ public static void drawStringWithShadow(MatrixStack matrices, StringRenderable text, Alignment align, int x, int y, int width, int color) {
switch(align) {
case LEFT: {
MinecraftClient.getInstance().textRenderer.drawWithShadow(matrices, text, x, y, color);
@@ -471,7 +471,7 @@ public class ScreenDrawing {
* @param y the Y position
* @param color the text color
*/
- public static void drawString(MatrixStack matrices, class_5348 text, int x, int y, int color) {
+ public static void drawString(MatrixStack matrices, StringRenderable text, int x, int y, int color) {
MinecraftClient.getInstance().textRenderer.draw(matrices, text, x, y, color);
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java
index 7087e00..b308483 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java
@@ -2,18 +2,18 @@ package io.github.cottonmc.cotton.gui.widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.class_5348;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.sound.SoundEvents;
+import net.minecraft.text.StringRenderable;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
import io.github.cottonmc.cotton.gui.widget.data.Alignment;
public class WButton extends WWidget {
- private class_5348 label;
+ private StringRenderable label;
protected int color = WLabel.DEFAULT_TEXT_COLOR;
protected int darkmodeColor = WLabel.DEFAULT_TEXT_COLOR;
private boolean enabled = true;
@@ -25,7 +25,7 @@ public class WButton extends WWidget {
}
- public WButton(class_5348 text) {
+ public WButton(StringRenderable text) {
this.label = text;
}
@@ -110,11 +110,11 @@ public class WButton extends WWidget {
return this;
}
- public class_5348 getLabel() {
+ public StringRenderable getLabel() {
return label;
}
- public WButton setLabel(class_5348 label) {
+ public WButton setLabel(StringRenderable label) {
this.label = label;
return this;
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java
index ffba2c3..1269afe 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItem.java
@@ -62,7 +62,7 @@ public class WItem extends WWidget {
MinecraftClient mc = MinecraftClient.getInstance();
ItemRenderer renderer = mc.getItemRenderer();
renderer.zOffset = 100f;
- renderer.method_27951(mc.player, items.get(current), x + getWidth() / 2 - 9, y + getHeight() / 2 - 9);
+ renderer.renderInGui(items.get(current), x + getWidth() / 2 - 9, y + getHeight() / 2 - 9);
renderer.zOffset = 0f;
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java
index 518a4a6..ab1764f 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java
@@ -2,11 +2,11 @@ package io.github.cottonmc.cotton.gui.widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.class_5348;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
+import net.minecraft.text.StringRenderable;
import net.minecraft.text.Style;
import io.github.cottonmc.cotton.gui.client.LibGuiClient;
@@ -20,7 +20,7 @@ import javax.annotation.Nullable;
* A single-line label widget.
*/
public class WLabel extends WWidget {
- protected class_5348 text;
+ protected StringRenderable text;
protected Alignment alignment = Alignment.LEFT;
protected int color;
protected int darkmodeColor;
@@ -51,7 +51,7 @@ public class WLabel extends WWidget {
* @param text the text of the label
* @param color the color of the label
*/
- public WLabel(class_5348 text, int color) {
+ public WLabel(StringRenderable text, int color) {
this.text = text;
this.color = color;
this.darkmodeColor = (color==DEFAULT_TEXT_COLOR) ? DEFAULT_DARKMODE_TEXT_COLOR : color;
@@ -72,7 +72,7 @@ public class WLabel extends WWidget {
* @param text the text of the label
* @since 1.8.0
*/
- public WLabel(class_5348 text) {
+ public WLabel(StringRenderable text) {
this(text, DEFAULT_TEXT_COLOR);
}
@@ -196,7 +196,7 @@ public class WLabel extends WWidget {
*
* @return the text
*/
- public class_5348 getText() {
+ public StringRenderable getText() {
return text;
}
@@ -206,7 +206,7 @@ public class WLabel extends WWidget {
* @param text the new text
* @return this label
*/
- public WLabel setText(class_5348 text) {
+ public WLabel setText(StringRenderable text) {
this.text = text;
return this;
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
index 7f122da..4cce813 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java
@@ -2,10 +2,10 @@ package io.github.cottonmc.cotton.gui.widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.class_5348;
import net.minecraft.client.gui.widget.AbstractButtonWidget;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.client.util.math.Vector3f;
+import net.minecraft.text.StringRenderable;
import net.minecraft.util.math.Quaternion;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
@@ -26,7 +26,7 @@ import javax.annotation.Nullable;
public class WLabeledSlider extends WAbstractSlider {
private static final Quaternion ROTATION_Z_270 = Vector3f.POSITIVE_X.getDegreesQuaternion(270);
- @Nullable private class_5348 label = null;
+ @Nullable private StringRenderable label = null;
@Nullable private LabelUpdater labelUpdater = null;
private Alignment labelAlignment = Alignment.CENTER;
@@ -59,7 +59,7 @@ public class WLabeledSlider extends WAbstractSlider {
* @param axis the slider axis
* @param label the slider label (can be null)
*/
- public WLabeledSlider(int min, int max, Axis axis, @Nullable class_5348 label) {
+ public WLabeledSlider(int min, int max, Axis axis, @Nullable StringRenderable label) {
this(min, max, axis);
this.label = label;
}
@@ -71,7 +71,7 @@ public class WLabeledSlider extends WAbstractSlider {
* @param max the maximum value
* @param label the slider label (can be null)
*/
- public WLabeledSlider(int min, int max, @Nullable class_5348 label) {
+ public WLabeledSlider(int min, int max, @Nullable StringRenderable label) {
this(min, max);
this.label = label;
}
@@ -91,7 +91,7 @@ public class WLabeledSlider extends WAbstractSlider {
* @return the label
*/
@Nullable
- public class_5348 getLabel() {
+ public StringRenderable getLabel() {
return label;
}
@@ -100,7 +100,7 @@ public class WLabeledSlider extends WAbstractSlider {
*
* @param label the new label
*/
- public void setLabel(@Nullable class_5348 label) {
+ public void setLabel(@Nullable StringRenderable label) {
this.label = label;
}
@@ -228,6 +228,6 @@ public class WLabeledSlider extends WAbstractSlider {
* @param value the slider value
* @return the label
*/
- class_5348 updateLabel(int value);
+ StringRenderable updateLabel(int value);
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java
index 4cf268e..8e4d826 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WText.java
@@ -2,11 +2,11 @@ package io.github.cottonmc.cotton.gui.widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.class_5348;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.font.TextRenderer;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.util.math.MatrixStack;
+import net.minecraft.text.StringRenderable;
import net.minecraft.text.Style;
import io.github.cottonmc.cotton.gui.client.LibGuiClient;
@@ -24,18 +24,18 @@ import java.util.Objects;
* @since 1.8.0
*/
public class WText extends WWidget {
- protected class_5348 text;
+ protected StringRenderable text;
protected int color;
protected int darkmodeColor;
protected Alignment alignment = Alignment.LEFT;
- private List<class_5348> wrappedLines;
+ private List<StringRenderable> wrappedLines;
private boolean wrappingScheduled = false;
- public WText(class_5348 text) {
+ public WText(StringRenderable text) {
this(text, WLabel.DEFAULT_TEXT_COLOR);
}
- public WText(class_5348 text, int color) {
+ public WText(StringRenderable text, int color) {
this.text = Objects.requireNonNull(text, "text must not be null");
this.color = color;
this.darkmodeColor = (color == WLabel.DEFAULT_TEXT_COLOR) ? WLabel.DEFAULT_DARKMODE_TEXT_COLOR : color;
@@ -72,7 +72,7 @@ public class WText extends WWidget {
int lineIndex = y / font.fontHeight;
if (lineIndex >= 0 && lineIndex < wrappedLines.size()) {
- class_5348 line = wrappedLines.get(lineIndex);
+ StringRenderable line = wrappedLines.get(lineIndex);
return font.getTextHandler().trimToWidth(line, x);
}
@@ -89,7 +89,7 @@ public class WText extends WWidget {
TextRenderer font = MinecraftClient.getInstance().textRenderer;
for (int i = 0; i < wrappedLines.size(); i++) {
- class_5348 line = wrappedLines.get(i);
+ StringRenderable line = wrappedLines.get(i);
int c = LibGuiClient.config.darkMode ? darkmodeColor : color;
ScreenDrawing.drawString(matrices, line, alignment, x, y + i * font.fontHeight, width, c);
@@ -120,7 +120,7 @@ public class WText extends WWidget {
*
* @return the text
*/
- public class_5348 getText() {
+ public StringRenderable getText() {
return text;
}
@@ -130,7 +130,7 @@ public class WText extends WWidget {
* @param text the new text
* @return this label
*/
- public WText setText(class_5348 text) {
+ public WText setText(StringRenderable text) {
Objects.requireNonNull(text, "text is null");
this.text = text;
wrappingScheduled = true;
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java
index 9d1306f..b917d97 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java
@@ -2,11 +2,11 @@ package io.github.cottonmc.cotton.gui.widget;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
-import net.minecraft.class_5348;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.sound.SoundEvents;
+import net.minecraft.text.StringRenderable;
import net.minecraft.util.Identifier;
import io.github.cottonmc.cotton.gui.client.LibGuiClient;
@@ -25,7 +25,7 @@ public class WToggleButton extends WWidget {
protected Identifier offImage;
protected Identifier focusImage = DEFAULT_FOCUS_IMAGE;
- @Nullable protected class_5348 label = null;
+ @Nullable protected StringRenderable label = null;
protected boolean isOn = false;
@Nullable protected Consumer<Boolean> onToggle = null;
@@ -39,7 +39,7 @@ public class WToggleButton extends WWidget {
}
/** Defaults with text */
- public WToggleButton(class_5348 text) {
+ public WToggleButton(StringRenderable text) {
this(DEFAULT_ON_IMAGE, DEFAULT_OFF_IMAGE);
this.label = text;
}
@@ -51,7 +51,7 @@ public class WToggleButton extends WWidget {
}
/** Custom images, with default sizes and a label */
- public WToggleButton(Identifier onImage, Identifier offImage, class_5348 label) {
+ public WToggleButton(Identifier onImage, Identifier offImage, StringRenderable label) {
this.onImage = onImage;
this.offImage = offImage;
this.label = label;
@@ -118,11 +118,11 @@ public class WToggleButton extends WWidget {
}
@Nullable
- public class_5348 getLabel() {
+ public StringRenderable getLabel() {
return label;
}
- public WToggleButton setLabel(@Nullable class_5348 label) {
+ public WToggleButton setLabel(@Nullable StringRenderable label) {
this.label = label;
return this;
}