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.
|
# The license of the mod. Review your options at https://choosealicense.com/. All Rights Reserved is the default.
|
||||||
mod_license=GPLv3
|
mod_license=GPLv3
|
||||||
# The mod version. See https://semver.org/
|
# 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.
|
# 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.
|
# This should match the base package used for the mod sources.
|
||||||
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
# See https://maven.apache.org/guides/mini/guide-naming-conventions.html
|
||||||
|
|
|
@ -32,14 +32,19 @@ public class ChestGUI
|
||||||
public List<ChestGUIButton> buttons = new ArrayList<>();
|
public List<ChestGUIButton> buttons = new ArrayList<>();
|
||||||
private ChestGUIIdentifier id;
|
private ChestGUIIdentifier id;
|
||||||
private int page =0;
|
private int page =0;
|
||||||
private boolean hasAdd = false;
|
public boolean hasAdd = false;
|
||||||
private boolean hasReset = false;
|
public boolean hasReset = false;
|
||||||
private boolean hasRemove = false;
|
public boolean hasRemove = false;
|
||||||
|
|
||||||
private Runnable onAdd;
|
private Runnable onAdd;
|
||||||
private Runnable onReset;
|
private Runnable onReset;
|
||||||
private Runnable onRemove;
|
private Runnable onRemove;
|
||||||
|
|
||||||
|
public ChestGUIButton addBtn = null;
|
||||||
|
public ChestGUIButton resetBtn = null;
|
||||||
|
public ChestGUIButton removeBtn = null;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ChestGUI withAdd(Runnable onAdd)
|
public ChestGUI withAdd(Runnable onAdd)
|
||||||
{
|
{
|
||||||
|
@ -97,6 +102,8 @@ public class ChestGUI
|
||||||
onRemove.run();
|
onRemove.run();
|
||||||
}, new Vector2i(2, 3));
|
}, new Vector2i(2, 3));
|
||||||
|
|
||||||
|
removeBtn = rem;
|
||||||
|
|
||||||
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -108,6 +115,8 @@ public class ChestGUI
|
||||||
onReset.run();
|
onReset.run();
|
||||||
}, new Vector2i(2, 4));
|
}, new Vector2i(2, 4));
|
||||||
|
|
||||||
|
resetBtn = rem;
|
||||||
|
|
||||||
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -121,6 +130,8 @@ public class ChestGUI
|
||||||
onAdd.run();
|
onAdd.run();
|
||||||
}, new Vector2i(2, 5));
|
}, new Vector2i(2, 5));
|
||||||
|
|
||||||
|
addBtn = rem;
|
||||||
|
|
||||||
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
container.setStackInSlot(rem.getSlotNum(), rem.buildIcon());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,23 @@ public class ChestGUIReadOnlyStackHandler extends ItemStackHandler
|
||||||
{
|
{
|
||||||
setStackInSlot(btn.getSlotNum(), btn.buildIcon());
|
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 Buttons list is null");
|
||||||
} else LibZontreck.LOGGER.error("Gui is null!");
|
} else LibZontreck.LOGGER.error("Gui is null!");
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue