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/WBar.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WItemSlot.java53
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java8
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java6
4 files changed, 24 insertions, 47 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
index e180276..7c05189 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WBar.java
@@ -2,7 +2,7 @@ package io.github.cottonmc.cotton.gui.widget;
import java.util.List;
-import io.github.cottonmc.cotton.gui.CottonScreenController;
+import io.github.cottonmc.cotton.gui.GuiDescription;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@@ -146,7 +146,7 @@ public class WBar extends WWidget {
}
@Override
- public void createPeers(CottonScreenController c) {
+ public void createPeers(GuiDescription c) {
if (properties==null) properties = c.getPropertyDelegate();
}
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 5b9d500..0847dcb 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
@@ -4,7 +4,7 @@ import java.util.List;
import com.google.common.collect.Lists;
-import io.github.cottonmc.cotton.gui.CottonScreenController;
+import io.github.cottonmc.cotton.gui.GuiDescription;
import io.github.cottonmc.cotton.gui.ValidatedSlot;
import io.github.cottonmc.cotton.gui.client.BackgroundPainter;
import io.github.cottonmc.cotton.gui.client.ScreenDrawing;
@@ -17,13 +17,10 @@ public class WItemSlot extends WWidget {
private final List<Slot> peers = Lists.newArrayList();
private BackgroundPainter backgroundPainter;
private Inventory inventory;
- //private CottonScreenController container;
private int startIndex = 0;
private int slotsWide = 1;
private int slotsHigh = 1;
private boolean big = false;
- //private boolean ltr = true;
- private float opacity = 0.2f;
public WItemSlot(Inventory inventory, int startIndex, int slotsWide, int slotsHigh, boolean big, boolean ltr) {
this.inventory = inventory;
@@ -89,30 +86,18 @@ public class WItemSlot extends WWidget {
}
@Override
- public void createPeers(CottonScreenController c) {
- //this.container = c;
+ public void createPeers(GuiDescription c) {
peers.clear();
int index = startIndex;
- /*if (ltr) {
+ for (int y = 0; y < slotsHigh; y++) {
for (int x = 0; x < slotsWide; x++) {
- for (int y = 0; y < slotsHigh; y++) {
- ValidatedSlot slot = new ValidatedSlot(inventory, index, this.getAbsoluteX() + (x * 18), this.getAbsoluteY() + (y * 18));
- peers.add(slot);
- c.addSlotPeer(slot);
- index++;
- }
- }
- } else {*/
- for (int y = 0; y < slotsHigh; y++) {
- for (int x = 0; x < slotsWide; x++) {
- ValidatedSlot slot = new ValidatedSlot(inventory, index, this.getAbsoluteX() + (x * 18), this.getAbsoluteY() + (y * 18));
- peers.add(slot);
- c.addSlotPeer(slot);
- index++;
- }
+ ValidatedSlot slot = new ValidatedSlot(inventory, index, this.getAbsoluteX() + (x * 18), this.getAbsoluteY() + (y * 18));
+ peers.add(slot);
+ c.addSlotPeer(slot);
+ index++;
}
- //}
+ }
}
@Environment(EnvType.CLIENT)
@@ -126,22 +111,16 @@ public class WItemSlot extends WWidget {
if (backgroundPainter!=null) {
backgroundPainter.paintBackground(x, y, this);
} else {
- for (int xi = 0; xi < slotsWide; xi++) {
- for (int yi = 0; yi < slotsHigh; yi++) {
- //int lo = ScreenDrawing.colorAtOpacity(0x000000, 0.72f);
- //int bg = ScreenDrawing.colorAtOpacity(0x000000, 0.29f);
- //int hi = ScreenDrawing.colorAtOpacity(0xFFFFFF, 1.0f);
- //if (container!=null) {
- int lo = ScreenDrawing.colorAtOpacity(0x000000, opacity);
- int bg = ScreenDrawing.colorAtOpacity(0x000000, opacity/2.4f);
- int hi = ScreenDrawing.colorAtOpacity(0xFFFFFF, opacity);
- //}
-
- if (big) {
- ScreenDrawing.drawBeveledPanel((xi * 18) + x - 4, (yi * 18) + y - 4, 24, 24,
+ for(int ix = 0; ix < getWidth()/18; ++ix) {
+ for(int iy = 0; iy < getHeight()/18; ++iy) {
+ int lo = 0xFF373737;
+ int bg = 0x4C000000;
+ int hi = 0xFFFFFFFF;
+ if (isBigSlot()) {
+ ScreenDrawing.drawBeveledPanel((ix * 18) + x - 4, (iy * 18) + y - 4, 24, 24,
lo, bg, hi);
} else {
- ScreenDrawing.drawBeveledPanel((xi * 18) + x - 1, (yi * 18) + y - 1, 18, 18,
+ ScreenDrawing.drawBeveledPanel((ix * 18) + x - 1, (iy * 18) + y - 1, 18, 18,
lo, bg, hi);
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
index 1fa0510..a79f3be 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
@@ -4,7 +4,7 @@ import java.util.List;
import com.google.common.collect.Lists;
-import io.github.cottonmc.cotton.gui.CottonScreenController;
+import io.github.cottonmc.cotton.gui.GuiDescription;
import io.github.cottonmc.cotton.gui.client.BackgroundPainter;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@@ -15,12 +15,10 @@ public class WPanel extends WWidget {
private BackgroundPainter backgroundPainter = null;
@Override
- public void createPeers(CottonScreenController c) {
- //System.out.println("Creating peers - before: "+c.slotList.size());
+ public void createPeers(GuiDescription c) {
for(WWidget child : children) {
child.createPeers(c);
}
- //System.out.println("Peers created - after: "+c.slotList.size());
}
public void remove(WWidget w) {
@@ -116,7 +114,7 @@ public class WPanel extends WWidget {
}
@Override
- public void validate(CottonScreenController c) {
+ public void validate(GuiDescription c) {
layout();
createPeers(c);
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
index f1eb1d6..4a3f806 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WWidget.java
@@ -3,7 +3,7 @@ package io.github.cottonmc.cotton.gui.widget;
import java.util.ArrayList;
import java.util.List;
-import io.github.cottonmc.cotton.gui.CottonScreenController;
+import io.github.cottonmc.cotton.gui.GuiDescription;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
@@ -129,7 +129,7 @@ public class WWidget {
* Creates "heavyweight" component peers
* @param c the top-level Container that will hold the peers
*/
- public void createPeers(CottonScreenController c) {
+ public void createPeers(GuiDescription c) {
}
@Environment(EnvType.CLIENT)
@@ -188,7 +188,7 @@ public class WWidget {
* Creates component peers, lays out children, and initializes animation data for this Widget and all its children.
* The host container must clear any heavyweight peers from its records before this method is called.
*/
- public void validate(CottonScreenController host) {
+ public void validate(GuiDescription host) {
//valid = true;
}