From 8b64e485972a150907938edb1b66c9cb066d2aa9 Mon Sep 17 00:00:00 2001 From: Juuxel <6596629+Juuxel@users.noreply.github.com> Date: Mon, 3 Aug 2020 00:55:52 +0300 Subject: 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 --- GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java | 3 ++- GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java | 2 +- .../main/java/io/github/cottonmc/test/client/TestClientGui.java | 7 +++---- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'GuiTest/src/main/java/io') 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 items = DefaultedList.ofSize(8, ItemStack.EMPTY); + DefaultedList 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 tooltip) { + public void addTooltip(TooltipBuilder tooltip) { tooltip.add(new LiteralText("Radical!")); } }; -- cgit