use of mcjty.lib.container.GenericGuiContainer in project RFTools by McJty.
the class GuiCraftingGrid method initGui.
public void initGui(final ModBase modBase, final SimpleNetworkWrapper network, final Minecraft mc, GenericGuiContainer<?> gui, BlockPos pos, CraftingGridProvider provider, int guiLeft, int guiTop, int xSize, int ySize) {
this.mc = mc;
this.gui = gui;
SimpleNetworkWrapper network1 = network;
this.provider = provider;
this.pos = pos;
recipeList = new WidgetList(mc, gui).setLayoutHint(new PositionalLayout.PositionalHint(5, 5, 56, 102));
recipeList.addSelectionEvent(new DefaultSelectionEvent() {
@Override
public void select(Widget parent, int index) {
}
@Override
public void doubleClick(Widget parent, int index) {
selectRecipe();
}
});
craft1Button = new Button(mc, gui).setText("1").setLayoutHint(new PositionalLayout.PositionalHint(29, 183, 14, 10)).setTooltips("Craft one").addButtonEvent(parent -> craft(1));
craft4Button = new Button(mc, gui).setText("4").setLayoutHint(new PositionalLayout.PositionalHint(45, 183, 14, 10)).setTooltips("Craft four").addButtonEvent(parent -> craft(4));
craft8Button = new Button(mc, gui).setText("8").setLayoutHint(new PositionalLayout.PositionalHint(29, 195, 14, 10)).setTooltips("Craft eight").addButtonEvent(parent -> craft(8));
craftSButton = new Button(mc, gui).setText("*").setLayoutHint(new PositionalLayout.PositionalHint(45, 195, 14, 10)).setTooltips("Craft a stack").addButtonEvent(parent -> craft(-1));
storeButton = new Button(mc, gui).setText("Store").setLayoutHint(new PositionalLayout.PositionalHint(5, 109, 56, 14)).setTooltips("Store the current recipe").addButtonEvent(parent -> store());
Panel sidePanel = new Panel(mc, gui).setLayout(new PositionalLayout()).addChild(craft1Button).addChild(craft4Button).addChild(craft8Button).addChild(craftSButton).addChild(storeButton).addChild(recipeList);
int sideLeft = guiLeft - CraftingGridInventory.GRID_WIDTH - 2;
int sideTop = guiTop;
sidePanel.setBounds(new Rectangle(sideLeft, sideTop, CraftingGridInventory.GRID_WIDTH, CraftingGridInventory.GRID_HEIGHT));
sidePanel.setBackground(iconLocation);
craftWindow = new Window(gui, sidePanel);
}
use of mcjty.lib.container.GenericGuiContainer in project RFToolsDimensions by McJty.
the class GenericRFToolsBlock method createClientGui.
@Override
@SideOnly(Side.CLIENT)
public GuiContainer createClientGui(EntityPlayer entityPlayer, TileEntity tileEntity) {
T inventory = (T) tileEntity;
C container;
GenericGuiContainer gui;
try {
Constructor<? extends C> constructor = containerClass.getConstructor(EntityPlayer.class, IInventory.class);
container = constructor.newInstance(entityPlayer, inventory instanceof IInventory ? inventory : null);
Constructor<? extends GenericGuiContainer> guiConstructor = getGuiClass().getConstructor(tileEntityClass, containerClass);
gui = guiConstructor.newInstance(inventory, container);
return gui;
} catch (Exception e) {
Logging.logError("Severe exception during creation of gui!");
throw new RuntimeException(e);
}
}
Aggregations