Search in sources :

Example 1 with AboveHeadDisplay

use of cc.hyperium.mods.levelhead.display.AboveHeadDisplay in project Hyperium by HyperiumClient.

the class AboveHeadRenderer method render.

@InvokeEvent
public void render(RenderPlayerEvent event) {
    if (levelhead == null || levelhead.getDisplayManager() == null || levelhead.getDisplayManager().getMasterConfig() == null || !levelhead.getDisplayManager().getMasterConfig().isEnabled()) {
        return;
    }
    EntityPlayer player = event.getEntity();
    int o = 0;
    for (AboveHeadDisplay display : levelhead.getDisplayManager().getAboveHead()) {
        int index = display.getIndex();
        int extraHead = levelhead.getLevelheadPurchaseStates().getExtraHead();
        if (index > extraHead || !display.getConfig().isEnabled())
            continue;
        LevelheadTag levelheadTag = display.getCache().get(player.getUniqueID());
        if (display.loadOrRender(player) && levelheadTag != null && !(levelheadTag instanceof NullLevelheadTag)) {
            if ((event.getEntity().getUniqueID().equals(Levelhead.getInstance().userUuid) && !display.getConfig().isShowSelf() || !Hyperium.INSTANCE.getHandlers().getHypixelDetector().isHypixel())) {
                continue;
            }
            if (player.getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) < 64 * 64) {
                double offset = 0.3;
                Scoreboard scoreboard = player.getWorldScoreboard();
                ScoreObjective objective = scoreboard.getObjectiveInDisplaySlot(2);
                if (objective != null && event.getEntity().getDistanceSqToEntity(Minecraft.getMinecraft().thePlayer) < 10 * 10) {
                    offset *= 2;
                }
                if (player.getUniqueID().equals(levelhead.userUuid) && !Settings.SHOW_OWN_NAME)
                    offset -= .3;
                if (Hyperium.INSTANCE.getCosmetics().getDeadmau5Cosmetic().isPurchasedBy(event.getEntity().getUniqueID())) {
                    HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
                    if (packageIfReady != null) {
                        AbstractHyperiumPurchase purchase = packageIfReady.getPurchase(EnumPurchaseType.DEADMAU5_COSMETIC);
                        if (purchase != null) {
                            if (event.getEntity().getUniqueID() != Minecraft.getMinecraft().thePlayer.getUniqueID()) {
                                if (((EarsCosmetic) purchase).isEnabled()) {
                                    offset += .3;
                                }
                            } else if (Settings.EARS_STATE.equalsIgnoreCase("on")) {
                                offset += .2;
                            }
                        }
                    }
                }
                offset += levelhead.getDisplayManager().getMasterConfig().getOffset();
                renderName(event, levelheadTag, player, event.getX(), event.getY() + offset + o * .3D, event.getZ());
            }
        }
        o++;
    }
}
Also used : ScoreObjective(net.minecraft.scoreboard.ScoreObjective) AbstractHyperiumPurchase(cc.hyperium.purchases.AbstractHyperiumPurchase) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) Scoreboard(net.minecraft.scoreboard.Scoreboard) AbstractHyperiumPurchase(cc.hyperium.purchases.AbstractHyperiumPurchase) EarsCosmetic(cc.hyperium.purchases.packages.EarsCosmetic) EntityPlayer(net.minecraft.entity.player.EntityPlayer) AboveHeadDisplay(cc.hyperium.mods.levelhead.display.AboveHeadDisplay) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 2 with AboveHeadDisplay

use of cc.hyperium.mods.levelhead.display.AboveHeadDisplay in project Hyperium by HyperiumClient.

the class Levelhead method refreshPurchaseStates.

public synchronized void refreshPurchaseStates() {
    purchaseStatus = new LevelheadJsonHolder(rawWithAgent("https://api.sk1er.club/levelhead_purchase_status/" + Minecraft.getMinecraft().getSession().getProfile().getId().toString()));
    levelheadPurchaseStates.setChat(purchaseStatus.optBoolean("chat"));
    levelheadPurchaseStates.setTab(purchaseStatus.optBoolean("tab"));
    levelheadPurchaseStates.setExtraHead(purchaseStatus.optInt("head"));
    DisplayManager displayManager = this.displayManager;
    while (displayManager.getAboveHead().size() <= levelheadPurchaseStates.getExtraHead()) {
        displayManager.getAboveHead().add(new AboveHeadDisplay(new DisplayConfig()));
    }
    displayManager.adjustIndexes();
}
Also used : DisplayManager(cc.hyperium.mods.levelhead.display.DisplayManager) LevelheadJsonHolder(cc.hyperium.mods.levelhead.util.LevelheadJsonHolder) DisplayConfig(cc.hyperium.mods.levelhead.display.DisplayConfig) AboveHeadDisplay(cc.hyperium.mods.levelhead.display.AboveHeadDisplay)

Aggregations

AboveHeadDisplay (cc.hyperium.mods.levelhead.display.AboveHeadDisplay)2 InvokeEvent (cc.hyperium.event.InvokeEvent)1 DisplayConfig (cc.hyperium.mods.levelhead.display.DisplayConfig)1 DisplayManager (cc.hyperium.mods.levelhead.display.DisplayManager)1 LevelheadJsonHolder (cc.hyperium.mods.levelhead.util.LevelheadJsonHolder)1 AbstractHyperiumPurchase (cc.hyperium.purchases.AbstractHyperiumPurchase)1 HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)1 EarsCosmetic (cc.hyperium.purchases.packages.EarsCosmetic)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ScoreObjective (net.minecraft.scoreboard.ScoreObjective)1 Scoreboard (net.minecraft.scoreboard.Scoreboard)1