Search in sources :

Example 1 with SelectionEvent

use of mcjty.lib.gui.events.SelectionEvent 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)

Aggregations

java.awt (java.awt)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 StyleConfig (mcjty.lib.base.StyleConfig)1 GenericGuiContainer (mcjty.lib.container.GenericGuiContainer)1 GenericEnergyStorageTileEntity (mcjty.lib.entity.GenericEnergyStorageTileEntity)1 Window (mcjty.lib.gui.Window)1 SelectionEvent (mcjty.lib.gui.events.SelectionEvent)1 HorizontalAlignment (mcjty.lib.gui.layout.HorizontalAlignment)1 PositionalLayout (mcjty.lib.gui.layout.PositionalLayout)1 mcjty.lib.gui.widgets (mcjty.lib.gui.widgets)1 Label (mcjty.lib.gui.widgets.Label)1 Panel (mcjty.lib.gui.widgets.Panel)1 TextField (mcjty.lib.gui.widgets.TextField)1 Argument (mcjty.lib.network.Argument)1 RFToolsDim (mcjty.rftoolsdim.RFToolsDim)1 Settings (mcjty.rftoolsdim.config.Settings)1 DimletKey (mcjty.rftoolsdim.dimensions.dimlets.DimletKey)1 KnownDimletConfiguration (mcjty.rftoolsdim.dimensions.dimlets.KnownDimletConfiguration)1 DimletCraftingTools (mcjty.rftoolsdim.dimensions.dimlets.types.DimletCraftingTools)1