Search in sources :

Example 1 with WidgetTab

use of uk.co.qmunity.lib.client.gui.widget.WidgetTab in project BluePower by Qmunity.

the class GuiCircuitDatabaseMain method initGui.

@Override
public void initGui() {
    super.initGui();
    WidgetTab widget = new WidgetTab(1, guiLeft - 32, guiTop + 10, 33, 35, 198, 3, Refs.MODID + ":textures/gui/circuit_database.png") {

        @Override
        protected void addTooltip(int curHoveredTab, List<String> curTip, boolean shiftPressed) {
            switch(curHoveredTab) {
                case 0:
                    curTip.add("gui.bluepower:circuitDatabase.tab.copyAndShare");
                    break;
                case 1:
                    curTip.add("gui.bluepower:circuitDatabase.tab.private");
                    break;
                case 2:
                    curTip.add("gui.bluepower:circuitDatabase.tab.server");
                    if (Minecraft.getMinecraft().isSingleplayer())
                        curTip.add("gui.bluepower:circuitDatabase.info.serverOnly");
                    break;
            }
        }
    };
    widget.value = circuitDatabase.clientCurrentTab;
    widget.enabledTabs[2] = !Minecraft.getMinecraft().isSingleplayer();
    addWidget(widget);
    shareOptionTab = new WidgetSidewaysTab(2, guiLeft + 44, guiTop + 18, 14, 14, 234, 3, Refs.MODID + ":textures/gui/circuit_database.png") {

        @Override
        protected void addTooltip(int curHoveredTab, List<String> curTip, boolean shiftPressed) {
            switch(curHoveredTab) {
                case 0:
                    curTip.add("gui.bluepower:circuitDatabase.action.cancel");
                    break;
                case 1:
                    curTip.add("gui.bluepower:circuitDatabase.action.savePrivate");
                    if (!enabledTabs[curHoveredTab]) {
                        curTip.add("gui.bluepower:circuitDatabase.info.nameTaken");
                    }
                    break;
                case 2:
                    curTip.add("gui.bluepower:circuitDatabase.action.saveServer");
                    if (Minecraft.getMinecraft().isSingleplayer()) {
                        curTip.add("gui.bluepower:circuitDatabase.info.serverOnly");
                    } else if (!enabledTabs[curHoveredTab]) {
                        curTip.add("gui.bluepower:circuitDatabase.info.nameTaken");
                    }
                    break;
            }
        }
    };
    shareOptionTab.value = circuitDatabase.selectedShareOption;
    addWidget(shareOptionTab);
    copyButton = new WidgetMode(3, guiLeft + 80, guiTop + 48, 176, 37, 1, Refs.MODID + ":textures/gui/circuit_database.png") {

        @Override
        public void addTooltip(int x, int y, List<String> curTip, boolean shiftPressed) {
            curTip.add("gui.bluepower:circuitDatabase.action.copy");
        }
    };
    addWidget(copyButton);
    Keyboard.enableRepeatEvents(true);
    nameField = new GuiTextField(fontRendererObj, guiLeft + 95, guiTop + 35, 70, fontRendererObj.FONT_HEIGHT);
    nameField.setEnableBackgroundDrawing(true);
    nameField.setVisible(true);
    nameField.setTextColor(16777215);
    nameField.setText(circuitDatabase.getText(1));
}
Also used : WidgetSidewaysTab(uk.co.qmunity.lib.client.gui.widget.WidgetSidewaysTab) WidgetTab(uk.co.qmunity.lib.client.gui.widget.WidgetTab) WidgetMode(uk.co.qmunity.lib.client.gui.widget.WidgetMode) List(java.util.List) GuiTextField(net.minecraft.client.gui.GuiTextField)

Example 2 with WidgetTab

use of uk.co.qmunity.lib.client.gui.widget.WidgetTab in project BluePower by Qmunity.

the class GuiCircuitDatabaseSharing method initGui.

@Override
public void initGui() {
    super.initGui();
    WidgetTab widget = new WidgetTab(1, guiLeft - 32, guiTop + 10, 33, 35, 198, 3, Refs.MODID + ":textures/gui/circuit_database.png") {

        @Override
        protected void addTooltip(int curHoveredTab, List<String> curTip, boolean shiftPressed) {
            switch(curHoveredTab) {
                case 0:
                    curTip.add("gui.bluepower:circuitDatabase.tab.copyAndShare");
                    break;
                case 1:
                    curTip.add("gui.bluepower:circuitDatabase.tab.private");
                    break;
                case 2:
                    curTip.add("gui.bluepower:circuitDatabase.tab.server");
                    if (Minecraft.getMinecraft().isSingleplayer())
                        curTip.add("gui.bluepower:circuitDatabase.info.serverOnly");
                    break;
            }
        }
    };
    widget.value = circuitDatabase.clientCurrentTab;
    widget.enabledTabs[2] = !Minecraft.getMinecraft().isSingleplayer();
    addWidget(widget);
}
Also used : WidgetTab(uk.co.qmunity.lib.client.gui.widget.WidgetTab) List(java.util.List)

Aggregations

List (java.util.List)2 WidgetTab (uk.co.qmunity.lib.client.gui.widget.WidgetTab)2 GuiTextField (net.minecraft.client.gui.GuiTextField)1 WidgetMode (uk.co.qmunity.lib.client.gui.widget.WidgetMode)1 WidgetSidewaysTab (uk.co.qmunity.lib.client.gui.widget.WidgetSidewaysTab)1