Search in sources :

Example 26 with PositionalLayout

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

the class GuiScanner method initGui.

@Override
public void initGui() {
    super.initGui();
    getShapeRenderer().initView(getPreviewLeft(), guiTop + 100);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int maxEnergyStored = tileEntity.getMaxEnergyStored();
    energyBar = new EnergyBar(mc, this).setHorizontal().setMaxValue(maxEnergyStored).setLayoutHint(new PositionalLayout.PositionalHint(8, 120, 70, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    initRedstoneMode();
    toplevel.addChild(redstoneMode);
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 176);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 176);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 176);
    scanButton = new Button(mc, this).setText("Scan").addButtonEvent(parent -> scan()).setLayoutHint(new PositionalLayout.PositionalHint(5, 156, 40, 16));
    toplevel.addChild(scanButton);
    toplevel.addChild(new Button(mc, this).setText("W").addButtonEvent(parent -> move(-16, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(4, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("w").addButtonEvent(parent -> move(-1, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(20, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("e").addButtonEvent(parent -> move(1, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(45, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("E").addButtonEvent(parent -> move(16, 0, 0)).setLayoutHint(new PositionalLayout.PositionalHint(61, 30, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("S").addButtonEvent(parent -> move(0, 0, -16)).setLayoutHint(new PositionalLayout.PositionalHint(4, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("s").addButtonEvent(parent -> move(0, 0, -1)).setLayoutHint(new PositionalLayout.PositionalHint(20, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("n").addButtonEvent(parent -> move(0, 0, 1)).setLayoutHint(new PositionalLayout.PositionalHint(45, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("N").addButtonEvent(parent -> move(0, 0, 16)).setLayoutHint(new PositionalLayout.PositionalHint(61, 50, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("D").addButtonEvent(parent -> move(0, -16, 0)).setLayoutHint(new PositionalLayout.PositionalHint(4, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("d").addButtonEvent(parent -> move(0, -1, 0)).setLayoutHint(new PositionalLayout.PositionalHint(20, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("u").addButtonEvent(parent -> move(0, 1, 0)).setLayoutHint(new PositionalLayout.PositionalHint(45, 70, 16, 15)));
    toplevel.addChild(new Button(mc, this).setText("U").addButtonEvent(parent -> move(0, 16, 0)).setLayoutHint(new PositionalLayout.PositionalHint(61, 70, 16, 15)));
    offsetLabel = new Label(mc, this).setText("Off: " + BlockPosTools.toString(tileEntity.getDataOffset())).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    offsetLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 90, 80, 14));
    toplevel.addChild(offsetLabel);
    dimensionLabel = new Label(mc, this).setText("Dim: " + BlockPosTools.toString(tileEntity.getDataDim())).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    dimensionLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 105, 80, 14));
    toplevel.addChild(dimensionLabel);
    progressLabel = new Label(mc, this).setText("");
    progressLabel.setLayoutHint(new PositionalLayout.PositionalHint(4, 135, 80, 14));
    toplevel.addChild(progressLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    move(0, 0, 0);
    filterCnt = countFilters();
    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 27 with PositionalLayout

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

the class GuiSecurityManager method initGui.

@Override
public void initGui() {
    super.initGui();
    players = new WidgetList(mc, this);
    Slider allowedPlayerSlider = new Slider(mc, this).setDesiredWidth(10).setVertical().setScrollable(players);
    Panel allowedPlayersPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(players).addChild(allowedPlayerSlider).setLayoutHint(new PositionalLayout.PositionalHint(72, 5, SECURITYMANAGER_WIDTH - 76, 96));
    nameField = new TextField(mc, this).setDesiredHeight(15);
    addButton = new Button(mc, this).setText("Add").setDesiredHeight(14).setDesiredWidth(34).setTooltips("Add a player to the access list").addButtonEvent(parent -> addPlayer());
    delButton = new Button(mc, this).setText("Del").setDesiredHeight(14).setDesiredWidth(34).setTooltips("Remove the selected player", "from the access list").addButtonEvent(parent -> delPlayer());
    Panel buttonPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setHorizontalMargin(3).setSpacing(1)).addChild(nameField).addChild(addButton).addChild(delButton).setDesiredHeight(16).setLayoutHint(new PositionalLayout.PositionalHint(72, 100, SECURITYMANAGER_WIDTH - 76, 14));
    channelNameField = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(8, 27, 60, 14)).addTextEvent((parent, newText) -> updateChannelName());
    blacklistMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(10, 44, 16, 16)).setTooltips("Black or whitelist mode").addChoiceEvent((parent, newChoice) -> updateSettings());
    blacklistMode.addChoice("White", "Whitelist players", guiElements, 15 * 16, 32);
    blacklistMode.addChoice("Black", "Blacklist players", guiElements, 14 * 16, 32);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(allowedPlayersPanel).addChild(buttonPanel).addChild(channelNameField).addChild(blacklistMode);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    Keyboard.enableRepeatEvents(true);
    channelFromServer = null;
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Rectangle(java.awt.Rectangle) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Keyboard(org.lwjgl.input.Keyboard) Arguments(mcjty.lib.network.Arguments) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Slot(net.minecraft.inventory.Slot) ResourceLocation(net.minecraft.util.ResourceLocation) CommandHandler(mcjty.rftools.CommandHandler) RFTools(mcjty.rftools.RFTools) Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout)

Example 28 with PositionalLayout

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

the class GuiModifier method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setLayout(new PositionalLayout()).setBackground(iconLocation);
    mode = new ChoiceLabel(mc, this).addChoices(ModifierFilterType.FILTER_SLOT.getCode(), ModifierFilterType.FILTER_ORE.getCode(), ModifierFilterType.FILTER_LIQUID.getCode(), ModifierFilterType.FILTER_TILEENTITY.getCode());
    mode.setLayoutHint(new PositionalLayout.PositionalHint(30, 9, 45, 14));
    toplevel.addChild(mode);
    op = new ChoiceLabel(mc, this).addChoices(ModifierFilterOperation.OPERATION_SLOT.getCode(), ModifierFilterOperation.OPERATION_VOID.getCode());
    op.setLayoutHint(new PositionalLayout.PositionalHint(110, 9, 40, 14));
    toplevel.addChild(op);
    add = new Button(mc, this).setText("Add");
    add.setLayoutHint(new PositionalLayout.PositionalHint(10, 30, 40, 13));
    add.addButtonEvent(parent -> addOp());
    toplevel.addChild(add);
    del = new Button(mc, this).setText("Del");
    del.setLayoutHint(new PositionalLayout.PositionalHint(52, 30, 40, 13));
    del.addButtonEvent(parent -> delOp());
    toplevel.addChild(del);
    up = new Button(mc, this).setText("Up");
    up.setLayoutHint(new PositionalLayout.PositionalHint(110, 30, 30, 13));
    up.addButtonEvent(parent -> upOp());
    toplevel.addChild(up);
    down = new Button(mc, this).setText("Down");
    down.setLayoutHint(new PositionalLayout.PositionalHint(142, 30, 30, 13));
    down.addButtonEvent(parent -> downOp());
    toplevel.addChild(down);
    list = new WidgetList(mc, this);
    list.setLayoutHint(new PositionalLayout.PositionalHint(9, 45, 153, 95));
    toplevel.addChild(list);
    Slider slider = new Slider(mc, this).setVertical().setScrollable(list);
    slider.setLayoutHint(new PositionalLayout.PositionalHint(162, 45, 10, 95));
    toplevel.addChild(slider);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 29 with PositionalLayout

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

the class GuiBuilder 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, 6, 8, 59)).setShowText(false);
    energyBar.setValue(getCurrentRF());
    initRedstoneMode();
    configButton = new Button(mc, this).setText("?");
    configButton.setLayoutHint(new PositionalLayout.PositionalHint(83, 12, 13, 12));
    configButton.addButtonEvent(parent -> openCardGui());
    configButton.setTooltips("Click to open the card gui");
    currentLevel = new Button(mc, this);
    currentLevel.setText("Y:").setTooltips("Current level the builder is at", TextFormatting.YELLOW + "Press to restart!").setLayoutHint(new PositionalLayout.PositionalHint(81, 31, 45, 13)).addButtonEvent(parent -> restart());
    Panel positionPanel = setupPositionPanel();
    Panel modePanel = setupModePanel();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(modePanel).addChild(positionPanel).addChild(configButton).addChild(currentLevel).addChild(redstoneMode);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
    tileEntity.requestCurrentLevel();
}
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)

Example 30 with PositionalLayout

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

the class GuiBuilder method setupModePanel.

private Panel setupModePanel() {
    modeChoice = new ChoiceLabel(mc, this).addChoices(MODES[MODE_COPY], MODES[MODE_MOVE], MODES[MODE_SWAP], MODES[MODE_BACK], MODES[MODE_COLLECT]).setTooltips("Set the building mode").setLayoutHint(new PositionalLayout.PositionalHint(9, 4, 42, 14)).setChoiceTooltip(MODES[MODE_COPY], "Copy from space chamber to here", "Chest on top or below with materials").setChoiceTooltip(MODES[MODE_MOVE], "Move from space chamber to here").setChoiceTooltip(MODES[MODE_SWAP], "Swap space chamber contents with here").setChoiceTooltip(MODES[MODE_BACK], "Move back from here to space chamber").setChoiceTooltip(MODES[MODE_COLLECT], "Collect items in space chamber", "Items will go to chest on top or below").addChoiceEvent((parent, newChoice) -> updateMode());
    modeChoice.setChoice(MODES[tileEntity.getMode()]);
    silentMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(4, 18, 17, 17)).setWithBorder(true).setHighlightedChoice(1).setTooltips("Suppress the placement/breaking sound", "when moving blocks").addChoiceEvent((parent, newChoice) -> setSilentMode());
    silentMode.addChoice("off", "Moving blocks make sound", guiElements, 11 * 16, 3 * 16);
    silentMode.addChoice("on", "Block sounds are muted", guiElements, 10 * 16, 3 * 16);
    silentMode.setCurrentChoice(tileEntity.isSilent() ? 1 : 0);
    supportMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(22, 18, 17, 17)).setWithBorder(true).setHighlightedChoice(1).setTooltips("Use supporting blocks when moving.", "Useful for liquids, gravel, ...").addChoiceEvent((parent, newChoice) -> setSupportMode());
    supportMode.addChoice("off", "Support/preview mode disabled", guiElements, 7 * 16, 3 * 16);
    supportMode.addChoice("on", "Support/preview mode enabled", guiElements, 6 * 16, 3 * 16);
    supportMode.setCurrentChoice(tileEntity.hasSupportMode() ? 1 : 0);
    entityMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(4, 37, 17, 17)).setWithBorder(true).setHighlightedChoice(1).setTooltips("Move entities").addChoiceEvent((parent, newChoice) -> setEntityMode());
    entityMode.addChoice("off", "Entities are not moved", guiElements, 9 * 16, 3 * 16);
    entityMode.addChoice("on", "Entities are moved", guiElements, 8 * 16, 3 * 16);
    entityMode.setCurrentChoice(tileEntity.hasEntityMode() ? 1 : 0);
    loopMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(22, 37, 17, 17)).setWithBorder(true).setHighlightedChoice(1).setTooltips("Loop mode").addChoiceEvent((parent, newChoice) -> setLoopMode());
    loopMode.addChoice("off", "Do a single run and stop", guiElements, 13 * 16, 3 * 16);
    loopMode.addChoice("on", "Keep running with redstone signal", guiElements, 12 * 16, 3 * 16);
    loopMode.setCurrentChoice(tileEntity.hasLoopMode() ? 1 : 0);
    waitMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(40, 18, 17, 17)).setWithBorder(true).setHighlightedChoice(1).setTooltips("Wait mode").addChoiceEvent((parent, newChoice) -> setWaitMode());
    waitMode.addChoice("off", "Don't wait on a position if\nthe operation is not possible", guiElements, 7 * 16, 5 * 16);
    waitMode.addChoice("on", "If the operation is not possible\nwait on the current position", guiElements, 6 * 16, 5 * 16);
    waitMode.setCurrentChoice(tileEntity.isWaitMode() ? 1 : 0);
    hilightMode = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(40, 37, 17, 17)).setWithBorder(true).setHighlightedChoice(1).setTooltips("Hilight mode").addChoiceEvent((parent, newChoice) -> setHilightMode());
    hilightMode.addChoice("off", "No hilighting", guiElements, 9 * 16, 5 * 16);
    hilightMode.addChoice("on", "Visually hilight the position\nthe Builder is working on", guiElements, 8 * 16, 5 * 16);
    hilightMode.setCurrentChoice(tileEntity.isHilightMode() ? 1 : 0);
    return new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(19, 6, 61, 59)).addChild(modeChoice).addChild(silentMode).addChild(supportMode).addChild(entityMode).addChild(loopMode).addChild(waitMode).addChild(hilightMode).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) TextFormatting(net.minecraft.util.text.TextFormatting) RedstoneMode(mcjty.lib.varia.RedstoneMode) GuiShapeCard(mcjty.rftools.items.builder.GuiShapeCard) StyleConfig(mcjty.lib.base.StyleConfig) Window(mcjty.lib.gui.Window) java.awt(java.awt) ItemStack(net.minecraft.item.ItemStack) Argument(mcjty.lib.network.Argument) Panel(mcjty.lib.gui.widgets.Panel) Minecraft(net.minecraft.client.Minecraft) BuilderTileEntity(mcjty.rftools.blocks.builder.BuilderTileEntity) Button(mcjty.lib.gui.widgets.Button) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) RFTools(mcjty.rftools.RFTools) Panel(mcjty.lib.gui.widgets.Panel) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout)

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