use of gregtech.api.gui.widgets.SortingButtonWidget in project GregTech by GregTechCE.
the class MetaTileEntityChest method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, Math.max(176, 14 + rowSize * 18), 18 + 18 * amountOfRows + 94).label(5, 5, getMetaFullName());
builder.widget(new SortingButtonWidget(111, 4, 60, 10, "gregtech.gui.sort", (info) -> sortInventorySlotContents(inventory)));
for (int y = 0; y < amountOfRows; y++) {
for (int x = 0; x < rowSize; x++) {
int index = y * rowSize + x;
builder.slot(inventory, index, 7 + x * 18, 18 + y * 18, GuiTextures.SLOT);
}
}
int startX = (Math.max(176, 14 + rowSize * 18) - 162) / 2;
builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, startX, 18 + 18 * amountOfRows + 12);
if (!getWorld().isRemote) {
builder.bindOpenListener(() -> onContainerOpen(entityPlayer));
builder.bindCloseListener(() -> onContainerClose(entityPlayer));
}
return builder.build(getHolder(), entityPlayer);
}
Aggregations