Search in sources :

Example 31 with PositionalLayout

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);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) EnergyBar(mcjty.lib.gui.widgets.EnergyBar)

Example 32 with PositionalLayout

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);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) OpenGlHelper(net.minecraft.client.renderer.OpenGlHelper) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStackList(mcjty.lib.varia.ItemStackList) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) RFTools(mcjty.rftools.RFTools) IRecipe(net.minecraft.item.crafting.IRecipe) GlStateManager(net.minecraft.client.renderer.GlStateManager) TextFormatting(net.minecraft.util.text.TextFormatting) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) RedstoneMode(mcjty.lib.varia.RedstoneMode) Argument(mcjty.lib.network.Argument) CraftingRecipe(mcjty.rftools.craftinggrid.CraftingRecipe) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) RenderHelper(mcjty.lib.gui.RenderHelper) Container(net.minecraft.inventory.Container) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 33 with PositionalLayout

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);
}
Also used : PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets)

Example 34 with PositionalLayout

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);
}
Also used : SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) BlockTools(mcjty.lib.varia.BlockTools) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Arguments(mcjty.lib.network.Arguments) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) Gui(net.minecraft.client.gui.Gui) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) SimpleNetworkWrapper(net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModBase(mcjty.lib.base.ModBase) RFTools(mcjty.rftools.RFTools) IRecipe(net.minecraft.item.crafting.IRecipe) GlStateManager(net.minecraft.client.renderer.GlStateManager) BlockPos(net.minecraft.util.math.BlockPos) Mouse(org.lwjgl.input.Mouse) EntityPlayer(net.minecraft.entity.player.EntityPlayer) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) CommandHandler(mcjty.rftools.CommandHandler) InventoryCrafting(net.minecraft.inventory.InventoryCrafting) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Example 35 with PositionalLayout

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);
}
Also used : Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

Aggregations

PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)62 Window (mcjty.lib.gui.Window)53 Panel (mcjty.lib.gui.widgets.Panel)47 Label (mcjty.lib.gui.widgets.Label)25 Argument (mcjty.lib.network.Argument)19 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)18 ResourceLocation (net.minecraft.util.ResourceLocation)18 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)16 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)15 Button (mcjty.lib.gui.widgets.Button)15 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)15 ItemStack (net.minecraft.item.ItemStack)15 Rectangle (java.awt.Rectangle)14 StyleConfig (mcjty.lib.base.StyleConfig)14 RFTools (mcjty.rftools.RFTools)14 java.awt (java.awt)13 TextField (mcjty.lib.gui.widgets.TextField)13 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)11 List (java.util.List)9 Slot (net.minecraft.inventory.Slot)9