Search in sources :

Example 1 with LevelheadPurchaseStates

use of cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates in project Hyperium by HyperiumClient.

the class LevelheadGui method doChat.

private void doChat(DisplayConfig config, Levelhead instance, int editWidth) {
    EntityPlayerSP player = mc.thePlayer;
    LevelheadPurchaseStates levelheadPurchaseStates = instance.getLevelheadPurchaseStates();
    String formattedName = player.getDisplayName().getFormattedText();
    IChatComponent component = new ChatComponentTranslation(formattedName + WHITE + ": Levelhead rocks!");
    String chatTag = "Some stat";
    LevelheadDisplay chatDisplay = instance.getDisplayManager().getChat();
    if (chatDisplay != null && levelheadPurchaseStates.isChat()) {
        chatTag = chatDisplay.getTrueValueCache().get(player.getUniqueID());
    }
    IChatComponent chatComponent = LevelheadChatRenderer.modifyChat(component, chatTag, chatDisplay != null ? chatDisplay.getConfig() : new DisplayConfig());
    String fakeChatText = chatComponent.getFormattedText();
    int fakeChatTop = height - 200;
    drawRect(width / 3 - fontRendererObj.getStringWidth(fakeChatText) / 2, fakeChatTop, width / 3 + fontRendererObj.getStringWidth(fakeChatText) / 2, fakeChatTop + 10, Integer.MIN_VALUE);
    drawScaledText(fakeChatText, width / 3, fakeChatTop + 1, 1.0, -1, true, true);
    if (!levelheadPurchaseStates.isChat()) {
        String text = "Levelhead chat display not purchased!\nPlease purchase to activate and configure.";
        int i = 2;
        for (String s : text.split("\n")) {
            int offset = i * 10;
            int stringWidth = fontRendererObj.getStringWidth(s);
            int tmpLeft = width / 3 - stringWidth / 2;
            fakeChatTop = height - 180;
            drawRect(tmpLeft, fakeChatTop + offset, tmpLeft + stringWidth, fakeChatTop + offset + 8, Integer.MIN_VALUE);
            fontRendererObj.drawString(s, tmpLeft, fakeChatTop + offset, Color.YELLOW.getRGB(), true);
            i++;
        }
        reg(new GuiButton(++currentID, width / 3 - 60, height - 140, 120, 20, YELLOW + "Purchase Chat Display"), button -> attemptPurchase("chat"));
    } else {
        reg(new GuiButton(++currentID, width - editWidth - 1, 71, editWidth, 20, "Rotate Bracket Color"), button -> incrementColor(config, true));
        reg(new GuiButton(++currentID, width - editWidth - 1, 92, editWidth, 20, "Rotate Value Color"), button -> incrementColor(config, false));
    }
}
Also used : LevelheadPurchaseStates(cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Example 2 with LevelheadPurchaseStates

use of cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates in project Hyperium by HyperiumClient.

the class LevelheadGui method doTab.

private void doTab(Levelhead instance) {
    EntityPlayerSP player = mc.thePlayer;
    NetworkPlayerInfo playerInfo = mc.getNetHandler().getPlayerInfo(player.getUniqueID());
    LevelheadDisplay tab = instance.getDisplayManager().getTab();
    if (tab != null) {
        String formattedText = player.getDisplayName().getFormattedText();
        int totalTabWidth = 9 + fontRendererObj.getStringWidth(formattedText) + getLevelheadWidth(playerInfo) + 15;
        int fakeTabTop = height - 200;
        int centerOn = width / 3;
        int leftStart = centerOn - totalTabWidth / 2;
        drawRect(leftStart, fakeTabTop, centerOn + totalTabWidth / 2, fakeTabTop + 8, Integer.MIN_VALUE);
        drawRect(leftStart, fakeTabTop, centerOn + totalTabWidth / 2, fakeTabTop + 8, 553648127);
        fontRendererObj.drawString(formattedText, leftStart + 9, fakeTabTop, -1, true);
        mc.getTextureManager().bindTexture(player.getLocationSkin());
        int l2 = 8;
        int i3 = 8;
        Gui.drawScaledCustomSizeModalRect(leftStart, fakeTabTop, 8.0F, (float) l2, 8, i3, 8, 8, 64.0F, 64.0F);
        if (player.isWearing(EnumPlayerModelParts.HAT)) {
            int j3 = 8;
            int k3 = 8;
            Gui.drawScaledCustomSizeModalRect(leftStart, fakeTabTop, 40.0F, (float) j3, 8, k3, 8, 8, 64.0F, 64.0F);
        }
        drawPing(leftStart + totalTabWidth, fakeTabTop, playerInfo);
        drawPingHook(0, leftStart + totalTabWidth, fakeTabTop, playerInfo);
        LevelheadPurchaseStates purchaseStates = instance.getLevelheadPurchaseStates();
        if (!purchaseStates.isTab()) {
            String text = "Levelhead tab display not purchased!\nPlease purchase to activate and configure.";
            int i = 1;
            for (String s : text.split("\n")) {
                int offset = i * 10;
                int stringWidth = fontRendererObj.getStringWidth(s);
                int tmpLeft = width / 3 - stringWidth / 2;
                fakeTabTop = height - 180;
                drawRect(tmpLeft, fakeTabTop + offset, tmpLeft + stringWidth, fakeTabTop + offset + 8, Integer.MIN_VALUE);
                fontRendererObj.drawString(s, tmpLeft, fakeTabTop + offset, Color.YELLOW.getRGB(), true);
                i++;
            }
            reg(new GuiButton(++currentID, centerOn - 60, height - 140, 120, 20, YELLOW + "Purchase Tab Display"), button -> attemptPurchase("tab"));
        }
    }
}
Also used : NetworkPlayerInfo(net.minecraft.client.network.NetworkPlayerInfo) LevelheadPurchaseStates(cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Aggregations

LevelheadPurchaseStates (cc.hyperium.mods.levelhead.purchases.LevelheadPurchaseStates)2 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)2 NetworkPlayerInfo (net.minecraft.client.network.NetworkPlayerInfo)1