Search in sources :

Example 56 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiMachineInfuser 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());
    // arrow = new ImageLabel(mc, this).setImage(iconGuiElements, 192, 0);
    // arrow.setLayoutHint(new PositionalLayout.PositionalHint(90, 26, 16, 16));
    // .addChild(arrow);
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
// tileEntity.requestResearchingFromServer();
}
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 57 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiItemFilter method initGui.

@Override
public void initGui() {
    super.initGui();
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout());
    int[] inputMode = tileEntity.getInputMode();
    int[] outputMode = tileEntity.getOutputMode();
    for (EnumFacing direction : EnumFacing.VALUES) {
        final int side = direction.ordinal();
        for (int slot = 0; slot < ItemFilterContainer.BUFFER_SIZE; slot++) {
            ImageChoiceLabel choiceLabel = new ImageChoiceLabel(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(25 + slot * 18, 4 + side * 13, 12, 12)).addChoice("0", "Disabled", iconGuiElements, 160, 0).addChoice("1", "Input", iconGuiElements, 96, 16).addChoice("2", "Output", iconGuiElements, 80, 16);
            bits[side * ItemFilterContainer.BUFFER_SIZE + slot] = choiceLabel;
            if ((inputMode[side] & (1 << slot)) != 0) {
                choiceLabel.setCurrentChoice(1);
            } else if ((outputMode[side] & (1 << slot)) != 0) {
                choiceLabel.setCurrentChoice(2);
            } else {
                choiceLabel.setCurrentChoice(0);
            }
            final int finalSlot = slot;
            choiceLabel.addChoiceEvent((parent, newChoice) -> changeMode(side, finalSlot));
            toplevel.addChild(choiceLabel);
        }
    }
    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) EnumFacing(net.minecraft.util.EnumFacing) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) ImageChoiceLabel(mcjty.lib.gui.widgets.ImageChoiceLabel)

Example 58 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiLocator method initGui.

@Override
public void initGui() {
    super.initGui();
    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(28, 10, 70, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    initRedstoneMode();
    toplevel.addChild(redstoneMode);
    hostile = new ColorChoiceLabel(mc, this);
    hostileBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, hostile, hostileBeacon, 30, "Hostile");
    hostile.setCurrentColor(tileEntity.getHostileType().getColor());
    hostileBeacon.setPressed(tileEntity.isHostileBeacon());
    passive = new ColorChoiceLabel(mc, this);
    passiveBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, passive, passiveBeacon, 46, "Passive");
    passive.setCurrentColor(tileEntity.getPassiveType().getColor());
    passiveBeacon.setPressed(tileEntity.isPassiveBeacon());
    player = new ColorChoiceLabel(mc, this);
    playerBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, player, playerBeacon, 62, "Player");
    player.setCurrentColor(tileEntity.getPlayerType().getColor());
    playerBeacon.setPressed(tileEntity.isPlayerBeacon());
    toplevel.addChild(new Label<>(mc, this).setText("Filter").setLayoutHint(new PositionalLayout.PositionalHint(8, 82, 40, 14)));
    filter = new TextField(mc, this);
    filter.setLayoutHint(new PositionalLayout.PositionalHint(50, 82, 90, 14));
    filter.setText(tileEntity.getFilter());
    filter.addTextEvent((parent, newText) -> update());
    toplevel.addChild(filter);
    energy = new ColorChoiceLabel(mc, this);
    energyBeacon = new ToggleButton(mc, this);
    addBeaconSetting(toplevel, energy, energyBeacon, 98, "Energy");
    energy.setCurrentColor(tileEntity.getEnergyType().getColor());
    energyBeacon.setPressed(tileEntity.isEnergyBeacon());
    toplevel.addChild(new Label<>(mc, this).setText("<").setLayoutHint(new PositionalLayout.PositionalHint(153, 98, 10, 14)));
    minEnergy = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(162, 98, 25, 14));
    minEnergy.setText(tileEntity.getMinEnergy() == null ? "" : Integer.toString(tileEntity.getMinEnergy()));
    minEnergy.addTextEvent((parent, newText) -> update());
    toplevel.addChild(new Label<>(mc, this).setText("%").setLayoutHint(new PositionalLayout.PositionalHint(187, 98, 10, 14)));
    toplevel.addChild(minEnergy);
    toplevel.addChild(new Label<>(mc, this).setText(">").setLayoutHint(new PositionalLayout.PositionalHint(205, 98, 10, 14)));
    maxEnergy = new TextField(mc, this).setLayoutHint(new PositionalLayout.PositionalHint(214, 98, 25, 14));
    maxEnergy.setText(tileEntity.getMaxEnergy() == null ? "" : Integer.toString(tileEntity.getMaxEnergy()));
    maxEnergy.addTextEvent((parent, newText) -> update());
    toplevel.addChild(maxEnergy);
    toplevel.addChild(new Label<>(mc, this).setText("%").setLayoutHint(new PositionalLayout.PositionalHint(238, 98, 10, 14)));
    toplevel.addChild(new Label<>(mc, this).setColor(0x993300).setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT).setText("RF per scan (every " + ScannerConfiguration.ticksPerLocatorScan + " ticks):").setLayoutHint(new PositionalLayout.PositionalHint(8, 186, 156, 14)));
    energyLabel = new Label(mc, this).setText("");
    energyLabel.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    energyLabel.setLayoutHint(new PositionalLayout.PositionalHint(8, 200, 156, 14));
    toplevel.addChild(energyLabel);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
    energyConsumption = 0;
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 59 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiProjector 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(6, 184, 75, 10)).setShowText(false);
    energyBar.setValue(GenericEnergyStorageTileEntity.getCurrentRF());
    toplevel.addChild(energyBar);
    Label angleI = new Label(mc, this).setText("Angle");
    angleI.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    angleI.setLayoutHint(new PositionalLayout.PositionalHint(16, 30, 32, 15));
    angleLabel = new ScrollableLabel(mc, this).setRealMinimum(0).setRealMaximum(360).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(44, 30, 24, 15));
    angleLabel.setRealValue(tileEntity.getAngleInt());
    Button angleM = new Button(mc, this).setText("-").setLayoutHint(new PositionalLayout.PositionalHint(5, 30, 10, 15)).addButtonEvent(parent -> min(angleLabel));
    Button angleP = new Button(mc, this).setText("+").setLayoutHint(new PositionalLayout.PositionalHint(70, 30, 10, 15)).addButtonEvent(parent -> plus(angleLabel));
    angleSlider = new Slider(mc, this).setHorizontal().setScrollable(angleLabel).setLayoutHint(new PositionalLayout.PositionalHint(5, 46, 76, 15));
    toplevel.addChild(angleI).addChild(angleLabel).addChild(angleSlider).addChild(angleM).addChild(angleP);
    Label scaleI = new Label(mc, this).setText("Scale");
    scaleI.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    scaleI.setLayoutHint(new PositionalLayout.PositionalHint(16, 62, 32, 15));
    scaleLabel = new ScrollableLabel(mc, this).setRealMinimum(0).setRealMaximum(100).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(44, 62, 24, 15));
    scaleLabel.setRealValue(tileEntity.getScaleInt());
    Button scaleM = new Button(mc, this).setText("-").setLayoutHint(new PositionalLayout.PositionalHint(5, 62, 10, 15)).addButtonEvent(parent -> min(scaleLabel));
    Button scaleP = new Button(mc, this).setText("+").setLayoutHint(new PositionalLayout.PositionalHint(70, 62, 10, 15)).addButtonEvent(parent -> plus(scaleLabel));
    scaleSlider = new Slider(mc, this).setHorizontal().setScrollable(scaleLabel).setLayoutHint(new PositionalLayout.PositionalHint(5, 78, 76, 15));
    toplevel.addChild(scaleI).addChild(scaleLabel).addChild(scaleSlider).addChild(scaleM).addChild(scaleP);
    Label offsetI = new Label(mc, this).setText("Offset");
    offsetI.setHorizontalAlignment(HorizontalAlignment.ALIGH_LEFT);
    offsetI.setLayoutHint(new PositionalLayout.PositionalHint(16, 94, 32, 15));
    offsetLabel = new ScrollableLabel(mc, this).setRealMinimum(0).setRealMaximum(100).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setLayoutHint(new PositionalLayout.PositionalHint(44, 94, 24, 15));
    offsetLabel.setRealValue(tileEntity.getOffsetInt());
    Button offsetM = new Button(mc, this).setText("-").setLayoutHint(new PositionalLayout.PositionalHint(5, 94, 10, 15)).addButtonEvent(parent -> min(offsetLabel));
    Button offsetP = new Button(mc, this).setText("+").setLayoutHint(new PositionalLayout.PositionalHint(70, 94, 10, 15)).addButtonEvent(parent -> plus(offsetLabel));
    offsetSlider = new Slider(mc, this).setHorizontal().setScrollable(offsetLabel).setLayoutHint(new PositionalLayout.PositionalHint(5, 110, 76, 15));
    toplevel.addChild(offsetI).addChild(offsetLabel).addChild(offsetSlider).addChild(offsetM).addChild(offsetP);
    autoRotate = new ToggleButton(mc, this).setCheckMarker(true).setText("Auto").setTooltips("Automatic client-side rotation").setLayoutHint(new PositionalLayout.PositionalHint(2, 128, 39, 16));
    autoRotate.setPressed(tileEntity.isAutoRotate());
    toplevel.addChild(autoRotate);
    scanline = new ToggleButton(mc, this).setCheckMarker(true).setText("SL").setTooltips("Enable/disable visual scanlines when", "the scan is refreshed").setLayoutHint(new PositionalLayout.PositionalHint(42, 128, 39, 16));
    scanline.setPressed(tileEntity.isScanline());
    toplevel.addChild(scanline);
    sound = new ToggleButton(mc, this).setCheckMarker(true).setText("Snd").setTooltips("Enable/disable sound during", "visual scan").setLayoutHint(new PositionalLayout.PositionalHint(2, 146, 39, 16));
    sound.setPressed(tileEntity.isSound());
    toplevel.addChild(sound);
    grayScale = new ToggleButton(mc, this).setCheckMarker(true).setText("Gray").setTooltips("Enable/disable grayscale", "mode").setLayoutHint(new PositionalLayout.PositionalHint(42, 146, 39, 16));
    grayScale.setPressed(tileEntity.isGrayscale());
    toplevel.addChild(grayScale);
    angleLabel.addValueEvent((parent, newValue) -> update());
    scaleLabel.addValueEvent((parent, newValue) -> update());
    offsetLabel.addValueEvent((parent, newValue) -> update());
    autoRotate.addButtonEvent(parent -> update());
    scanline.addButtonEvent(parent -> update());
    sound.addButtonEvent(parent -> update());
    grayScale.addButtonEvent(parent -> update());
    showAxis = ShapeGuiTools.createAxisButton(this, toplevel, 5, 200);
    showOuter = ShapeGuiTools.createBoxButton(this, toplevel, 31, 200);
    showScan = ShapeGuiTools.createScanButton(this, toplevel, 57, 200);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    initSidePanel();
    window = new Window(this, toplevel);
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : Window(mcjty.lib.gui.Window) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Rectangle(java.awt.Rectangle)

Example 60 with Window

use of mcjty.lib.gui.Window in project RFTools by McJty.

the class GuiShield 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());
    initVisibilityMode();
    initActionOptions();
    initTypeOptions();
    initRedstoneMode();
    initDamageType();
    filterList = new WidgetList(mc, this).setDesiredHeight(120).addSelectionEvent(new DefaultSelectionEvent() {

        @Override
        public void select(Widget parent, int index) {
            selectFilter();
        }
    });
    Slider filterSlider = new Slider(mc, this).setVertical().setScrollable(filterList).setDesiredWidth(11).setDesiredHeight(120);
    Panel filterPanel = new Panel(mc, this).setLayout(new HorizontalLayout().setSpacing(1).setHorizontalMargin(3)).setLayoutHint(new PositionalLayout.PositionalHint(12, 10, 154, 124)).addChild(filterList).addChild(filterSlider).setFilledBackground(0xff9e9e9e);
    Button applyCamo = new Button(mc, this).setText("Set").setTooltips("Set the camouflage block").setLayoutHint(new PositionalLayout.PositionalHint(51, 142, 28, 16)).addButtonEvent(parent -> applyCamoToShield());
    // applyCamo.setEnabled(false);
    // applyCamo.setTooltips("Not implemented yet");   // @todo
    colorSelector = new ColorChoiceLabel(mc, this).setTooltips("Color for the shield").setLayoutHint(new PositionalLayout.PositionalHint(31, 177, 48, 16));
    colorSelector.addColors(0x96ffc8);
    for (EnumDyeColor color : EnumDyeColor.values()) {
        colorSelector.addColors(color.getColorValue());
    }
    colorSelector.setCurrentColor(tileEntity.getShieldColor());
    colorSelector.addChoiceEvent((parent, newColor) -> sendServerCommand(RFToolsMessages.INSTANCE, ShieldTEBase.CMD_SETCOLOR, new Argument("color", newColor)));
    player = new TextField(mc, this).setTooltips("Optional player name").setLayoutHint(new PositionalLayout.PositionalHint(170, 44, 80, 14));
    addFilter = new Button(mc, this).setText("Add").setTooltips("Add selected filter").setLayoutHint(new PositionalLayout.PositionalHint(4, 6, 36, 14)).addButtonEvent(parent -> addNewFilter());
    delFilter = new Button(mc, this).setText("Del").setTooltips("Delete selected filter").setLayoutHint(new PositionalLayout.PositionalHint(39, 6, 36, 14)).addButtonEvent(parent -> removeSelectedFilter());
    upFilter = new Button(mc, this).setText("Up").setTooltips("Move filter up").setLayoutHint(new PositionalLayout.PositionalHint(4, 22, 36, 14)).addButtonEvent(parent -> moveFilterUp());
    downFilter = new Button(mc, this).setText("Down").setTooltips("Move filter down").setLayoutHint(new PositionalLayout.PositionalHint(39, 22, 36, 14)).addButtonEvent(parent -> moveFilterDown());
    Panel controlPanel = new Panel(mc, this).setLayout(new PositionalLayout()).setLayoutHint(new PositionalLayout.PositionalHint(170, 58, 80, 43)).addChild(addFilter).addChild(delFilter).addChild(upFilter).addChild(downFilter).setFilledRectThickness(-2).setFilledBackground(StyleConfig.colorListBackground);
    Label lootingBonus = new Label(mc, this).setHorizontalAlignment(HorizontalAlignment.ALIGN_RIGHT).setText("Looting:");
    lootingBonus.setTooltips("Insert dimensional shards", "for looting bonus").setLayoutHint(new PositionalLayout.PositionalHint(160, 118, 60, 18));
    Panel toplevel = new Panel(mc, this).setBackground(iconLocation).setLayout(new PositionalLayout()).addChild(energyBar).addChild(visibilityOptions).addChild(applyCamo).addChild(redstoneMode).addChild(filterPanel).addChild(actionOptions).addChild(typeOptions).addChild(player).addChild(controlPanel).addChild(damageType).addChild(colorSelector).addChild(lootingBonus);
    toplevel.setBounds(new Rectangle(guiLeft, guiTop, xSize, ySize));
    window = new Window(this, toplevel);
    listDirty = 0;
    requestFilters();
    tileEntity.requestRfFromServer(RFTools.MODID);
}
Also used : GenericGuiContainer(mcjty.lib.container.GenericGuiContainer) RFToolsMessages(mcjty.rftools.network.RFToolsMessages) TextField(mcjty.lib.gui.widgets.TextField) mcjty.lib.gui.widgets(mcjty.lib.gui.widgets) HorizontalAlignment(mcjty.lib.gui.layout.HorizontalAlignment) Label(mcjty.lib.gui.widgets.Label) 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) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent) mcjty.rftools.blocks.shield.filters(mcjty.rftools.blocks.shield.filters) Panel(mcjty.lib.gui.widgets.Panel) Block(net.minecraft.block.Block) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) RFTools(mcjty.rftools.RFTools) GenericEnergyStorageTileEntity(mcjty.lib.entity.GenericEnergyStorageTileEntity) RedstoneMode(mcjty.lib.varia.RedstoneMode) java.awt(java.awt) Argument(mcjty.lib.network.Argument) List(java.util.List) EnumDyeColor(net.minecraft.item.EnumDyeColor) Button(mcjty.lib.gui.widgets.Button) ResourceLocation(net.minecraft.util.ResourceLocation) Window(mcjty.lib.gui.Window) Argument(mcjty.lib.network.Argument) PositionalLayout(mcjty.lib.gui.layout.PositionalLayout) Label(mcjty.lib.gui.widgets.Label) EnumDyeColor(net.minecraft.item.EnumDyeColor) HorizontalLayout(mcjty.lib.gui.layout.HorizontalLayout) Panel(mcjty.lib.gui.widgets.Panel) Button(mcjty.lib.gui.widgets.Button) TextField(mcjty.lib.gui.widgets.TextField) DefaultSelectionEvent(mcjty.lib.gui.events.DefaultSelectionEvent)

Aggregations

Window (mcjty.lib.gui.Window)74 Panel (mcjty.lib.gui.widgets.Panel)57 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)48 Label (mcjty.lib.gui.widgets.Label)36 VerticalLayout (mcjty.lib.gui.layout.VerticalLayout)29 HorizontalLayout (mcjty.lib.gui.layout.HorizontalLayout)28 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)24 Argument (mcjty.lib.network.Argument)24 RFToolsMessages (mcjty.rftools.network.RFToolsMessages)23 java.awt (java.awt)22 Button (mcjty.lib.gui.widgets.Button)22 RFTools (mcjty.rftools.RFTools)22 TextField (mcjty.lib.gui.widgets.TextField)21 Rectangle (java.awt.Rectangle)20 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)20 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)18 ResourceLocation (net.minecraft.util.ResourceLocation)17 StyleConfig (mcjty.lib.base.StyleConfig)15 List (java.util.List)12 EmptyContainer (mcjty.lib.container.EmptyContainer)11