80 lines
1.4 KiB
Markdown
80 lines
1.4 KiB
Markdown
# UIIconButtonComponent.UIIconButtonComponent
|
|
|
|
[← UIIconButtonComponent](index.md) · [← Master](../../wiki.md)
|
|
|
|
Parça 2/2 · [önceki](UIIconButtonComponent.md)
|
|
|
|
{
|
|
var ui = mappet.createUI(c, "handler").background();
|
|
var icons = Java.type("mchorse.mclib.client.gui.utils.IconRegistry").icons.keySet();
|
|
|
|
var grid = ui.grid(5);
|
|
|
|
grid.getCurrent().width(20).rxy(0.5, 0.5).w(245).anchor(0.5);
|
|
|
|
for each (var icon in icons)
|
|
{
|
|
grid.icon(icon).wh(20, 20).tooltip("Icon's ID: " + icon);
|
|
}
|
|
|
|
c.getSubject().openUI(ui);
|
|
}
|
|
|
|
|
|
A basic example:
|
|
|
|
// Assuming that uiContext is a IMappetUIContext
|
|
uiContext.get("icon").icon("gear");
|
|
|
|
|
|
Parameters:
|
|
icon - The icon's ID.
|
|
|
|
isDataReserved
|
|
|
|
protected boolean isDataReserved()
|
|
|
|
Overrides:
|
|
isDataReserved in class UIComponent
|
|
|
|
applyProperty
|
|
|
|
protected void applyProperty(UIContext context,
|
|
java.lang.String key,
|
|
GuiElement element)
|
|
|
|
Overrides:
|
|
applyProperty in class UIComponent
|
|
|
|
create
|
|
|
|
public GuiElement create(Minecraft mc,
|
|
UIContext context)
|
|
|
|
Specified by:
|
|
create in class UIComponent
|
|
|
|
populateData
|
|
|
|
public void populateData(NBTTagCompound tag)
|
|
|
|
Overrides:
|
|
populateData in class UIComponent
|
|
|
|
serializeNBT
|
|
|
|
public void serializeNBT(NBTTagCompound tag)
|
|
|
|
Overrides:
|
|
serializeNBT in class UIComponent
|
|
|
|
deserializeNBT
|
|
|
|
public void deserializeNBT(NBTTagCompound tag)
|
|
|
|
Overrides:
|
|
|
|
|
|
|
|
deserializeNBT in class UIComponent
|