Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions src/main/java/guideme/document/block/LytSlot.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class LytSlot extends LytBlock implements InteractiveElement {
private static final int CYCLE_TIME = 2000;

private boolean largeSlot;
private boolean visibleSlot = true;

private final ItemStack[] stacks;

Expand All @@ -46,6 +47,10 @@ public void setLargeSlot(boolean largeSlot) {
this.largeSlot = largeSlot;
}

public boolean isSlotVisible() {return visibleSlot;}

public void setSlotVisible(boolean visibleSlot){this.visibleSlot = visibleSlot;}

@Override
protected LytRect computeLayout(LayoutContext context, int x, int y, int availableWidth) {
if (largeSlot) {
Expand All @@ -69,19 +74,20 @@ public void render(RenderContext context) {
var x = bounds.x();
var y = bounds.y();

GuiSprite texture;
if (largeSlot) {
texture = GuiAssets.LARGE_SLOT;
} else {
texture = GuiAssets.SLOT;
if (visibleSlot) {
GuiSprite texture;
if (largeSlot) {
texture = GuiAssets.LARGE_SLOT;
} else {
texture = GuiAssets.SLOT;
}
context.fillIcon(bounds, texture);
}
context.fillIcon(bounds, texture);

var padding = largeSlot ? LARGE_PADDING : PADDING;

var stack = getDisplayedStack();
if (!stack.isEmpty()) {
context.renderItem(stack, x + padding, y + padding, 1, ITEM_SIZE, ITEM_SIZE);
context.renderItem(stack, x + padding, y + padding, visibleSlot? 1: 0, ITEM_SIZE, ITEM_SIZE);
}
}

Expand Down
Loading