Search in sources :

Example 6 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Hyperium by HyperiumClient.

the class GuiScreenBackground method initGui.

public void initGui() {
    buttonList.add(new GuiButton(0, getCenter() - 75, getRowPos(1), 150, 20, "Chroma: " + getSuffix(sidebar.chromaEnabled)));
    buttonList.add(buttonChromaType = new GuiButton(7, getCenter() - 75, getRowPos(2), 150, 20, "Chroma type: " + sidebar.chromaType.getName()));
    buttonList.add(sliderRed = new GuiSlider(1, getCenter() - 75, getRowPos(2), 150, 20, "Red: ", "", 0.0, 255.0, sidebar.color >> 16 & 0xFF, false, true));
    buttonList.add(sliderGreen = new GuiSlider(2, getCenter() - 75, getRowPos(3), 150, 20, "Green: ", "", 0.0, 255.0, sidebar.color >> 8 & 0xFF, false, true));
    buttonList.add(sliderBlue = new GuiSlider(3, getCenter() - 75, getRowPos(4), 150, 20, "Blue: ", "", 0.0, 255.0, sidebar.color & 0xFF, false, true));
    buttonList.add(sliderAlpha = new GuiSlider(4, getCenter() - 75, getRowPos(5), 150, 20, "Alpha: ", "", 0.0, 255.0, sidebar.alpha, false, true));
    buttonList.add(sliderChromaSpeed = new GuiSlider(3, getCenter() - 75, getRowPos(4), 150, 20, "Chroma Speed: ", "", 1.0, 10.0, sidebar.chromaSpeed, false, true));
    buttonList.add(buttonDone = new GuiButton(6, getCenter() - 75, getRowPos(6), 150, 20, "Done"));
    setSlidersVisibility();
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 7 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Hyperium by HyperiumClient.

the class GuiScreenColor method initGui.

@Override
public void initGui() {
    buttonList.add(new GuiSlider(0, width / 2 - 150, calculateHeight(3), 150, 20, "Red: ", "", 0, 255, red.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            red.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(1, width / 2 - 150, calculateHeight(4), 150, 20, "Green: ", "", 0, 255, green.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            green.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(2, width / 2 - 150, calculateHeight(5), 150, 20, "Blue: ", "", 0, 255, blue.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            blue.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(3, width / 2 + 5, calculateHeight(3), 150, 20, "Pressed Red: ", "", 0, 255, pressedRed.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            pressedRed.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(4, width / 2 + 5, calculateHeight(4), 150, 20, "Pressed Green: ", "", 0, 255, pressedGreen.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            pressedGreen.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiSlider(5, width / 2 + 5, calculateHeight(5), 150, 20, "Pressed Blue: ", "", 0, 255, pressedBlue.getAmount(), false, true) {

        @Override
        public void updateSlider() {
            super.updateSlider();
            pressedBlue.onScroll(getValue(), getValueInt());
            updated = true;
        }
    });
    buttonList.add(new GuiButton(6, 5, height - 25, 100, 20, "Back"));
}
Also used : GuiButton(net.minecraft.client.gui.GuiButton) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 8 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Hyperium by HyperiumClient.

the class DisplayElementConfig method repack.

private void repack() {
    buttonList.clear();
    clicks.clear();
    updates.clear();
    nameMap.clear();
    ScaledResolution current = ResolutionUtil.current();
    int start_y = Math.max((int) (current.getScaledHeight_double() * .1) - 20, 5);
    int posX = (int) (current.getScaledWidth_double() * .5) - 100;
    reg("pos", new GuiButton(nextId(), posX, start_y, "Change Position"), button -> Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(new MoveElementGui(mod, element)));
    reg("items", new GuiButton(nextId(), posX, start_y + 22, "Change Items"), button -> Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(new EditItemsGui(element, mod)));
    // Highlighted
    reg("Highlight", new GuiButton(nextId(), posX, start_y + 22 * 2, "-"), button -> {
        // On click
        element.setHighlighted(!element.isHighlighted());
    }, button -> {
        // On Gui Update
        button.displayString = ChatColor.YELLOW.toString() + "Highlighted: " + (element.isHighlighted() ? ChatColor.GREEN + "Yes" : ChatColor.RED.toString() + "No");
    });
    // Shadow
    reg("shadow", new GuiButton(nextId(), posX, start_y + 22 * 3, "-"), button -> {
        // On click
        element.setShadow(!element.isShadow());
    }, button -> {
        // On Gui Update
        button.displayString = ChatColor.YELLOW.toString() + "Shadow: " + (element.isShadow() ? ChatColor.GREEN + "Yes" : ChatColor.RED.toString() + "No");
    });
    reg("Toggle Right", new GuiButton(nextId(), posX, start_y + 22 * 4, "-"), button -> {
        // On click
        element.setRightSided(!element.isRightSided());
    }, button -> {
        // On Gui Update
        button.displayString = ChatColor.YELLOW.toString() + "Right side: " + (element.isRightSided() ? ChatColor.GREEN + "Yes" : ChatColor.RED.toString() + "No");
    });
    // *4
    reg("Scale Slider", new GuiSlider(nextId(), 5, 5, 200, 20, "Scale: ", "", 50, 200, element.getScale() * 100D, false, true), button -> {
    // clicked
    // Toggle between chroma types.
    }, button -> {
        // on tick
        element.setScale(((GuiSlider) button).getValue() / 100D);
        button.displayString = EnumChatFormatting.YELLOW + "Scale: " + ((GuiSlider) button).getValueInt() + "%";
    });
    reg("color", new GuiButton(nextId(), posX, start_y + 22 * 5, "-"), button -> {
        // Chroma -> RGB -> Color Pallet -> Chroma
        if (element.isChroma()) {
            element.setChroma(false);
            element.setRgb(true);
        } else if (element.isRGB()) {
            element.setRgb(false);
            element.setColorPallet(true);
        } else {
            element.setColorPallet(false);
            element.setChroma(true);
        }
    }, button -> {
        // on tick
        String type = "Error";
        if (element.isRGB())
            type = "RGB";
        if (element.isColorPallet())
            type = "Color Pallet";
        if (element.isChroma())
            type = "Chroma";
        button.displayString = ChatColor.YELLOW + "Color mode: " + ChatColor.GREEN.toString() + type;
    });
    reg("chromaMode", new GuiButton(nextId(), posX, start_y + 22 * 6, "-"), button -> {
        // clicked
        // Toggle between chroma types.
        element.setStaticChroma(!element.isStaticChroma());
    }, button -> {
        // on tick
        if (!element.isChroma()) {
            button.enabled = false;
            button.visible = false;
        } else {
            button.visible = true;
            button.enabled = true;
            button.displayString = ChatColor.YELLOW + "Chroma mode: " + (element.isStaticChroma() ? ChatColor.GREEN + "Static" : ChatColor.GREEN + "Wave");
        }
    });
    reg("redSlider", new GuiSlider(nextId(), posX, start_y + 22 * 6, 200, 20, "Red: ", "", 0, 255, element.getData().optInt("red"), false, true), button -> {
    }, button -> {
        // on tick
        if (!element.isRGB()) {
            button.enabled = false;
            button.visible = false;
        } else {
            button.visible = true;
            button.enabled = true;
            element.getData().put("red", ((GuiSlider) button).getValueInt());
            button.displayString = EnumChatFormatting.YELLOW + "Red: " + (element.getData().optInt("red"));
        }
    });
    reg("blueSlider", new GuiSlider(nextId(), posX, start_y + 22 * 8, 200, 20, "Blue: ", "", 0, 255, element.getData().optInt("blue"), false, true), button -> {
    // clicked
    // Toggle between chroma types.
    }, button -> {
        // on tick
        if (!element.isRGB()) {
            button.enabled = false;
            button.visible = false;
        } else {
            button.visible = true;
            button.enabled = true;
            element.getData().put("blue", ((GuiSlider) button).getValueInt());
            button.displayString = EnumChatFormatting.YELLOW + "Blue: " + (element.getData().optInt("blue"));
        }
    });
    reg("greenSlider", new GuiSlider(nextId(), posX, start_y + 22 * 7, 200, 20, "Green: ", "", 0, 255, element.getData().optInt("green"), false, true), button -> {
    // clicked
    // Toggle between chroma types.
    }, button -> {
        // on tick
        if (!element.isRGB()) {
            button.enabled = false;
            button.visible = false;
        } else {
            button.visible = true;
            button.enabled = true;
            element.getData().put("green", ((GuiSlider) button).getValueInt());
            button.displayString = EnumChatFormatting.YELLOW + "Green: " + (element.getData().optInt("green"));
        }
    });
    reg("Back", new GuiButton(nextId(), 2, ResolutionUtil.current().getScaledHeight() - 22, 100, 20, "Back"), (guiButton) -> Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(new GeneralConfigGui(mod)), (guiButton) -> {
    });
    reg("Delete", new GuiButton(nextId(), 2, ResolutionUtil.current().getScaledHeight() - 22 * 2, 100, 20, "Delete"), (guiButton) -> {
        Hyperium.INSTANCE.getHandlers().getGuiDisplayHandler().setDisplayNextTick(new GeneralConfigGui(mod));
        ChromaHUDApi.getInstance().getElements().remove(element);
    }, (guiButton) -> {
    });
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) GuiButton(net.minecraft.client.gui.GuiButton) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Example 9 with GuiSlider

use of net.minecraftforge.fml.client.config.GuiSlider in project Hyperium by HyperiumClient.

the class LevelheadGui method doHead.

private void doHead(DisplayConfig config, Levelhead instance, int editWidth, int mouseX, int mouseY) {
    List<AboveHeadDisplay> aboveHead = instance.getDisplayManager().getAboveHead();
    textField.drawTextBox();
    if (!textField.getText().equalsIgnoreCase(config.getCustomHeader())) {
        config.setCustomHeader(textField.getText());
        updatePeopleToValues();
    }
    reg(new GuiButton(++currentID, width / 3 - 100, height - 137, 200, 20, YELLOW + "Purchase Additional Above Head Layer"), button -> attemptPurchase("head"));
    reg(new GuiButton(++currentID, width - editWidth * 2 - 3, 29, editWidth, 20, YELLOW + "Editing Layer: " + AQUA + (aboveHead.indexOf(currentlyBeingEdited) + 1)), button -> {
        int i = aboveHead.indexOf(currentlyBeingEdited);
        i++;
        if (i >= aboveHead.size()) {
            i = 0;
        }
        currentlyBeingEdited = aboveHead.get(i);
        textField.setText(currentlyBeingEdited.getConfig().getCustomHeader());
    });
    reg(new GuiButton(++currentID, width - editWidth * 2 - 3, 50, editWidth, 20, YELLOW + "Show On Self: " + AQUA + (currentlyBeingEdited.getConfig().isShowSelf() ? "YES" : "NO")), button -> currentlyBeingEdited.getConfig().setShowSelf(!currentlyBeingEdited.getConfig().isShowSelf()));
    int colorConfigStart = 93 + 2;
    reg(new GuiButton(++currentID, width - editWidth * 2 - 2, colorConfigStart, editWidth, 20, YELLOW + "Header Mode: " + AQUA + getMode(true)), button -> {
        if (config.isHeaderRgb()) {
            config.setHeaderRgb(false);
            config.setHeaderChroma(true);
        } else if (config.isHeaderChroma()) {
            config.setHeaderRgb(false);
            config.setHeaderChroma(false);
        } else {
            config.setHeaderRgb(true);
            config.setHeaderChroma(false);
        }
        updatePeopleToValues();
    });
    if (config.isHeaderRgb()) {
        regSlider(new GuiSlider(++currentID, width - editWidth * 2 - 2, colorConfigStart + 22, editWidth, 20, YELLOW + "Header Red: " + AQUA, "", 0, 255, config.getHeaderRed(), false, true, slider -> {
            config.setHeaderRed(slider.getValueInt());
            updatePeopleToValues();
        }));
        regSlider(new GuiSlider(++currentID, width - editWidth * 2 - 2, colorConfigStart + 44, editWidth, 20, YELLOW + "Header Green: " + AQUA, "", 0, 255, config.getHeaderGreen(), false, true, slider -> {
            config.setHeaderGreen(slider.getValueInt());
            updatePeopleToValues();
        }));
        regSlider(new GuiSlider(++currentID, width - editWidth * 2 - 2, colorConfigStart + 66, editWidth, 20, YELLOW + "Header Blue: " + AQUA, "", 0, 255, config.getHeaderBlue(), false, true, slider -> {
            config.setHeaderBlue(slider.getValueInt());
            updatePeopleToValues();
        }));
    } else if (!config.isHeaderChroma()) {
        reg(new GuiButton(++currentID, width - editWidth * 2 - 2, colorConfigStart + 22, editWidth, 20, config.getHeaderColor() + "Rotate Header Color"), button -> {
            int primaryId = colors.indexOf(removeColorChar(config.getHeaderColor()));
            if (++primaryId == colors.length()) {
                primaryId = 0;
            }
            config.setHeaderColor(COLOR_CHAR + colors.charAt(primaryId));
            updatePeopleToValues();
        });
    }
    reg(new GuiButton(++currentID, width - editWidth - 1, colorConfigStart, editWidth, 20, YELLOW + "Footer Mode: " + AQUA + getMode(false)), button -> {
        updateFooterColorState(config);
        button.displayString = "Footer Mode: " + getMode(false);
        updatePeopleToValues();
    });
    if (config.isFooterRgb()) {
        regSlider(new GuiSlider(++currentID, width - editWidth - 1, colorConfigStart + 22, editWidth, 20, YELLOW + "Footer Red: " + AQUA, "", 0, 255, config.getFooterRed(), false, true, slider -> {
            config.setFooterRed(slider.getValueInt());
            updatePeopleToValues();
        }));
        regSlider(new GuiSlider(++currentID, width - editWidth - 1, colorConfigStart + 44, editWidth, 20, YELLOW + "Footer Green: " + AQUA, "", 0, 255, config.getFooterGreen(), false, true, slider -> {
            config.setFooterGreen(slider.getValueInt());
            updatePeopleToValues();
        }));
        regSlider(new GuiSlider(++currentID, width - editWidth - 1, colorConfigStart + 66, editWidth, 20, YELLOW + "Footer Blue: " + AQUA, "", 0, 255, config.getFooterBlue(), false, true, slider -> {
            config.setFooterBlue(slider.getValueInt());
            updatePeopleToValues();
        }));
    } else if (!config.isFooterChroma()) {
        reg(new GuiButton(++currentID, width - editWidth - 1, colorConfigStart + 22, editWidth, 20, config.getFooterColor() + "Rotate Footer Color"), button -> incrementColor(config, false));
    }
    regSlider(new GuiSlider(++currentID, width - editWidth * 2 - 2, colorConfigStart + 88, editWidth, 20, YELLOW + "Vertical Offset: " + AQUA, "", -50, 100, instance.getDisplayManager().getMasterConfig().getOffset() * 100D, false, true, slider -> instance.getDisplayManager().getMasterConfig().setOffset(slider.getValue() / 100D)));
    regSlider(new GuiSlider(++currentID, width - editWidth - 1, colorConfigStart + 88, editWidth, 20, YELLOW + "Font Size: " + AQUA, "", 1, 20, instance.getDisplayManager().getMasterConfig().getFontSize() * 10D, false, true, slider -> {
        instance.getDisplayManager().getMasterConfig().setFontSize(slider.getValue() / 10D);
        updatePeopleToValues();
    }));
    if (isCustom) {
        reg(new GuiButton(++currentID, width - editWidth * 2 - 2, colorConfigStart + 88 + 22, editWidth * 2 + 1, 20, YELLOW + "Export Colors to Custom Levelhead"), guiButton -> {
            final LevelheadJsonHolder object;
            String encode;
            String url;
            ChatComponentText text;
            ChatStyle style;
            ChatComponentText valueIn;
            ChatStyle style2;
            object = new LevelheadJsonHolder();
            object.put("header_obj", currentlyBeingEdited.getHeaderConfig());
            object.put("footer_obj", currentlyBeingEdited.getFooterConfig());
            try {
                encode = URLEncoder.encode(object.toString(), "UTF-8");
                url = "https://sk1er.club/user?levelhead_color=" + encode;
                text = new ChatComponentText("Click here to update your custom Levelhead colors");
                style = new ChatStyle();
                style.setBold(true);
                style.setColor(EnumChatFormatting.YELLOW);
                style.setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
                valueIn = new ChatComponentText("Please be logged in to your Sk1er.club for this to work. Do /levelhead dumpcache after clicking to see new colors!");
                valueIn.getChatStyle().setChatClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, url));
                style2 = new ChatStyle();
                style2.setColor(EnumChatFormatting.RED);
                valueIn.setChatStyle(style2);
                style.setChatHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, valueIn));
                text.setChatStyle(style);
                mc.thePlayer.addChatComponentMessage(valueIn);
                mc.thePlayer.addChatComponentMessage(text);
            } catch (UnsupportedEncodingException e2) {
                e2.printStackTrace();
            }
            mc.displayGuiScreen(null);
        });
    }
    GlStateManager.pushMatrix();
    GlStateManager.color(1, 1, 1);
    RenderHelper.enableStandardItemLighting();
    GlStateManager.enableAlpha();
    GlStateManager.shadeModel(7424);
    GlStateManager.enableAlpha();
    GlStateManager.enableDepth();
    GlStateManager.translate(0, 0, 50);
    ScaledResolution current = new ScaledResolution(mc);
    int posX = current.getScaledWidth() / 3;
    int posY = current.getScaledHeight() / 2;
    GuiInventory.drawEntityOnScreen(posX, posY + 50, 50, posX - mouseX, posY - mouseY, mc.thePlayer);
    GlStateManager.depthFunc(515);
    GlStateManager.resetColor();
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    GlStateManager.disableDepth();
    GlStateManager.popMatrix();
    drawScaledText("Custom Prefix: ", width - editWidth * 3 / 2 - 3, 77, 1.5, -1, true, true);
}
Also used : net.minecraft.util(net.minecraft.util) Levelhead(cc.hyperium.mods.levelhead.Levelhead) NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo) java.util(java.util) LevelheadChatRenderer(cc.hyperium.mods.levelhead.renderer.LevelheadChatRenderer) ChatColor(cc.hyperium.utils.ChatColor) ScoreObjective(net.minecraft.scoreboard.ScoreObjective) URISyntaxException(java.net.URISyntaxException) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider) net.minecraft.client.gui(net.minecraft.client.gui) LevelheadPurchaseStates(cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates) Minecraft(net.minecraft.client.Minecraft) HoverEvent(net.minecraft.event.HoverEvent) Multithreading(cc.hyperium.mods.sk1ercommon.Multithreading) RenderHelper(net.minecraft.client.renderer.RenderHelper) Hyperium(cc.hyperium.Hyperium) Sk1erMod(cc.hyperium.mods.sk1ercommon.Sk1erMod) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) URI(java.net.URI) ClickEvent(net.minecraft.event.ClickEvent) JsonHolder(cc.hyperium.utils.JsonHolder) GuiInventory(net.minecraft.client.gui.inventory.GuiInventory) GlStateManager(net.minecraft.client.renderer.GlStateManager) IOException(java.io.IOException) Mouse(org.lwjgl.input.Mouse) cc.hyperium.mods.levelhead.display(cc.hyperium.mods.levelhead.display) EnumPlayerModelParts(net.minecraft.entity.player.EnumPlayerModelParts) java.awt(java.awt) Consumer(java.util.function.Consumer) URLEncoder(java.net.URLEncoder) List(java.util.List) LevelheadJsonHolder(cc.hyperium.mods.levelhead.util.LevelheadJsonHolder) UnsupportedEncodingException(java.io.UnsupportedEncodingException) Scoreboard(net.minecraft.scoreboard.Scoreboard) HoverEvent(net.minecraft.event.HoverEvent) ClickEvent(net.minecraft.event.ClickEvent) UnsupportedEncodingException(java.io.UnsupportedEncodingException) LevelheadJsonHolder(cc.hyperium.mods.levelhead.util.LevelheadJsonHolder) GuiSlider(net.minecraftforge.fml.client.config.GuiSlider)

Aggregations

GuiSlider (net.minecraftforge.fml.client.config.GuiSlider)9 GuiButton (net.minecraft.client.gui.GuiButton)5 GuiCheckBox (com.wuest.prefab.Gui.Controls.GuiCheckBox)2 GuiButtonExt (net.minecraftforge.fml.client.config.GuiButtonExt)2 Hyperium (cc.hyperium.Hyperium)1 Levelhead (cc.hyperium.mods.levelhead.Levelhead)1 cc.hyperium.mods.levelhead.display (cc.hyperium.mods.levelhead.display)1 LevelheadPurchaseStates (cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates)1 LevelheadChatRenderer (cc.hyperium.mods.levelhead.renderer.LevelheadChatRenderer)1 LevelheadJsonHolder (cc.hyperium.mods.levelhead.util.LevelheadJsonHolder)1 Multithreading (cc.hyperium.mods.sk1ercommon.Multithreading)1 Sk1erMod (cc.hyperium.mods.sk1ercommon.Sk1erMod)1 ChatColor (cc.hyperium.utils.ChatColor)1 JsonHolder (cc.hyperium.utils.JsonHolder)1 InstantBridgeConfiguration (com.wuest.prefab.Config.Structures.InstantBridgeConfiguration)1 GuiTab (com.wuest.prefab.Gui.Controls.GuiTab)1 GuiTextSlider (com.wuest.prefab.Gui.Controls.GuiTextSlider)1 java.awt (java.awt)1 IOException (java.io.IOException)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1