use of gregtech.common.gui.widget.CraftingSlotWidget in project GregTech by GregTechCE.
the class MetaTileEntityWorkbench method createWorkbenchTab.
private AbstractWidgetGroup createWorkbenchTab() {
WidgetGroup widgetGroup = new WidgetGroup();
CraftingRecipeResolver recipeResolver = getRecipeResolver();
widgetGroup.addWidget(new ImageWidget(88 - 13, 44 - 13, 26, 26, GuiTextures.SLOT));
widgetGroup.addWidget(new CraftingSlotWidget(recipeResolver, 0, 88 - 9, 44 - 9));
// crafting grid
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
widgetGroup.addWidget(new PhantomSlotWidget(craftingGrid, j + i * 3, 8 + j * 18, 17 + i * 18).setBackgroundTexture(GuiTextures.SLOT));
}
}
Supplier<String> textSupplier = () -> Integer.toString(recipeResolver.getItemsCrafted());
widgetGroup.addWidget(new SimpleTextWidget(88, 44 + 20, "", textSupplier));
Consumer<ClickData> clearAction = (clickData) -> recipeResolver.clearCraftingGrid();
widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 1, 17, 8, 8, "", clearAction).setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID));
widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 18 * 3 / 2, 18 * 3, 18 * 3, TextureArea.fullImage("textures/gui/base/darkened_slot.png")));
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
widgetGroup.addWidget(new MemorizedRecipeWidget(recipeMemory, j + i * 3, craftingGrid, 168 - 18 * 3 / 2 - 27 + j * 18, 44 - 27 + i * 18));
}
}
// tool inventory
for (int i = 0; i < 9; i++) {
widgetGroup.addWidget(new SlotWidget(toolInventory, i, 8 + i * 18, 76).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.TOOL_SLOT_OVERLAY));
}
// internal inventory
for (int i = 0; i < 2; ++i) {
for (int j = 0; j < 9; ++j) {
widgetGroup.addWidget(new SlotWidget(internalInventory, j + i * 9, 8 + j * 18, 99 + i * 18).setBackgroundTexture(GuiTextures.SLOT));
}
}
return widgetGroup;
}
Aggregations