diff options
author | Luiz Feikes <33578169+Luligabi1@users.noreply.github.com> | 2023-09-09 06:25:12 -0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-09 12:25:12 +0300 |
commit | 4a63d4ee6c118c006ec5b09c1565cbd75b318a38 (patch) | |
tree | 7b5fe0e4b87064b7e3cc4e2bcf70aa708b920dae /src/testMod/java | |
parent | e7a36835ff95ac045bbeac156a105c16b4d23df2 (diff) | |
download | LibGui-4a63d4ee6c118c006ec5b09c1565cbd75b318a38.tar.gz LibGui-4a63d4ee6c118c006ec5b09c1565cbd75b318a38.tar.bz2 LibGui-4a63d4ee6c118c006ec5b09c1565cbd75b318a38.zip |
Add input/output filter + weaken WPlayerInvPanel's components' protection (#209)
Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com>
Diffstat (limited to 'src/testMod/java')
-rw-r--r-- | src/testMod/java/io/github/cottonmc/test/TestDescription.java | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/testMod/java/io/github/cottonmc/test/TestDescription.java b/src/testMod/java/io/github/cottonmc/test/TestDescription.java index 39b09d6..fdea211 100644 --- a/src/testMod/java/io/github/cottonmc/test/TestDescription.java +++ b/src/testMod/java/io/github/cottonmc/test/TestDescription.java @@ -48,24 +48,16 @@ public class TestDescription extends SyncedGuiDescription { 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(Text.literal("Large slot:")), 0, 9); - root.add(WItemSlot.outputOf(blockInventory, 0), 4, 9); + root.add(new WLabel(Text.literal("Large Glass-only output:")), 0, 9); + root.add(WItemSlot.outputOf(blockInventory, 0).setOutputFilter(stack -> stack.isOf(Items.GLASS)), 4, 9); - root.add(WItemSlot.of(blockInventory, 7).setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png"))), 7, 9); + root.add(WItemSlot.of(blockInventory, 7).setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png"))).setInputFilter(stack -> stack.isOf(Items.SADDLE)), 7, 10); root.add(createPlayerInventoryPanel(), 0, 11); System.out.println(root.toString()); this.getRootPanel().validate(this); - getRootPanel().streamChildren() - .forEach(child -> { - if (child instanceof WItemSlot wis) { - // Prevent apples from entering the item slots - wis.setFilter(stack -> !stack.isOf(Items.APPLE)); - } - }); - ScreenNetworking.of(this, NetworkSide.SERVER).receive(TEST_MESSAGE, buf -> { System.out.println("Received on the server!"); }); |