Search in sources :

Example 1 with AbstractHyperiumPurchase

use of cc.hyperium.purchases.AbstractHyperiumPurchase 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 AbstractHyperiumPurchase

use of cc.hyperium.purchases.AbstractHyperiumPurchase in project Hyperium by HyperiumClient.

the class LayerDeadmau5HeadHandler method doRenderLayer.

public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float partialTicks, RenderPlayer playerRenderer) {
    int k = 0;
    try {
        k = 1;
        if (entitylivingbaseIn == null)
            return;
        if (entitylivingbaseIn.isInvisible())
            return;
        if (entitylivingbaseIn.isInvisibleToPlayer(Minecraft.getMinecraft().thePlayer))
            return;
        k = 2;
        if (!Settings.SHOW_COSMETICS_EVERYWHERE && !(Hyperium.INSTANCE.getHandlers().getLocationHandler().isLobbyOrHousing()))
            return;
        k = 3;
        String name = entitylivingbaseIn.getName();
        if (name == null)
            return;
        k = 5;
        if (Hyperium.INSTANCE.getCosmetics().getDeadmau5Cosmetic().isPurchasedBy(entitylivingbaseIn.getUniqueID())) {
            HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(entitylivingbaseIn.getUniqueID());
            if (packageIfReady == null)
                return;
            k = 6;
            AbstractHyperiumPurchase purchase = packageIfReady.getPurchase(EnumPurchaseType.DEADMAU5_COSMETIC);
            if (purchase == null)
                return;
            k = 7;
            EntityPlayerSP thePlayer = Minecraft.getMinecraft().thePlayer;
            if (thePlayer != null && entitylivingbaseIn.getUniqueID() != thePlayer.getUniqueID()) {
                if (!((EarsCosmetic) purchase).isEnabled()) {
                    k = -5;
                    return;
                }
            } else if (!Settings.EARS_STATE.equalsIgnoreCase("yes")) {
                return;
            }
            k = 8;
            ResourceLocation locationSkin = entitylivingbaseIn.getLocationSkin();
            if (locationSkin != null)
                playerRenderer.bindTexture(locationSkin);
            k = 9;
            GlStateManager.disableCull();
            for (int i = 0; i < 2; ++i) {
                int g = 0;
                try {
                    GlStateManager.pushMatrix();
                    float f = entitylivingbaseIn.prevRotationYaw + (entitylivingbaseIn.rotationYaw - entitylivingbaseIn.prevRotationYaw) * partialTicks - (entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks);
                    float f1 = entitylivingbaseIn.prevRotationPitch + (entitylivingbaseIn.rotationPitch - entitylivingbaseIn.prevRotationPitch) * partialTicks;
                    g++;
                    GlStateManager.rotate(f, 0.0F, 1.0F, 0.0F);
                    GlStateManager.rotate(f1, 1.0F, 0.0F, 0.0F);
                    GlStateManager.translate(0.375F * (float) (i * 2 - 1), 0.0F, 0.0F);
                    GlStateManager.translate(0.0F, -0.375F, 0.0F);
                    GlStateManager.rotate(-f1, 1.0F, 0.0F, 0.0F);
                    GlStateManager.rotate(-f, 0.0F, 1.0F, 0.0F);
                    g++;
                    if (entitylivingbaseIn.isSneaking()) {
                        GlStateManager.translate(0.0F, 0.25, 0.0F);
                    }
                    float f2 = 1.3333334F;
                    GlStateManager.scale(f2, f2, f2);
                    g++;
                    playerRenderer.getMainModel().renderDeadmau5Head(0.0625F);
                    g++;
                } catch (Exception e) {
                    Hyperium.LOGGER.error("Failed to render deadmau5 at g " + g);
                    e.printStackTrace();
                } finally {
                    GlStateManager.popMatrix();
                }
            }
            k = 10;
        }
    } catch (Exception e) {
        e.printStackTrace();
        Hyperium.LOGGER.error("Failed to render Deadmau5 at point " + k);
    }
}
Also used : AbstractHyperiumPurchase(cc.hyperium.purchases.AbstractHyperiumPurchase) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) AbstractHyperiumPurchase(cc.hyperium.purchases.AbstractHyperiumPurchase) ResourceLocation(net.minecraft.util.ResourceLocation) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP)

Aggregations

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