From a1bb6316f2d6ecc0019e00438b4cf724dde68f73 Mon Sep 17 00:00:00 2001
From: Juuz <6596629+Juuxel@users.noreply.github.com>
Date: Sat, 5 Jun 2021 00:13:59 +0300
Subject: Switch from accessor to AW, fixes #113

Accessors would be preferred but there is a mixin bug/regression
that prevents me from modifying final fields with accessors unless I do
some concerning hacky code.
---
 .../main/java/io/github/cottonmc/test/TestDescription.java   | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

(limited to 'GuiTest/src')

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 e0602be..e6c3564 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
@@ -18,8 +18,9 @@ public class TestDescription extends SyncedGuiDescription {
 		super(type, syncId, playerInventory, getBlockInventory(context, GuiBlockEntity.INVENTORY_SIZE), null);
 		
 		WGridPanel root = (WGridPanel)this.getRootPanel();
-		
-		root.add(WItemSlot.of(blockInventory, 0, 4, 1), 0, 1);
+
+		WItemSlot slot = WItemSlot.of(blockInventory, 0, 4, 1);
+		root.add(slot, 0, 1);
 
 		WButton buttonA = new WButton(new LiteralText("Button A"));
 
@@ -45,5 +46,12 @@ public class TestDescription extends SyncedGuiDescription {
 		ScreenNetworking.of(this, NetworkSide.SERVER).receive(TEST_MESSAGE, buf -> {
 			System.out.println("Received on the server!");
 		});
+
+		try {
+			slot.onHidden();
+			slot.onShown();
+		} catch (Throwable t) {
+			throw new AssertionError("ValidatedSlot.setVisible crashed", t);
+		}
 	}
 }
-- 
cgit