Search in sources :

Example 36 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsDimensions by McJty.

the class GuiDimletWorkbench method initGui.

@Override
public void initGui() {
    super.initGui();
    searchBar = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(120, 7, 128, 16)).addTextEvent((widget, string) -> {
        itemList.setSelected(-1);
        listDirty = true;
    });
    itemList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(120, 25, 118, 133)).setLeftMargin(0).setRowheight(-1).addSelectionEvent(new SelectionEvent() {

        @Override
        public void select(Widget widget, int i) {
        }

        @Override
        public void doubleClick(Widget widget, int i) {
            EntityPlayerSP player = Minecraft.getMinecraft().player;
            if (player.isCreative() && (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT))) {
                cheatDimlet();
            } else {
                suggestParts();
            }
        }
    });
    slider = new Slider(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(239, 25, 9, 133)).setDesiredWidth(11).setVertical().setScrollable(itemList);
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(88, 9, 30, 10)).setShowText(false).setHorizontal();
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    extractButton = new ToggleButton(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(30, 7, 56, 14)).setCheckMarker(true).addButtonEvent(parent -> setExtractMode()).setTooltips("If on dimlets will be reconstructed into parts");
    extractButton.setPressed(tileEntity.isExtractMode());
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(extractButton).addChild(energyBar).addChild(itemList).addChild(slider).addChild(searchBar);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    listDirty = true;
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsDimMessages(mcjty.rftoolsdim.network.RFToolsDimMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) DimletCraftingTools(mcjty.rftoolsdim.dimensions.dimlets.types.DimletCraftingTools) Keyboard(org.lwjgl.input.Keyboard) Label(mcjty.lib.gui.widgets.Label) KnownDimletConfiguration(mcjty.rftoolsdim.dimensions.dimlets.KnownDimletConfiguration) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) Panel(mcjty.lib.gui.widgets.Panel) RFToolsDim(mcjty.rftoolsdim.RFToolsDim) Minecraft(net.minecraft.client.Minecraft) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ModItems(mcjty.rftoolsdim.items.ModItems) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) DimletKey(mcjty.rftoolsdim.dimensions.dimlets.DimletKey) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) TextFormatting(net.minecraft.util.text.TextFormatting) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) Settings(mcjty.rftoolsdim.config.Settings) Mouse(org.lwjgl.input.Mouse) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Panel(mcjty.lib.gui.widgets.Panel) SelectionEvent(mcjty.lib.gui.events.SelectionEvent) TextField(mcjty.lib.gui.widgets.TextField) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 37 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFToolsDimensions by McJty.

the class GuiDimensionEnscriber method initGui.

@Override
public void initGui() {
    super.initGui();
    extractButton = new Button(mc, this).setText("Extract").setLayoutHint(new PositionalLayout.PositionalHint(13, 164, 60, 16)).addButtonEvent(parent -> {
        extractDimlets();
    }).setTooltips("Extract the dimlets out of", "a realized dimension tab");
    storeButton = new Button(mc, this).setText("Store").setLayoutHint(new PositionalLayout.PositionalHint(13, 182, 60, 16)).addButtonEvent(parent -> {
        storeDimlets();
    }).setTooltips("Store dimlets in a", "empty dimension tab");
    nameField = new TextField(mc, this).addTextEvent((parent, newText) -> {
        storeName(newText);
    }).setLayoutHint(new PositionalLayout.PositionalHint(13, 200, 60, 16));
    validateField = new Label(mc, this).setText("Val");
    validateField.setTooltips("Hover here for errors...");
    validateField.setLayoutHint(new PositionalLayout.PositionalHint(35, 142, 38, 16));
    setNameFromDimensionTab();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(extractButton).addChild(storeButton).addChild(nameField).addChild(validateField);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) Label(mcjty.lib.gui.widgets.Label) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) TextField(mcjty.lib.gui.widgets.TextField)

Example 38 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiScreenController method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Button scanButton = new Button(mc, this).setText("Scan").setTooltips("Find all nearby screens", "and connect to them").setLayoutHint(new PositionalLayout.PositionalHint(30, 7, 50, 14));
    scanButton.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenControllerTileEntity.CMD_SCAN));
    Button detachButton = new Button(mc, this).setText("Detach").setTooltips("Detach from all screens").setLayoutHint(new PositionalLayout.PositionalHint(90, 7, 50, 14));
    detachButton.addButtonEvent(parent -> sendServerCommand(RFToolsMessages.INSTANCE, ScreenControllerTileEntity.CMD_DETACH));
    infoLabel = new Label(mc, this);
    infoLabel.setLayoutHint(new PositionalLayout.PositionalHint(30, 25, 140, 14));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(scanButton).addChild(detachButton).addChild(infoLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

Example 39 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiPowerCell method initGui.

@Override
public void initGui() {
    super.initGui();
    energyBar = new EnergyBar(mc, this).setVertical().setMaxValue(1000).setLayoutHint(new PositionalLayout.PositionalHint(10, 7, 8, 54)).setShowText(false);
    energyBar.setValue(0);
    Button allNone = new Button(mc, this).setText("None").setTooltips("Set all sides to 'none'").setLayoutHint(new PositionalLayout.PositionalHint(140, 10, 32, 15)).addButtonEvent(e -> sendServerCommand(RFToolsMessages.INSTANCE, PowerCellTileEntity.CMD_SETNONE));
    Button allInput = new Button(mc, this).setText("In").setTooltips("Set all sides to", "accept energy").setLayoutHint(new PositionalLayout.PositionalHint(140, 27, 32, 15)).addButtonEvent(e -> sendServerCommand(RFToolsMessages.INSTANCE, PowerCellTileEntity.CMD_SETINPUT));
    Button allOutput = new Button(mc, this).setText("Out").setTooltips("Set all sides to", "send energy").setLayoutHint(new PositionalLayout.PositionalHint(140, 44, 32, 15)).addButtonEvent(e -> sendServerCommand(RFToolsMessages.INSTANCE, PowerCellTileEntity.CMD_SETOUTPUT));
    stats = new Button(mc, this).setText("Stats").setTooltips("Power statistics. Press to clear:").setLayoutHint(new PositionalLayout.PositionalHint(100, 10, 32, 15)).addButtonEvent(e -> sendServerCommand(RFToolsMessages.INSTANCE, PowerCellTileEntity.CMD_CLEARSTATS));
    Label label = new Label(mc, this);
    label.setText("Link:").setTooltips("Link a powercard to card", "on the left").setLayoutHint(new PositionalLayout.PositionalHint(26, 30, 40, 18));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(allNone).addChild(allInput).addChild(allOutput).addChild(label).addChild(stats);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    requestRF();
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) Window(mcjty.lib.gui.Window) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) java.awt(java.awt) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) PacketGetInfoFromServer(mcjty.lib.network.clientinfo.PacketGetInfoFromServer) Label(mcjty.lib.gui.widgets.Label) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label)

Example 40 with PositionalLayout

use of mcjty.lib.gui.layout.PositionalLayout in project RFTools by McJty.

the class GuiModularStorage method setupModePanel.

private Panel setupModePanel() {
    filter = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(3, 3, 57, 13)).setTooltips("Name based filter for items").addTextEvent((parent, newText) -> updateSettings());
    viewMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(4, 19, 16, 16)).setTooltips("Control how items are shown", "in the view").addChoiceEvent((parent, newChoice) -> updateSettings());
    viewMode.addChoice(VIEW_LIST, "Items are shown in a list view", guiElements, 9 * 16, 16);
    viewMode.addChoice(VIEW_COLUMNS, "Items are shown in columns", guiElements, 10 * 16, 16);
    viewMode.addChoice(VIEW_ICONS, "Items are shown with icons", guiElements, 11 * 16, 16);
    updateTypeModule();
    sortMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(23, 19, 16, 16)).setTooltips("Control how items are sorted", "in the view").addChoiceEvent((parent, newChoice) -> updateSettings());
    for (ItemSorter sorter : typeModule.getSorters()) {
        sortMode.addChoice(sorter.getName(), sorter.getTooltip(), guiElements, sorter.getU(), sorter.getV());
    }
    groupMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(42, 19, 16, 16)).setTooltips("If enabled it will show groups", "based on sorting criterium").addChoiceEvent((parent, newChoice) -> updateSettings());
    groupMode.addChoice("Off", "Don't show groups", guiElements, 13 * 16, 0);
    groupMode.addChoice("On", "Show groups", guiElements, 14 * 16, 0);
    amountLabel = new Label(mc, this);
    amountLabel.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    amountLabel.setLayoutHint(new PositionalLayout.PositionalHint(16, 40, 66, 12));
    amountLabel.setTooltips("Amount of stacks / maximum amount");
    amountLabel.setText("?/?");
    compactButton = new Button(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(4, 39, 12, 12)).setText("z").setTooltips("Compact equal stacks").addButtonEvent(parent -> compact());
    if (tileEntity != null) {
        filter.setText(ModularStorageConfiguration.clearSearchOnOpen ? "" : tileEntity.getFilter());
        setViewMode(tileEntity.getViewMode());
        setSortMode(tileEntity.getSortMode());
        groupMode.setCurrentChoice(tileEntity.isGroupMode() ? 1 : 0);
    } else {
        ItemStack heldItem = Minecraft.getMinecraft().player.getHeldItem(EnumHand.MAIN_HAND);
        if (!heldItem.isEmpty() && heldItem.hasTagCompound()) {
            NBTTagCompound tagCompound = heldItem.getTagCompound();
            filter.setText(ModularStorageConfiguration.clearSearchOnOpen ? "" : tagCompound.getString("filter"));
            setViewMode(tagCompound.getString("viewMode"));
            setSortMode(tagCompound.getString("sortMode"));
            groupMode.setCurrentChoice(tagCompound.getBoolean("groupMode") ? 1 : 0);
        }
    }
    return new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(24, ySize - 80, 64, 77)).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground).addChild(filter).addChild(viewMode).addChild(sortMode).addChild(groupMode).addChild(amountLabel).addChild(compactButton);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) Rectangle(java.awt.Rectangle) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Item(net.minecraft.item.Item) CraftingGridProvider(mcjty.rftools.craftinggrid.CraftingGridProvider) EnumHand(net.minecraft.util.EnumHand) Keyboard(org.lwjgl.input.Keyboard) CONTAINER_GRID(mcjty.rftools.blocks.storage.ModularStorageContainer.CONTAINER_GRID) Arguments(mcjty.lib.network.Arguments) ArrayList(java.util.ArrayList) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Block(net.minecraft.block.Block) MutablePair(org.apache.commons.lang3.tuple.MutablePair) Pair(org.apache.commons.lang3.tuple.Pair) DefaultTypeModule(mcjty.rftools.blocks.storage.modules.DefaultTypeModule) Minecraft(net.minecraft.client.Minecraft) Logging(mcjty.lib.varia.Logging) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) RFTools(mcjty.rftools.RFTools) GenericContainer(mcjty.lib.container.GenericContainer) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ScaledResolution(net.minecraft.client.gui.ScaledResolution) GhostOutputSlot(mcjty.lib.container.GhostOutputSlot) StorageModuleItem(mcjty.rftools.items.storage.StorageModuleItem) BlockPos(net.minecraft.util.math.BlockPos) IOException(java.io.IOException) Mouse(org.lwjgl.input.Mouse) Argument(mcjty.lib.network.Argument) List(java.util.List) Type(java.lang.reflect.Type) IInventory(net.minecraft.inventory.IInventory) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) ItemBlock(net.minecraft.item.ItemBlock) CommandHandler(mcjty.rftools.CommandHandler) GuiCraftingGrid(mcjty.rftools.craftinggrid.GuiCraftingGrid) Collections(java.util.Collections) TypeModule(mcjty.rftools.blocks.storage.modules.TypeModule) ItemSorter(mcjty.rftools.blocks.storage.sorters.ItemSorter) Container(net.minecraft.inventory.Container) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ItemSorter(mcjty.rftools.blocks.storage.sorters.ItemSorter) ItemStack(net.minecraft.item.ItemStack)

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