aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java2
-rw-r--r--src/testMod/java/io/github/cottonmc/test/TestDescription.java8
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
index f5e90ef..bfe64a2 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java
@@ -513,7 +513,7 @@ public class WItemSlot extends WWidget {
backgroundPainter.paintBackground(context, x, y, this);
}
- if (icon != null && (iconOnlyPaintedForEmptySlots || inventory.getStack(startIndex).isEmpty())) {
+ if (icon != null && (!iconOnlyPaintedForEmptySlots || inventory.getStack(startIndex).isEmpty())) {
icon.paint(context, x + 1, y + 1, 16);
}
}
diff --git a/src/testMod/java/io/github/cottonmc/test/TestDescription.java b/src/testMod/java/io/github/cottonmc/test/TestDescription.java
index fdea211..7c24610 100644
--- a/src/testMod/java/io/github/cottonmc/test/TestDescription.java
+++ b/src/testMod/java/io/github/cottonmc/test/TestDescription.java
@@ -15,6 +15,7 @@ import io.github.cottonmc.cotton.gui.widget.WGridPanel;
import io.github.cottonmc.cotton.gui.widget.WItemSlot;
import io.github.cottonmc.cotton.gui.widget.WLabel;
import io.github.cottonmc.cotton.gui.widget.WTextField;
+import io.github.cottonmc.cotton.gui.widget.WToggleButton;
import io.github.cottonmc.cotton.gui.widget.data.Texture;
import io.github.cottonmc.cotton.gui.widget.icon.TextureIcon;
@@ -49,7 +50,12 @@ public class TestDescription extends SyncedGuiDescription {
root.add(new WTextField(Text.literal("Type something...")).setMaxLength(64), 0, 7, 5, 1);
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);
+ WItemSlot glassOutputSlot = WItemSlot.outputOf(blockInventory, 0).setOutputFilter(stack -> stack.isOf(Items.GLASS));
+ glassOutputSlot.setIcon(new TextureIcon(new Identifier("minecraft:textures/block/glass.png")));
+ root.add(glassOutputSlot, 4, 9);
+ WToggleButton glassIconToggle = new WToggleButton(Text.literal("Show glass icon only when empty?"));
+ glassIconToggle.setOnToggle(glassOutputSlot::setIconOnlyPaintedForEmptySlots);
+ root.add(glassIconToggle, 0, 10);
root.add(WItemSlot.of(blockInventory, 7).setIcon(new TextureIcon(new Identifier("libgui-test", "saddle.png"))).setInputFilter(stack -> stack.isOf(Items.SADDLE)), 7, 10);