diff options
author | Juuxel <kasperi.kauppi@gmail.com> | 2020-06-24 17:52:31 +0300 |
---|---|---|
committer | Juuxel <kasperi.kauppi@gmail.com> | 2020-06-24 17:52:31 +0300 |
commit | 8dd52aa188d587162115b5b1269082878570ea6f (patch) | |
tree | 8ae11346621b740868261dd7b0400568356dae25 | |
parent | adc9b7199268ffe57b631a89e4bb2c327a02d615 (diff) | |
download | LibGui-8dd52aa188d587162115b5b1269082878570ea6f.tar.gz LibGui-8dd52aa188d587162115b5b1269082878570ea6f.tar.bz2 LibGui-8dd52aa188d587162115b5b1269082878570ea6f.zip |
Fix WItemSlot.<init> using client-only painters from common code
-rw-r--r-- | src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java | 7 |
1 files changed, 3 insertions, 4 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 d21ee98..75c77cd 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 @@ -23,7 +23,8 @@ public class WItemSlot extends WWidget { private final List<ValidatedSlot> peers = new ArrayList<>(); @Nullable @Environment(EnvType.CLIENT) - private BackgroundPainter backgroundPainter = BackgroundPainter.SLOT; + // TODO: Set the background painter to SLOT in a new method that sets a widget's default painter. + private BackgroundPainter backgroundPainter = null; private Inventory inventory; private int startIndex = 0; private int slotsWide = 1; @@ -285,9 +286,7 @@ public class WItemSlot extends WWidget { @Environment(EnvType.CLIENT) @Override public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) { - if (backgroundPainter!=null) { - backgroundPainter.paintBackground(x, y, this); - } + (backgroundPainter != null ? backgroundPainter : BackgroundPainter.SLOT).paintBackground(x, y, this); } @Nullable |