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);
}
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;
}
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);
}
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();
}
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);
}
Aggregations