aboutsummaryrefslogtreecommitdiff
path: root/GuiTest/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 /GuiTest/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 'GuiTest/src')
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java3
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java14
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java14
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java4
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/ScrollingTestGui.java6
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TabTestGui.java6
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java8
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TextFieldTestGui.java6
8 files changed, 29 insertions, 32 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
index d443770..2739d51 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
@@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.screen.NamedScreenHandlerFactory;
import net.minecraft.screen.ScreenHandler;
import net.minecraft.screen.ScreenHandlerContext;
-import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.BlockPos;
@@ -36,7 +35,7 @@ public class GuiBlockEntity extends BlockEntity implements ImplementedInventory,
@Override
public Text getDisplayName() {
- return new LiteralText("test title");
+ return Text.literal("test title");
}
@Nullable
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
index 69be1f4..6c74e28 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
@@ -4,7 +4,7 @@ import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.Items;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.ScreenHandlerType;
-import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import io.github.cottonmc.cotton.gui.SyncedGuiDescription;
@@ -29,7 +29,7 @@ public class TestDescription extends SyncedGuiDescription {
WItemSlot slot = WItemSlot.of(blockInventory, 0, 4, 1);
root.add(slot, 0, 1);
- WButton buttonA = new WButton(new LiteralText("Send Message"));
+ WButton buttonA = new WButton(Text.literal("Send Message"));
buttonA.setOnClick(() -> {
ScreenNetworking.of(this, NetworkSide.CLIENT).send(TEST_MESSAGE, buf -> {});
@@ -38,15 +38,15 @@ public class TestDescription extends SyncedGuiDescription {
root.add(buttonA, 0, 3, 4, 1);
- WButton buttonB = new WButton(new LiteralText("Show Warnings"));
+ WButton buttonB = new WButton(Text.literal("Show Warnings"));
buttonB.setOnClick(() -> slot.setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png"))));
root.add(buttonB, 5, 3, 4, 1);
- root.add(new WButton(new LiteralText("Button C")), 0, 5, 4, 1);
- root.add(new WButton(new LiteralText("Button D")), 5, 5, 4, 1);
- root.add(new WTextField(new LiteralText("Type something...")).setMaxLength(64), 0, 7, 5, 1);
+ root.add(new WButton(Text.literal("Button C")), 0, 5, 4, 1);
+ root.add(new WButton(Text.literal("Button D")), 5, 5, 4, 1);
+ root.add(new WTextField(Text.literal("Type something...")).setMaxLength(64), 0, 7, 5, 1);
- root.add(new WLabel(new LiteralText("Large slot:")), 0, 9);
+ root.add(new WLabel(Text.literal("Large slot:")), 0, 9);
root.add(WItemSlot.outputOf(blockInventory, 0), 4, 9);
root.add(WItemSlot.of(blockInventory, 7).setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png"))), 7, 9);
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java
index abd36e6..f89de7a 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/InsetsTestGui.java
@@ -1,22 +1,20 @@
package io.github.cottonmc.test.client;
+import net.minecraft.text.Text;
+
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
import io.github.cottonmc.cotton.gui.widget.WButton;
import io.github.cottonmc.cotton.gui.widget.WGridPanel;
-
import io.github.cottonmc.cotton.gui.widget.WLabel;
-
import io.github.cottonmc.cotton.gui.widget.data.Insets;
-import net.minecraft.text.LiteralText;
-
public class InsetsTestGui extends LightweightGuiDescription {
public InsetsTestGui() {
WGridPanel root = (WGridPanel) rootPanel;
- root.add(new WLabel(new LiteralText("Insets demo")), 0, 0);
- root.add(new WButton(new LiteralText("Default")).setOnClick(() -> root.setInsets(Insets.ROOT_PANEL)), 0, 1, 2, 1);
- root.add(new WButton(new LiteralText("None")).setOnClick(() -> root.setInsets(Insets.NONE)), 2, 1, 2, 1);
- root.add(new WButton(new LiteralText("Large")).setOnClick(() -> root.setInsets(new Insets(16))), 4, 1, 2, 1);
+ root.add(new WLabel(Text.literal("Insets demo")), 0, 0);
+ root.add(new WButton(Text.literal("Default")).setOnClick(() -> root.setInsets(Insets.ROOT_PANEL)), 0, 1, 2, 1);
+ root.add(new WButton(Text.literal("None")).setOnClick(() -> root.setInsets(Insets.NONE)), 2, 1, 2, 1);
+ root.add(new WButton(Text.literal("Large")).setOnClick(() -> root.setInsets(new Insets(16))), 4, 1, 2, 1);
}
}
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
index fd031f5..94620af 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
@@ -6,7 +6,7 @@ import net.fabricmc.fabric.api.client.command.v1.ClientCommandManager;
import net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
-import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
import io.github.cottonmc.cotton.gui.client.CottonHud;
@@ -37,7 +37,7 @@ public class LibGuiTestClient implements ClientModInitializer {
);
CottonHud.add(new WHudTest(), 10, -20, 10, 10);
- CottonHud.add(new WLabel(new LiteralText("Test label")), 10, -30, 10, 10);
+ CottonHud.add(new WLabel(Text.literal("Test label")), 10, -30, 10, 10);
ClientCommandManager.DISPATCHER.register(
literal("libgui")
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/ScrollingTestGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/ScrollingTestGui.java
index 5a8f3f0..bfc25c4 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/ScrollingTestGui.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/ScrollingTestGui.java
@@ -1,7 +1,7 @@
package io.github.cottonmc.test.client;
import net.minecraft.item.Items;
-import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
import io.github.cottonmc.cotton.gui.widget.WBox;
@@ -20,12 +20,12 @@ public class ScrollingTestGui extends LightweightGuiDescription {
WBox box = new WBox(Axis.VERTICAL);
for (int i = 0; i < 20; i++) {
- box.add(new WLabeledSlider(0, 10, new LiteralText("Slider #" + i)));
+ box.add(new WLabeledSlider(0, 10, Text.literal("Slider #" + i)));
}
box.add(new WButton(new ItemIcon(Items.APPLE)));
- root.add(new WLabel(new LiteralText("Scrolling test")).setVerticalAlignment(VerticalAlignment.CENTER), 0, 0, 5, 2);
+ root.add(new WLabel(Text.literal("Scrolling test")).setVerticalAlignment(VerticalAlignment.CENTER), 0, 0, 5, 2);
root.add(new WScrollPanel(box), 0, 2, 5, 3);
root.validate(this);
}
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/TabTestGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/TabTestGui.java
index 6fa716d..8ed93f9 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/TabTestGui.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/TabTestGui.java
@@ -1,7 +1,7 @@
package io.github.cottonmc.test.client;
import net.minecraft.item.Items;
-import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
import io.github.cottonmc.cotton.gui.impl.modmenu.WKirbSprite;
@@ -12,8 +12,8 @@ import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon;
public class TabTestGui extends LightweightGuiDescription {
public TabTestGui() {
WTabPanel tabs = new WTabPanel();
- tabs.add(new WKirbSprite(), builder -> builder.title(new LiteralText("Kirb")));
- tabs.add(new WLabel(new LiteralText("just another tab")), builder -> builder.icon(new ItemIcon(Items.ANDESITE)));
+ tabs.add(new WKirbSprite(), builder -> builder.title(Text.literal("Kirb")));
+ tabs.add(new WLabel(Text.literal("just another tab")), builder -> builder.icon(new ItemIcon(Items.ANDESITE)));
tabs.setSize(7 * 18, 5 * 18);
setRootPanel(tabs);
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 56b399c..672e56d 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
@@ -3,7 +3,7 @@ package io.github.cottonmc.test.client;
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.util.Identifier;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
@@ -31,11 +31,11 @@ public class TestClientGui extends LightweightGuiDescription {
WGridPanel root = new WGridPanel(22);
root.setInsets(Insets.ROOT_PANEL);
this.setRootPanel(root);
- WLabel title = new WLabel(new LiteralText("Client Test Gui"), WLabel.DEFAULT_TEXT_COLOR) {
+ WLabel title = new WLabel(Text.literal("Client Test Gui"), WLabel.DEFAULT_TEXT_COLOR) {
@Environment(EnvType.CLIENT)
@Override
public void addTooltip(TooltipBuilder tooltip) {
- tooltip.add(new LiteralText("Radical!"));
+ tooltip.add(Text.literal("Radical!"));
}
};
WTiledSprite wood = new WTiledSprite(
@@ -49,7 +49,7 @@ public class TestClientGui extends LightweightGuiDescription {
root.add(title, 0, 0);
WTextField text = new WTextField();
- text.setSuggestion("Search");
+ text.setSuggestion(Text.literal("Search"));
root.add(text, 0, 1, 8, 1);
text.setSize(7*18, 20);
/*
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/TextFieldTestGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/TextFieldTestGui.java
index dc2b68c..ce2a7b6 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/TextFieldTestGui.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/TextFieldTestGui.java
@@ -1,7 +1,7 @@
package io.github.cottonmc.test.client;
import net.minecraft.item.Items;
-import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
import io.github.cottonmc.cotton.gui.widget.WButton;
@@ -12,9 +12,9 @@ import io.github.cottonmc.cotton.gui.widget.icon.ItemIcon;
public class TextFieldTestGui extends LightweightGuiDescription {
public TextFieldTestGui() {
WGridPanel grid = (WGridPanel) rootPanel;
- WTextField textField = new WTextField(new LiteralText("Type something")).setMaxLength(Integer.MAX_VALUE);
+ WTextField textField = new WTextField(Text.literal("Type something")).setMaxLength(Integer.MAX_VALUE);
grid.add(textField, 0, 0, 6, 1);
- grid.add(new WButton(new ItemIcon(Items.BARRIER), new LiteralText("Clear")).setOnClick(() -> textField.setText("")), 0, 2, 6, 1);
+ grid.add(new WButton(new ItemIcon(Items.BARRIER), Text.literal("Clear")).setOnClick(() -> textField.setText("")), 0, 2, 6, 1);
rootPanel.validate(this);
}
}