aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJuuz <6596629+Juuxel@users.noreply.github.com>2022-04-25 12:57:43 +0300
committerJuuz <6596629+Juuxel@users.noreply.github.com>2022-04-25 12:57:43 +0300
commitbaf190d49e78e77ecb12cc88573771af6d42505e (patch)
tree11df7eb48fcde64d848c5790240f1de94a28f860 /src
parentb111addd529516f85563b6dac8e2df733b812e4e (diff)
downloadLibGui-baf190d49e78e77ecb12cc88573771af6d42505e.tar.gz
LibGui-baf190d49e78e77ecb12cc88573771af6d42505e.tar.bz2
LibGui-baf190d49e78e77ecb12cc88573771af6d42505e.zip
Update to 22w16b
- Removed WLabel(String) and WLabel(String, int) - Removed WTextField.setSuggestion(String) - Fixed config screen not returning to previous screen
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/ScreenDrawing.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/VisualLogger.java7
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationHelper.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationMessages.java19
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ConfigGui.java9
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ModMenuSupport.java7
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java5
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabel.java20
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WLabeledSlider.java3
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java5
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java13
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WToggleButton.java5
16 files changed, 42 insertions, 75 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
index 1751d4d..0ae199e 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java
@@ -1,9 +1,9 @@
package io.github.cottonmc.cotton.gui.client;
import net.minecraft.client.gui.screen.Screen;
+import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
@@ -44,7 +44,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
private final MouseInputHandler<CottonClientScreen> mouseInputHandler = new MouseInputHandler<>(this);
public CottonClientScreen(GuiDescription description) {
- this(new LiteralText(""), description);
+ this(ScreenTexts.EMPTY, description);
}
public CottonClientScreen(Text title, GuiDescription description) {
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 af11018..e8a2b51 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
@@ -1,12 +1,12 @@
package io.github.cottonmc.cotton.gui.client;
+import net.minecraft.client.gui.screen.ScreenTexts;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory;
-import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
@@ -41,7 +41,7 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
* @since 5.2.0
*/
public CottonInventoryScreen(T description, PlayerInventory inventory) {
- this(description, inventory, new LiteralText(""));
+ this(description, inventory, ScreenTexts.EMPTY);
}
/**
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 33d8b43..f436819 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
@@ -147,7 +147,7 @@ public class ScreenDrawing {
buffer.vertex(model, x + width, y, 0).texture(u2, v1).next();
buffer.vertex(model, x, y, 0).texture(u1, v1).next();
buffer.end();
- BufferRenderer.draw(buffer);
+ BufferRenderer.method_43433(buffer);
RenderSystem.disableBlend();
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/VisualLogger.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/VisualLogger.java
index 3f17aa4..f54e9fa 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/VisualLogger.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/VisualLogger.java
@@ -5,7 +5,6 @@ import net.fabricmc.api.Environment;
import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.LiteralText;
import net.minecraft.text.OrderedText;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
@@ -45,9 +44,9 @@ public final class VisualLogger {
logger.log(level, message, params);
if (FabricLoader.getInstance().isDevelopmentEnvironment()) {
- var text = new LiteralText(clazz.getSimpleName() + '/');
- text.append(new LiteralText(level.name()).formatted(formatting));
- text.append(new LiteralText(": " + ParameterizedMessage.format(message, params)));
+ var text = Text.literal(clazz.getSimpleName() + '/');
+ text.append(Text.literal(level.name()).formatted(formatting));
+ text.append(Text.literal(": " + ParameterizedMessage.format(message, params)));
WARNINGS.add(text);
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationHelper.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationHelper.java
index 54567be..f279d30 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationHelper.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationHelper.java
@@ -4,7 +4,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
-import net.minecraft.text.TranslatableText;
+import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.widget.WPanel;
import io.github.cottonmc.cotton.gui.widget.WWidget;
@@ -26,7 +26,7 @@ public final class NarrationHelper {
// replicates Screen.addElementNarrations
if (narratableWidgets.size() > 1) {
- builder.put(NarrationPart.POSITION, new TranslatableText(NarrationMessages.Vanilla.SCREEN_POSITION_KEY, i + 1, childCount));
+ builder.put(NarrationPart.POSITION, Text.translatable(NarrationMessages.Vanilla.SCREEN_POSITION_KEY, i + 1, childCount));
if (child.isFocused()) {
builder.put(NarrationPart.USAGE, NarrationMessages.Vanilla.COMPONENT_LIST_USAGE);
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationMessages.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationMessages.java
index d76dba1..5f4563b 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationMessages.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/client/NarrationMessages.java
@@ -1,29 +1,28 @@
package io.github.cottonmc.cotton.gui.impl.client;
import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
public final class NarrationMessages {
public static final String ITEM_SLOT_TITLE_KEY = "widget.libgui.item_slot.narration.title";
public static final String LABELED_SLIDER_TITLE_KEY = "widget.libgui.labeled_slider.narration.title";
- public static final Text SCROLL_BAR_TITLE = new TranslatableText("widget.libgui.scroll_bar.narration.title");
+ public static final Text SCROLL_BAR_TITLE = Text.translatable("widget.libgui.scroll_bar.narration.title");
public static final String SLIDER_MESSAGE_KEY = "widget.libgui.slider.narration.title";
- public static final Text SLIDER_USAGE = new TranslatableText("widget.libgui.slider.narration.usage");
+ public static final Text SLIDER_USAGE = Text.translatable("widget.libgui.slider.narration.usage");
public static final String TAB_TITLE_KEY = "widget.libgui.tab.narration.title";
public static final String TAB_POSITION_KEY = "widget.libgui.tab.narration.position";
public static final String TEXT_FIELD_TITLE_KEY = "widget.libgui.text_field.narration.title";
public static final String TEXT_FIELD_SUGGESTION_KEY = "widget.libgui.text_field.narration.suggestion";
public static final String TOGGLE_BUTTON_NAMED_KEY = "widget.libgui.toggle_button.narration.named";
- public static final Text TOGGLE_BUTTON_OFF = new TranslatableText("widget.libgui.toggle_button.narration.off");
- public static final Text TOGGLE_BUTTON_ON = new TranslatableText("widget.libgui.toggle_button.narration.on");
+ public static final Text TOGGLE_BUTTON_OFF = Text.translatable("widget.libgui.toggle_button.narration.off");
+ public static final Text TOGGLE_BUTTON_ON = Text.translatable("widget.libgui.toggle_button.narration.on");
public static final String TOGGLE_BUTTON_UNNAMED_KEY = "widget.libgui.toggle_button.narration.unnamed";
public static final class Vanilla {
- public static final Text BUTTON_USAGE_FOCUSED = new TranslatableText("narration.button.usage.focused");
- public static final Text BUTTON_USAGE_HOVERED = new TranslatableText("narration.button.usage.hovered");
- public static final Text COMPONENT_LIST_USAGE = new TranslatableText("narration.component_list.usage");
- public static final Text INVENTORY = new TranslatableText("container.inventory");
+ public static final Text BUTTON_USAGE_FOCUSED = Text.translatable("narration.button.usage.focused");
+ public static final Text BUTTON_USAGE_HOVERED = Text.translatable("narration.button.usage.hovered");
+ public static final Text COMPONENT_LIST_USAGE = Text.translatable("narration.component_list.usage");
+ public static final Text INVENTORY = Text.translatable("container.inventory");
public static final String SCREEN_POSITION_KEY = "narrator.position.screen";
- public static final Text HOTBAR = new TranslatableText("options.attack.hotbar");
+ public static final Text HOTBAR = Text.translatable("options.attack.hotbar");
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ConfigGui.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ConfigGui.java
index b1faf17..2931d46 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ConfigGui.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ConfigGui.java
@@ -2,7 +2,8 @@ package io.github.cottonmc.cotton.gui.impl.modmenu;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
-import net.minecraft.text.TranslatableText;
+import net.minecraft.client.gui.screen.ScreenTexts;
+import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.client.BackgroundPainter;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
@@ -20,7 +21,7 @@ public class ConfigGui extends LightweightGuiDescription {
root.setInsets(Insets.ROOT_PANEL);
setRootPanel(root);
- WToggleButton darkmodeButton = new WToggleButton(new TranslatableText("option.libgui.darkmode")) {
+ WToggleButton darkmodeButton = new WToggleButton(Text.translatable("option.libgui.darkmode")) {
@Override
public void onToggle(boolean on) {
LibGuiClient.config.darkMode = on;
@@ -31,7 +32,7 @@ public class ConfigGui extends LightweightGuiDescription {
root.add(darkmodeButton, 0, 2, 6, 1);
WTextField testField = new WTextField();
- testField.setSuggestion("test");
+ testField.setSuggestion(Text.literal("test"));
root.add(testField, 0, 3, 4, 1);
/*
@@ -50,7 +51,7 @@ public class ConfigGui extends LightweightGuiDescription {
root.add(new WKirbSprite(), 5, 4);
- WButton doneButton = new WButton(new TranslatableText("gui.done"));
+ WButton doneButton = new WButton(ScreenTexts.DONE);
doneButton.setOnClick(()->{
MinecraftClient.getInstance().setScreen(previous);
});
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ModMenuSupport.java b/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ModMenuSupport.java
index 6d1f094..f5baccb 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ModMenuSupport.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/impl/modmenu/ModMenuSupport.java
@@ -1,6 +1,6 @@
package io.github.cottonmc.cotton.gui.impl.modmenu;
-import net.minecraft.text.TranslatableText;
+import net.minecraft.text.Text;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
@@ -9,8 +9,9 @@ import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
public class ModMenuSupport implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
- return screen -> new CottonClientScreen(new TranslatableText("options.libgui.libgui_settings"), new ConfigGui(screen)) {
- public void onClose() {
+ return screen -> new CottonClientScreen(Text.translatable("options.libgui.libgui_settings"), new ConfigGui(screen)) {
+ @Override
+ public void close() {
this.client.setScreen(screen);
}
};
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java
index fa850ed..83ad651 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WAbstractSlider.java
@@ -4,7 +4,7 @@ import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
-import net.minecraft.text.TranslatableText;
+import net.minecraft.text.Text;
import net.minecraft.util.math.MathHelper;
import io.github.cottonmc.cotton.gui.impl.client.NarrationMessages;
@@ -367,7 +367,7 @@ public abstract class WAbstractSlider extends WWidget {
@Environment(EnvType.CLIENT)
@Override
public void addNarrations(NarrationMessageBuilder builder) {
- builder.put(NarrationPart.TITLE, new TranslatableText(NarrationMessages.SLIDER_MESSAGE_KEY, value, min, max));
+ builder.put(NarrationPart.TITLE, Text.translatable(NarrationMessages.SLIDER_MESSAGE_KEY, value, min, max));
builder.put(NarrationPart.USAGE, NarrationMessages.SLIDER_USAGE);
}
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 a35ead8..b6a6dd8 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
@@ -4,9 +4,7 @@ import net.fabricmc.api.EnvType;
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.Text;
-import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.MathHelper;
@@ -205,13 +203,13 @@ public class WBar extends WWidget {
if (tooltipLabel != null) {
int value = (field >= 0) ? properties.get(field) : 0;
int valMax = (max >= 0) ? properties.get(max) : maxValue;
- information.add(new TranslatableText(tooltipLabel, Integer.valueOf(value), Integer.valueOf(valMax)));
+ information.add(Text.translatable(tooltipLabel, value, valMax));
}
if (tooltipTextComponent != null) {
try {
information.add(tooltipTextComponent);
} catch (Throwable t) {
- information.add(new LiteralText(t.getLocalizedMessage()));
+ information.add(Text.literal(t.getLocalizedMessage()));
}
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
index 288c922..ec8ae96 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
@@ -12,7 +12,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.slot.SlotActionType;
import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
import io.github.cottonmc.cotton.gui.GuiDescription;
import io.github.cottonmc.cotton.gui.ValidatedSlot;
@@ -463,9 +462,9 @@ public class WItemSlot extends WWidget {
if (name != null) parts.add(name);
if (focusedSlot >= 0) {
- parts.add(new TranslatableText(NarrationMessages.ITEM_SLOT_TITLE_KEY, focusedSlot + 1, slotsWide * slotsHigh));
+ parts.add(Text.translatable(NarrationMessages.ITEM_SLOT_TITLE_KEY, focusedSlot + 1, slotsWide * slotsHigh));
} else if (hoveredSlot >= 0) {
- parts.add(new TranslatableText(NarrationMessages.ITEM_SLOT_TITLE_KEY, hoveredSlot + 1, slotsWide * slotsHigh));
+ parts.add(Text.translatable(NarrationMessages.ITEM_SLOT_TITLE_KEY, hoveredSlot + 1, slotsWide * slotsHigh));
}
builder.put(NarrationPart.TITLE, parts.toArray(new Text[0]));
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 83f0700..752d919 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
@@ -8,7 +8,6 @@ import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.LiteralText;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
@@ -46,16 +45,6 @@ public class WLabel extends WWidget {
* @param text the text of the label
* @param color the color of the label
*/
- public WLabel(String text, int color) {
- this(new LiteralText(text), color);
- }
-
- /**
- * Constructs a new label.
- *
- * @param text the text of the label
- * @param color the color of the label
- */
public WLabel(Text text, int color) {
this.text = text;
this.color = color;
@@ -66,15 +55,6 @@ public class WLabel extends WWidget {
* Constructs a new label with the {@linkplain #DEFAULT_TEXT_COLOR default text color}.
*
* @param text the text of the label
- */
- public WLabel(String text) {
- this(text, DEFAULT_TEXT_COLOR);
- }
-
- /**
- * Constructs a new label with the {@linkplain #DEFAULT_TEXT_COLOR default text color}.
- *
- * @param text the text of the label
* @since 1.8.0
*/
public WLabel(Text text) {
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 2f972ff..a8a912b 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
@@ -6,7 +6,6 @@ import net.minecraft.client.gui.screen.narration.NarrationMessageBuilder;
import net.minecraft.client.gui.screen.narration.NarrationPart;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.Vec3f;
@@ -220,7 +219,7 @@ public class WLabeledSlider extends WAbstractSlider {
@Override
public void addNarrations(NarrationMessageBuilder builder) {
if (getLabel() != null) {
- builder.put(NarrationPart.TITLE, new TranslatableText(NarrationMessages.LABELED_SLIDER_TITLE_KEY, getLabel(), value, min, max));
+ builder.put(NarrationPart.TITLE, Text.translatable(NarrationMessages.LABELED_SLIDER_TITLE_KEY, getLabel(), value, min, max));
builder.put(NarrationPart.USAGE, NarrationMessages.SLIDER_USAGE);
} else {
super.addNarrations(builder);
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java
index 9c16c73..5f24f89 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTabPanel.java
@@ -10,7 +10,6 @@ import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import io.github.cottonmc.cotton.gui.client.BackgroundPainter;
@@ -358,10 +357,10 @@ public class WTabPanel extends WPanel {
Text label = data.getTitle();
if (label != null) {
- builder.put(NarrationPart.TITLE, new TranslatableText(NarrationMessages.TAB_TITLE_KEY, label));
+ builder.put(NarrationPart.TITLE, Text.translatable(NarrationMessages.TAB_TITLE_KEY, label));
}
- builder.put(NarrationPart.POSITION, new TranslatableText(NarrationMessages.TAB_POSITION_KEY, tabWidgets.indexOf(this) + 1, tabWidgets.size()));
+ builder.put(NarrationPart.POSITION, Text.translatable(NarrationMessages.TAB_POSITION_KEY, tabWidgets.indexOf(this) + 1, tabWidgets.size()));
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java
index 64bf367..f92107e 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WTextField.java
@@ -16,9 +16,7 @@ import net.minecraft.client.render.Tessellator;
import net.minecraft.client.render.VertexFormat;
import net.minecraft.client.render.VertexFormats;
import net.minecraft.client.util.math.MatrixStack;
-import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.Matrix4f;
@@ -264,7 +262,7 @@ public class WTextField extends WWidget {
buffer.vertex(model, x + width, y, 0).next();
buffer.vertex(model, x, y, 0).next();
buffer.end();
- BufferRenderer.draw(buffer);
+ BufferRenderer.method_43433(buffer);
RenderSystem.disableColorLogicOp();
RenderSystem.enableTexture();
}
@@ -312,11 +310,6 @@ public class WTextField extends WWidget {
return suggestion;
}
- public WTextField setSuggestion(@Nullable String suggestion) {
- this.suggestion = suggestion != null ? new LiteralText(suggestion) : null;
- return this;
- }
-
public WTextField setSuggestion(@Nullable Text suggestion) {
this.suggestion = suggestion;
return this;
@@ -502,10 +495,10 @@ public class WTextField extends WWidget {
@Override
public void addNarrations(NarrationMessageBuilder builder) {
- builder.put(NarrationPart.TITLE, new TranslatableText(NarrationMessages.TEXT_FIELD_TITLE_KEY, text));
+ builder.put(NarrationPart.TITLE, Text.translatable(NarrationMessages.TEXT_FIELD_TITLE_KEY, text));
if (suggestion != null) {
- builder.put(NarrationPart.HINT, new TranslatableText(NarrationMessages.TEXT_FIELD_SUGGESTION_KEY, suggestion));
+ builder.put(NarrationPart.HINT, Text.translatable(NarrationMessages.TEXT_FIELD_SUGGESTION_KEY, suggestion));
}
}
}
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 ca0285f..1149a9b 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
@@ -9,7 +9,6 @@ import net.minecraft.client.sound.PositionedSoundInstance;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.sound.SoundEvents;
import net.minecraft.text.Text;
-import net.minecraft.text.TranslatableText;
import net.minecraft.util.Identifier;
import io.github.cottonmc.cotton.gui.client.LibGui;
@@ -214,9 +213,9 @@ public class WToggleButton extends WWidget {
Text title;
if (label != null) {
- title = new TranslatableText(NarrationMessages.TOGGLE_BUTTON_NAMED_KEY, label, onOff);
+ title = Text.translatable(NarrationMessages.TOGGLE_BUTTON_NAMED_KEY, label, onOff);
} else {
- title = new TranslatableText(NarrationMessages.TOGGLE_BUTTON_UNNAMED_KEY, onOff);
+ title = Text.translatable(NarrationMessages.TOGGLE_BUTTON_UNNAMED_KEY, onOff);
}
builder.put(NarrationPart.TITLE, title);