diff --git a/gradle.properties b/gradle.properties index 2d8a093..45576e4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -53,7 +53,7 @@ mod_name=Zontreck Library Mod # The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default. mod_license=GPLv3 # The mod version. See https://semver.org/ -mod_version=1.10.011024.0121 +mod_version=1.10.011024.0312 # The group ID for the mod. It is only important when publishing as an artifact to a Maven repository. # This should match the base package used for the mod sources. # See https://maven.apache.org/guides/mini/guide-naming-conventions.html diff --git a/src/main/java/dev/zontreck/libzontreck/chestgui/ChestGUI.java b/src/main/java/dev/zontreck/libzontreck/chestgui/ChestGUI.java index 7b77529..51976f7 100644 --- a/src/main/java/dev/zontreck/libzontreck/chestgui/ChestGUI.java +++ b/src/main/java/dev/zontreck/libzontreck/chestgui/ChestGUI.java @@ -32,14 +32,19 @@ public class ChestGUI public List buttons = new ArrayList<>(); private ChestGUIIdentifier id; private int page =0; - private boolean hasAdd = false; - private boolean hasReset = false; - private boolean hasRemove = false; + public boolean hasAdd = false; + public boolean hasReset = false; + public boolean hasRemove = false; private Runnable onAdd; private Runnable onReset; private Runnable onRemove; + public ChestGUIButton addBtn = null; + public ChestGUIButton resetBtn = null; + public ChestGUIButton removeBtn = null; + + public ChestGUI withAdd(Runnable onAdd) { @@ -97,6 +102,8 @@ public class ChestGUI onRemove.run(); }, new Vector2i(2, 3)); + removeBtn = rem; + container.setStackInSlot(rem.getSlotNum(), rem.buildIcon()); } @@ -108,6 +115,8 @@ public class ChestGUI onReset.run(); }, new Vector2i(2, 4)); + resetBtn = rem; + container.setStackInSlot(rem.getSlotNum(), rem.buildIcon()); } @@ -121,6 +130,8 @@ public class ChestGUI onAdd.run(); }, new Vector2i(2, 5)); + addBtn = rem; + container.setStackInSlot(rem.getSlotNum(), rem.buildIcon()); } } diff --git a/src/main/java/dev/zontreck/libzontreck/dynamicchest/ChestGUIReadOnlyStackHandler.java b/src/main/java/dev/zontreck/libzontreck/dynamicchest/ChestGUIReadOnlyStackHandler.java index a0a764e..e29a5dd 100644 --- a/src/main/java/dev/zontreck/libzontreck/dynamicchest/ChestGUIReadOnlyStackHandler.java +++ b/src/main/java/dev/zontreck/libzontreck/dynamicchest/ChestGUIReadOnlyStackHandler.java @@ -49,6 +49,23 @@ public class ChestGUIReadOnlyStackHandler extends ItemStackHandler { setStackInSlot(btn.getSlotNum(), btn.buildIcon()); } + + if(gui.hasAdd) + { + setStackInSlot(gui.addBtn.getSlotNum(), gui.addBtn.buildIcon()); + } + + if(gui.hasReset) + { + setStackInSlot(gui.resetBtn.getSlotNum(), gui.resetBtn.buildIcon()); + } + + if(gui.hasRemove) + { + setStackInSlot(gui.removeBtn.getSlotNum(), gui.removeBtn.buildIcon()); + } + + } else LibZontreck.LOGGER.error("Gui Buttons list is null"); } else LibZontreck.LOGGER.error("Gui is null!"); }