Fix utility buttons not being added properly
This commit is contained in:
parent
ee0c98ee51
commit
898a9b37f0
3 changed files with 32 additions and 4 deletions
|
@ -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
|
||||
|
|
|
@ -32,14 +32,19 @@ public class ChestGUI
|
|||
public List<ChestGUIButton> 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());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!");
|
||||
}
|
||||
|
|
Reference in a new issue