use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiBooster method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(8, 101, 10, 76)).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
initRedstoneMode();
toplevel.addChild(energyBar).addChild(redstoneMode);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
window = new Window(this, toplevel);
Keyboard.enableRepeatEvents(true);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiCrafter method initGui.
@Override
public void initGui() {
super.initGui();
int maxEnergyStored = tileEntity.getMaxEnergyStored();
energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(12, 141, 10, 76)).setShowText(false);
energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
initKeepMode();
initInternalRecipe();
Slider listSlider = initRecipeList();
applyButton = new Button(mc, this).setText("Apply").setTooltips("Press to apply the", "recipe to the crafter").addButtonEvent(parent -> applyRecipe()).setEnabled(false).setLayoutHint(new PositionalLayout.PositionalHint(212, 65, 34, 16));
Button rememberButton = new Button(mc, this).setText("R").setTooltips("Remember the current items", "in the internal and", "external buffers").addButtonEvent(widget -> rememberItems()).setLayoutHint(new PositionalLayout.PositionalHint(148, 74, 18, 16));
Button forgetButton = new Button(mc, this).setText("F").setTooltips("Forget the remembered layout").addButtonEvent(widget -> forgetItems()).setLayoutHint(new PositionalLayout.PositionalHint(168, 74, 18, 16));
initRedstoneMode();
initSpeedMode();
Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(keepItem).addChild(internalRecipe).addChild(recipeList).addChild(listSlider).addChild(applyButton).addChild(redstoneMode).addChild(speedMode).addChild(rememberButton).addChild(forgetButton);
toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
if (lastSelected != -1 && lastSelected < tileEntity.getSizeInventory()) {
recipeList.setSelected(lastSelected);
}
// sendChangeToServer(-1, null, null, false, CraftingRecipe.CraftMode.EXT);
window = new Window(this, toplevel);
tileEntity.requestRfFromServer(RFTools.MODID);
}
use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.
the class GuiCraftingGrid method addRecipeLine.
private void addRecipeLine(ItemStack craftingResult) {
String readableName = BlockTools.getReadableName(craftingResult);
int color = StyleConfig.colorTextInListNormal;
if (craftingResult.isEmpty()) {
readableName = "<recipe>";
color = 0xFF505050;
}
Panel panel = new Panel(mc, gui).setLayout(new PositionalLayout()).addChild(new BlockRender(mc, gui).setRenderItem(craftingResult).setLayoutHint(new PositionalLayout.PositionalHint(0, 0, 18, 18))).addChild(new mcjty.lib.gui.widgets.Label(mc, gui).setColor(color).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText(readableName).setLayoutHint(new PositionalLayout.PositionalHint(20, 0, 30, 18)));
recipeList.addChild(panel);
}
use of mcjty.lib.gui.layout.PositionalLayout 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.gui.layout.PositionalLayout in project RFToolsDimensions by McJty.
the class GuiDimletWorkbench method addItemToList.
private void addItemToList(DimletKey key, WidgetList itemList) {
Panel panel = new Panel(mc, this).setLayout(new PositionalLayout()).setDesiredWidth(116).setDesiredHeight(16);
panel.setUserObject(key);
itemList.addChild(panel);
BlockRender blockRender = new BlockRender(mc, this).setRenderItem(KnownDimletConfiguration.getDimletStack(key)).setLayoutHint(new PositionalLayout.PositionalHint(1, 0, 16, 16)).setUserObject(key);
panel.addChild(blockRender);
String displayName = KnownDimletConfiguration.getDisplayName(key);
AbstractWidget label = new Label(mc, this).setText(displayName).setColor(StyleConfig.colorTextInListNormal).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(20, 0, 95, 16)).setUserObject(key);
panel.addChild(label);
}
Aggregations