aboutsummaryrefslogtreecommitdiff
path: root/GuiTest
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-08-03 00:55:52 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-08-03 00:55:52 +0300
commit8b64e485972a150907938edb1b66c9cb066d2aa9 (patch)
treecb8d61ccd860bd12f23740e1a86e57314f9ce7db /GuiTest
parentf6166a721c6b0a8c2096d5c5502c7b822630b757 (diff)
downloadLibGui-8b64e485972a150907938edb1b66c9cb066d2aa9.tar.gz
LibGui-8b64e485972a150907938edb1b66c9cb066d2aa9.tar.bz2
LibGui-8b64e485972a150907938edb1b66c9cb066d2aa9.zip
3.0.0 for 1.16.2-pre1
Mojang refactored text again :irritatered: - Widgets now take a Text again instead of StringRenderable/-Visitable - ScreenDrawing takes OrderedTexts instead of StringVisitables - To reduce the future updating workload, tooltips now use a new TooltipBuilder
Diffstat (limited to 'GuiTest')
-rw-r--r--GuiTest/build.gradle1
-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.java2
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java7
4 files changed, 6 insertions, 7 deletions
diff --git a/GuiTest/build.gradle b/GuiTest/build.gradle
index 2a71459..1cc83d9 100644
--- a/GuiTest/build.gradle
+++ b/GuiTest/build.gradle
@@ -34,7 +34,6 @@ dependencies {
compileOnly ("com.google.code.findbugs:jsr305:3.0.2") { transitive = false }
implementation project(':')
- modRuntime "io.github.prospector:modmenu:$rootProject.modmenu_version" // for testing
}
processResources {
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 c699b47..6a9f741 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
@@ -14,8 +14,9 @@ import net.minecraft.util.collection.DefaultedList;
import javax.annotation.Nullable;
public class GuiBlockEntity extends BlockEntity implements ImplementedInventory, NamedScreenHandlerFactory {
+ static final int INVENTORY_SIZE = 8;
- DefaultedList<ItemStack> items = DefaultedList.ofSize(8, ItemStack.EMPTY);
+ DefaultedList<ItemStack> items = DefaultedList.ofSize(INVENTORY_SIZE, ItemStack.EMPTY);
public GuiBlockEntity() {
super(LibGuiTest.GUI_BLOCKENTITY_TYPE);
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 732494e..9d638e2 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
@@ -10,7 +10,7 @@ import net.minecraft.text.LiteralText;
public class TestDescription extends SyncedGuiDescription {
public TestDescription(ScreenHandlerType<?> type, int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) {
- super(type, syncId, playerInventory, getBlockInventory(context), null);
+ super(type, syncId, playerInventory, getBlockInventory(context, GuiBlockEntity.INVENTORY_SIZE), null);
WGridPanel root = (WGridPanel)this.getRootPanel();
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 bcc2584..85ad3cd 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
@@ -1,10 +1,9 @@
package io.github.cottonmc.test.client;
-import java.util.List;
-
import io.github.cottonmc.cotton.gui.client.BackgroundPainter;
import io.github.cottonmc.cotton.gui.client.LightweightGuiDescription;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
+import io.github.cottonmc.cotton.gui.widget.TooltipBuilder;
import io.github.cottonmc.cotton.gui.widget.WGridPanel;
import io.github.cottonmc.cotton.gui.widget.WLabel;
import io.github.cottonmc.cotton.gui.widget.WSlider;
@@ -17,7 +16,6 @@ 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.StringRenderable;
import net.minecraft.util.Identifier;
public class TestClientGui extends LightweightGuiDescription {
@@ -38,8 +36,9 @@ public class TestClientGui extends LightweightGuiDescription {
WGridPanel root = new WGridPanel(22);
this.setRootPanel(root);
WLabel title = new WLabel(new LiteralText("Client Test Gui"), WLabel.DEFAULT_TEXT_COLOR) {
+ @Environment(EnvType.CLIENT)
@Override
- public void addTooltip(List<StringRenderable> tooltip) {
+ public void addTooltip(TooltipBuilder tooltip) {
tooltip.add(new LiteralText("Radical!"));
}
};