Search in sources :

Example 1 with ToggleSprintStatus

use of cc.hyperium.mods.chromahud.displayitems.hyperium.ToggleSprintStatus in project Hyperium by HyperiumClient.

the class ChromaHUD method registerConfigElements.

private void registerConfigElements() {
    ChromaHUDApi.getInstance().registerButtonConfig("COORDS", new ButtonConfig((guiButton, displayItem) -> {
        CordsDisplay displayItem1 = (CordsDisplay) displayItem;
        displayItem1.state = displayItem1.state == 1 ? 0 : 1;
        guiButton.displayString = ChatColor.RED.toString() + "Make " + (((CordsDisplay) displayItem).state == 1 ? "Horizontal" : "Vertical");
    }, new GuiButton(0, 0, 0, "Coords State"), (guiButton, displayItem) -> guiButton.displayString = ChatColor.RED.toString() + "Make " + (((CordsDisplay) displayItem).state == 1 ? "Horizontal" : "Vertical")));
    ChromaHUDApi.getInstance().registerButtonConfig("COORDS", new ButtonConfig((guiButton, displayItem) -> {
        CordsDisplay displayItem1 = (CordsDisplay) displayItem;
        displayItem1.precision += 1;
        if (displayItem1.precision > 4)
            displayItem1.precision = 0;
        int next = displayItem1.precision + 1;
        if (next > 4)
            next = 0;
        guiButton.displayString = ChatColor.RED.toString() + "Change to " + next + " decimal" + (next != 1 ? "s" : "");
    }, new GuiButton(0, 0, 0, "Coords Precision"), (guiButton, displayItem) -> {
        int next = ((CordsDisplay) displayItem).precision + 1;
        if (next > 4)
            next = 0;
        guiButton.displayString = ChatColor.RED.toString() + "Change to " + next + " decimal" + (next != 1 ? "s" : "");
    }));
    ChromaHUDApi.getInstance().registerButtonConfig("POTION", new ButtonConfig((guiButton, displayItem) -> {
        PotionEffects potionEffects = (PotionEffects) displayItem;
        potionEffects.togglePotionIcon();
        guiButton.displayString = ChatColor.RED + "Toggle Potion Icon";
    }, new GuiButton(0, 0, 0, "Potion Icons"), (guiButton, displayItem) -> guiButton.displayString = ChatColor.RED.toString() + "Toggle Potion Icon"));
    ChromaHUDApi.getInstance().registerButtonConfig("DIRECTION", new ButtonConfig((guiButton, displayItem) -> {
        DirectionHUD directionHUD = (DirectionHUD) displayItem;
        directionHUD.toggleShortDirection();
        guiButton.displayString = ChatColor.RED + "Toggle Short Direction";
    }, new GuiButton(0, 0, 0, "Short Directions"), ((guiButton, displayItem) -> guiButton.displayString = ChatColor.RED + "Toggle Short Direction")));
    ChromaHUDApi.getInstance().registerButtonConfig("ARMOUR_HUD", new ButtonConfig((guiButton, displayItem) -> {
        ArmourHud item = (ArmourHud) displayItem;
        item.toggleDurability();
        guiButton.displayString = ChatColor.RED.toString() + "Toggle Durability";
    }, new GuiButton(0, 0, 0, "Armour Hud Durability"), (guiButton, displayItem) -> guiButton.displayString = ChatColor.RED.toString() + "Toggle Durability"));
    ChromaHUDApi.getInstance().registerButtonConfig("ARMOUR_HUD", new ButtonConfig((guiButton, displayItem) -> {
        ArmourHud item = (ArmourHud) displayItem;
        item.toggleHand();
        guiButton.displayString = ChatColor.RED.toString() + "Toggle Held Item";
    }, new GuiButton(0, 0, 0, "Armour Hud Hand"), (guiButton, displayItem) -> guiButton.displayString = ChatColor.RED.toString() + "Toggle Held Item"));
    ChromaHUDApi.getInstance().registerButtonConfig("ARMOUR_HUD", new ButtonConfig((guiButton, displayItem) -> {
        ArmourHud item = (ArmourHud) displayItem;
        item.setArmourOnTop(!item.isArmourOnTop());
        guiButton.displayString = ChatColor.RED.toString() + "Toggle Armour On Top";
    }, new GuiButton(0, 0, 0, "Armour Hud Hand"), (guiButton, displayItem) -> guiButton.displayString = ChatColor.RED.toString() + "Toggle Armour On Top"));
    GuiTextField textTextField = new GuiTextField(1, Minecraft.getMinecraft().fontRendererObj, 0, 0, 200, 20);
    ChromaHUDApi.getInstance().registerTextConfig("TEXT", new TextConfig((guiTextField, displayItem) -> ((TextItem) displayItem).setText(guiTextField.getText()), textTextField, (guiTextField, displayItem) -> guiTextField.setText(((TextItem) displayItem).getText())));
    ChromaHUDApi.getInstance().registerTextConfig("TIME", new TextConfig((guiTextField, displayItem) -> ((TimeHud) displayItem).setFormat(guiTextField.getText()), textTextField, (guiTextField, displayItem) -> guiTextField.setText(((TimeHud) displayItem).getFormat())));
    ChromaHUDApi.getInstance().registerStringConfig("TIME", new StringConfig("Accepted Formats\n" + "YY - Year\n" + "MM - Month\n" + "dd - Day\n" + "HH - Hour\n" + "mm - Minute\n" + "ss - Second\n" + "For more options, Google \"Date Format\""));
    ChromaHUDApi.getInstance().registerButtonConfig("SCOREBOARD", new ButtonConfig((guiButton, displayItem) -> displayItem.getData().put("numbers", !displayItem.getData().optBoolean("numbers")), new GuiButton(0, 0, 0, "Toggle Number"), (guiButton, displayItem) -> {
    }));
    ChromaHUDApi.getInstance().registerTextConfig("SPRINT_STATUS", new TextConfig((guiTextField, displayItem) -> ((ToggleSprintStatus) displayItem).setSprintEnabledText(guiTextField.getText()), textTextField, (guiTextField, displayItem) -> guiTextField.setText(((ToggleSprintStatus) displayItem).getStatusText())));
    ChromaHUDApi.getInstance().registerButtonConfig("COINS", new ButtonConfig((guiButton, displayItem) -> {
        JsonHolder data = displayItem.getData();
        int state = data.optInt("state");
        state++;
        if (state < 0 || state > 2) {
            state = 0;
        }
        data.put("state", state);
    }, new GuiButton(0, 0, 0, "Toggle Number"), (guiButton, displayItem) -> {
        JsonHolder data = displayItem.getData();
        int state = data.optInt("state");
        if (state < 0 || state > 2)
            state = 0;
        if (state == 0)
            guiButton.displayString = "Daily Coins";
        if (state == 1)
            guiButton.displayString = "Monthly Coins";
        if (state == 2)
            guiButton.displayString = "Lifetime Coins";
    }));
}
Also used : JsonHolder(cc.hyperium.utils.JsonHolder) GuiTextField(net.minecraft.client.gui.GuiTextField) StringConfig(cc.hyperium.mods.chromahud.api.StringConfig) DisplayItem(cc.hyperium.mods.chromahud.api.DisplayItem) GuiButton(net.minecraft.client.gui.GuiButton) EventBus(cc.hyperium.event.EventBus) TextConfig(cc.hyperium.mods.chromahud.api.TextConfig) cc.hyperium.mods.chromahud.displayitems.chromahud(cc.hyperium.mods.chromahud.displayitems.chromahud) ChatColor(cc.hyperium.utils.ChatColor) ButtonConfig(cc.hyperium.mods.chromahud.api.ButtonConfig) ToggleSprintStatus(cc.hyperium.mods.chromahud.displayitems.hyperium.ToggleSprintStatus) Collectors(java.util.stream.Collectors) AbstractMod(cc.hyperium.mods.AbstractMod) JsonArray(com.google.gson.JsonArray) List(java.util.List) java.io(java.io) Minecraft(net.minecraft.client.Minecraft) GeneralConfigGui(cc.hyperium.mods.chromahud.gui.GeneralConfigGui) Hyperium(cc.hyperium.Hyperium) CommandChromaHUD(cc.hyperium.mods.chromahud.commands.CommandChromaHUD) JsonHolder(cc.hyperium.utils.JsonHolder) ButtonConfig(cc.hyperium.mods.chromahud.api.ButtonConfig) GuiTextField(net.minecraft.client.gui.GuiTextField) TextConfig(cc.hyperium.mods.chromahud.api.TextConfig) ToggleSprintStatus(cc.hyperium.mods.chromahud.displayitems.hyperium.ToggleSprintStatus) GuiButton(net.minecraft.client.gui.GuiButton) StringConfig(cc.hyperium.mods.chromahud.api.StringConfig)

Aggregations

Hyperium (cc.hyperium.Hyperium)1 EventBus (cc.hyperium.event.EventBus)1 AbstractMod (cc.hyperium.mods.AbstractMod)1 ButtonConfig (cc.hyperium.mods.chromahud.api.ButtonConfig)1 DisplayItem (cc.hyperium.mods.chromahud.api.DisplayItem)1 StringConfig (cc.hyperium.mods.chromahud.api.StringConfig)1 TextConfig (cc.hyperium.mods.chromahud.api.TextConfig)1 CommandChromaHUD (cc.hyperium.mods.chromahud.commands.CommandChromaHUD)1 cc.hyperium.mods.chromahud.displayitems.chromahud (cc.hyperium.mods.chromahud.displayitems.chromahud)1 ToggleSprintStatus (cc.hyperium.mods.chromahud.displayitems.hyperium.ToggleSprintStatus)1 GeneralConfigGui (cc.hyperium.mods.chromahud.gui.GeneralConfigGui)1 ChatColor (cc.hyperium.utils.ChatColor)1 JsonHolder (cc.hyperium.utils.JsonHolder)1 JsonArray (com.google.gson.JsonArray)1 java.io (java.io)1 List (java.util.List)1 Collectors (java.util.stream.Collectors)1 Minecraft (net.minecraft.client.Minecraft)1 GuiButton (net.minecraft.client.gui.GuiButton)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1