Search in sources :

Example 6 with PositionalLayout

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

the class GuiEnvironmentalController 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, 141, 10, 76)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    Panel areaPanel = initAreaPanel();
    Panel playersPanel = initPlayerPanel();
    Panel controlPanel = initControlPanel();
    toplevel.addChild(areaPanel).addChild(playersPanel).addChild(controlPanel).addChild(energyBar);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    listDirty = 0;
    requestPlayers();
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 7 with PositionalLayout

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

the class GuiPearlInjector method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    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) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

Example 8 with PositionalLayout

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

the class GuiModularStorage method initGui.

@Override
public void initGui() {
    super.initGui();
    itemList = new WidgetList(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(5, 3, 235, ySize - 89)).setNoSelectionMode(true).setUserObject(new Integer(-1)).setLeftMargin(0).setRowheight(-1);
    Slider slider = new Slider(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(241, 3, 11, ySize - 89)).setDesiredWidth(11).setVertical().setScrollable(itemList);
    Panel modePanel = setupModePanel();
    cycleButton = new Button(mc, this).setText("C").setTooltips("Cycle to the next storage module").setLayoutHint(new PositionalLayout.PositionalHint(5, ySize - 23, 16, 16)).addButtonEvent(parent -> cycleStorage());
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).addChild(itemList).addChild(slider).addChild(modePanel).addChild(cycleButton);
    toplevel.setBackgrounds(iconLocationTop, iconLocation);
    toplevel.setBackgroundLayout(false, ySize - STORAGE_HEIGHT0 + 2);
    if (tileEntity == null) {
        // We must hide three slots.
        ImageLabel hideLabel = new ImageLabel(mc, this);
        hideLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, ySize - 26 - 3 * 18, 20, 55));
        hideLabel.setImage(guiElements, 32, 32);
        toplevel.addChild(hideLabel);
    }
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    if (ModularStorageConfiguration.autofocusSearch) {
        window.setTextFocus(filter);
    }
    CraftingGridProvider provider;
    BlockPos pos = null;
    if (tileEntity != null) {
        provider = tileEntity;
        pos = tileEntity.getPos();
    } else if (inventorySlots instanceof ModularStorageItemContainer) {
        ModularStorageItemContainer storageItemContainer = (ModularStorageItemContainer) inventorySlots;
        provider = storageItemContainer.getCraftingGridProvider();
    } else if (inventorySlots instanceof RemoteStorageItemContainer) {
        RemoteStorageItemContainer storageItemContainer = (RemoteStorageItemContainer) inventorySlots;
        provider = storageItemContainer.getCraftingGridProvider();
    } else {
        throw new RuntimeException("Should not happen!");
    }
    craftingGrid.initGui(modBase, network, mc, this, pos, provider, guiLeft, guiTop, xSize, ySize);
    sendServerCommand(RFTools.MODID, CommandHandler.CMD_REQUEST_GRID_SYNC, Arguments.builder().value(pos).build());
}
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) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) CraftingGridProvider(mcjty.rftools.craftinggrid.CraftingGridProvider) BlockPos(net.minecraft.util.math.BlockPos)

Example 9 with PositionalLayout

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

the class GuiStorageScanner method initGui.

@Override
public void initGui() {
    super.initGui();
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setFilledRectThickness(1).setVertical().setDesiredWidth(10).setDesiredHeight(50).setMaxValue(maxEnergyStored).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    openViewButton = new ToggleButton(mc, this).setCheckMarker(false).setText("V").setTooltips("Toggle wide storage list");
    openViewButton.setPressed(tileEntity.isOpenWideView());
    openViewButton.addButtonEvent(widget -> toggleView());
    upButton = new Button(mc, this).setText("U").setTooltips("Move inventory up").addButtonEvent(widget -> moveUp());
    topButton = new Button(mc, this).setText("T").setTooltips("Move inventory to the top").addButtonEvent(widget -> moveTop());
    downButton = new Button(mc, this).setText("D").setTooltips("Move inventory down").addButtonEvent(widget -> moveDown());
    bottomButton = new Button(mc, this).setText("B").setTooltips("Move inventory to the bottom").addButtonEvent(widget -> moveBottom());
    removeButton = new Button(mc, this).setText("R").setTooltips("Remove inventory from list").addButtonEvent(widget -> removeFromList());
    Panel energyPanel = new Panel(mc, this).setLayout(new VerticalLayout().setVerticalMargin(0).setSpacing(1)).setDesiredWidth(10);
    energyPanel.addChild(openViewButton).addChild(energyBar).addChild(topButton).addChild(upButton).addChild(downButton).addChild(bottomButton).addChild(new Label(mc, this).setText(" ")).addChild(removeButton);
    exportToStarred = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(12, 223, 13, 13)).addChoiceEvent((parent, newChoice) -> changeExportMode());
    exportToStarred.addChoice("No", "Export to current container", guielements, 131, 19);
    exportToStarred.addChoice("Yes", "Export to first routable container", guielements, 115, 19);
    storagePanel = makeStoragePanel(energyPanel);
    itemPanel = makeItemPanel();
    Button scanButton = new Button(mc, this).setText("Scan").setDesiredWidth(50).setDesiredHeight(14).addButtonEvent(parent -> RFToolsMessages.INSTANCE.sendToServer(new PacketGetInfoFromServer(RFTools.MODID, new InventoriesInfoPacketServer(tileEntity.getDimension(), tileEntity.getStorageScannerPos(), true))));
    if (RFTools.instance.xnet) {
        if (StorageScannerConfiguration.xnetRequired) {
            scanButton.setTooltips("Do a scan of all", "storage units connected", "with an active XNet channel");
        } else {
            scanButton.setTooltips("Do a scan of all", "storage units in radius", "Use 'xnet' radius to", "restrict to XNet only");
        }
    } else {
        scanButton.setTooltips("Do a scan of all", "storage units in radius");
    }
    radiusLabel = new ScrollableLabel(mc, this).addValueEvent((parent, newValue) -> changeRadius(newValue)).setRealMinimum(RFTools.instance.xnet ? 0 : 1).setRealMaximum(20);
    radiusLabel.setRealValue(tileEntity.getRadius());
    visibleRadiusLabel = new Label(mc, this);
    visibleRadiusLabel.setDesiredWidth(40);
    searchField = new TextField(mc, this).addTextEvent((parent, newText) -> {
        storageList.clearHilightedRows();
        fromServer_foundInventories.clear();
        startSearch(newText);
    });
    Panel searchPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(8, 142, 256 - 11, 18)).setLayout(new HorizontalLayout()).setDesiredHeight(18).addChild(new Label(mc, this).setText("Search:")).addChild(searchField);
    Slider radiusSlider = new Slider(mc, this).setHorizontal().setTooltips("Radius of scan").setMinimumKnobSize(12).setDesiredHeight(14).setScrollable(radiusLabel);
    Panel scanPanel = new Panel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(8, 162, 74, 54)).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground).setLayout(new VerticalLayout().setVerticalMargin(6).setSpacing(1)).addChild(scanButton);
    if (!(RFTools.instance.xnet && StorageScannerConfiguration.xnetRequired)) {
        scanPanel.addChild(radiusSlider);
    }
    scanPanel.addChild(visibleRadiusLabel);
    if (tileEntity.isDummy()) {
        scanButton.setEnabled(false);
        radiusLabel.setVisible(false);
        radiusSlider.setVisible(false);
    }
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(storagePanel).addChild(itemPanel).addChild(searchPanel).addChild(scanPanel).addChild(exportToStarred);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    fromServer_foundInventories.clear();
    fromServer_inventory.clear();
    if (tileEntity.isDummy()) {
        fromServer_inventories.clear();
    } else {
        tileEntity.requestRfFromServer(RFTools.MODID);
    }
    BlockPos pos = tileEntity.getCraftingGridContainerPos();
    craftingGrid.initGui(modBase, network, mc, this, pos, tileEntity.getCraftingGridProvider(), guiLeft, guiTop, xSize, ySize);
    sendServerCommand(RFTools.MODID, CommandHandler.CMD_REQUEST_GRID_SYNC, Arguments.builder().value(pos).build());
    if (StorageScannerConfiguration.hilightStarredOnGuiOpen) {
        storageList.setSelected(0);
    }
    init = true;
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) BlockRenderEvent(mcjty.lib.gui.events.BlockRenderEvent) TextField(mcjty.lib.gui.widgets.TextField) java.util(java.util) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Keyboard(org.lwjgl.input.Keyboard) Label(mcjty.lib.gui.widgets.Label) Arguments(mcjty.lib.network.Arguments) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) BlockPosTools(mcjty.lib.varia.BlockPosTools) ItemStack(net.minecraft.item.ItemStack) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) Panel(mcjty.lib.gui.widgets.Panel) MutablePair(org.apache.commons.lang3.tuple.MutablePair) Pair(org.apache.commons.lang3.tuple.Pair) Logging(mcjty.lib.varia.Logging) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) PacketGetInfoFromServer(mcjty.lib.network.clientinfo.PacketGetInfoFromServer) RFTools(mcjty.rftools.RFTools) Predicate(java.util.function.Predicate) GhostOutputSlot(mcjty.lib.container.GhostOutputSlot) TextFormatting(net.minecraft.util.text.TextFormatting) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) BlockPos(net.minecraft.util.math.BlockPos) IOException(java.io.IOException) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) Mouse(org.lwjgl.input.Mouse) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) Button(mcjty.lib.gui.widgets.Button) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) CommandHandler(mcjty.rftools.CommandHandler) GuiCraftingGrid(mcjty.rftools.craftinggrid.GuiCraftingGrid) Window(mcjty.lib.gui.Window) Label(mcjty.lib.gui.widgets.Label) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) PacketGetInfoFromServer(mcjty.lib.network.clientinfo.PacketGetInfoFromServer) Button(mcjty.lib.gui.widgets.Button) VerticalLayout(mcjty.lib.gui.layout.VerticalLayout) TextField(mcjty.lib.gui.widgets.TextField) BlockPos(net.minecraft.util.math.BlockPos)

Example 10 with PositionalLayout

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

the class GuiLevelEmitter method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    amountField = new mcjty.lib.gui.widgets.TextField(mc, this).setTooltips("Set the amount of items in slot").setLayoutHint(new PositionalLayout.PositionalHint(60, 3, 80, 14)).addTextEvent((parent, newText) -> setAmount());
    int amount = tileEntity.getAmount();
    amountField.setText(String.valueOf(amount));
    starredLabel = new ChoiceLabel(mc, this).addChoices(NOTSTARRED, STARRED).addChoiceEvent((parent, newChoice) -> setMetaUsage()).setChoiceTooltip(NOTSTARRED, "All inventories are considered").setChoiceTooltip(STARRED, "Only routable inventories are considered");
    starredLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 19, 80, 14));
    starredLabel.setChoice(tileEntity.isStarred() ? STARRED : NOTSTARRED);
    oreDictLabel = new ChoiceLabel(mc, this).addChoices(OREDICT_IGNORE, OREDICT_USE).addChoiceEvent((parent, newChoice) -> setOredictUsage()).setChoiceTooltip(OREDICT_IGNORE, "Ingore ore dictionary").setChoiceTooltip(OREDICT_USE, "Use ore dictionary matching");
    oreDictLabel.setLayoutHint(new PositionalLayout.PositionalHint(60, 35, 80, 14));
    oreDictLabel.setChoice(tileEntity.isOreDict() ? OREDICT_USE : OREDICT_IGNORE);
    toplevel.addChild(new Label(mc, this).setText("Amount:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 3, 50, 14))).addChild(amountField).addChild(new Label(mc, this).setText("Routable:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 19, 50, 14))).addChild(starredLabel).addChild(new Label(mc, this).setText("Oredict:").setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setLayoutHint(new PositionalLayout.PositionalHint(10, 35, 50, 14))).addChild(oreDictLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) Window(mcjty.lib.gui.Window) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) java.awt(java.awt) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) Label(mcjty.lib.gui.widgets.Label) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) Panel(mcjty.lib.gui.widgets.Panel) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ChoiceLabel(mcjty.lib.gui.widgets.ChoiceLabel) 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