Skip to content

Commit 136be31

Browse files
Fix normal gui ignoring frozen, ignoreObscured, background properties
1 parent 12c545e commit 136be31

3 files changed

Lines changed: 21 additions & 7 deletions

File tree

invui/src/main/java/xyz/xenondevs/invui/gui/AbstractGui.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ public sealed abstract class AbstractGui
4040
permits NormalGuiImpl, AbstractPagedGui, AbstractScrollGui, TabGuiImpl
4141
{
4242

43-
private static final boolean DEFAULT_FROZEN = false;
44-
private static final boolean DEFAULT_IGNORE_OBSCURED_INVENTORY_SLOTS = true;
45-
private static final @Nullable ItemProvider DEFAULT_BACKGROUND = null;
43+
public static final boolean DEFAULT_FROZEN = false;
44+
public static final boolean DEFAULT_IGNORE_OBSCURED_INVENTORY_SLOTS = true;
45+
public static final @Nullable ItemProvider DEFAULT_BACKGROUND = null;
4646

4747
private final int width;
4848
private final int height;

invui/src/main/java/xyz/xenondevs/invui/gui/Gui.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ static Gui empty(int width, int height) {
6060
* @return The created {@link Gui}.
6161
*/
6262
static Gui of(Structure structure) {
63-
return new NormalGuiImpl(structure);
63+
return new NormalGuiImpl(
64+
structure,
65+
MutableProperty.of(AbstractGui.DEFAULT_FROZEN),
66+
MutableProperty.of(AbstractGui.DEFAULT_IGNORE_OBSCURED_INVENTORY_SLOTS),
67+
MutableProperty.of(AbstractGui.DEFAULT_BACKGROUND)
68+
);
6469
}
6570

6671
/**

invui/src/main/java/xyz/xenondevs/invui/gui/NormalGuiImpl.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,22 @@
11
package xyz.xenondevs.invui.gui;
22

3+
import org.jspecify.annotations.Nullable;
4+
import xyz.xenondevs.invui.item.ItemProvider;
5+
import xyz.xenondevs.invui.state.MutableProperty;
6+
37
final class NormalGuiImpl extends AbstractGui {
48

59
public NormalGuiImpl(int width, int height) {
610
super(width, height);
711
}
812

9-
public NormalGuiImpl(Structure structure) {
10-
super(structure.getWidth(), structure.getHeight());
13+
public NormalGuiImpl(
14+
Structure structure,
15+
MutableProperty<Boolean> frozen,
16+
MutableProperty<Boolean> ignoreObscuredInventorySlots,
17+
MutableProperty<@Nullable ItemProvider> background
18+
) {
19+
super(structure.getWidth(), structure.getHeight(), frozen, ignoreObscuredInventorySlots, background);
1120
applyStructure(structure);
1221
}
1322

@@ -18,7 +27,7 @@ public NormalGuiImpl build() {
1827
if (structure == null)
1928
throw new IllegalStateException("Structure is not defined.");
2029

21-
var gui = new NormalGuiImpl(structure);
30+
var gui = new NormalGuiImpl(structure, frozen, ignoreObscuredInventorySlots, background);
2231
applyModifiers(gui);
2332
return gui;
2433
}

0 commit comments

Comments
 (0)