Search in sources :

Example 1 with HyperiumPurchase

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

the class WingsRenderer method onRenderPlayer.

@InvokeEvent
public void onRenderPlayer(RenderPlayerEvent event) {
    if (CosmeticsUtil.shouldHide(EnumPurchaseType.WING_COSMETIC))
        return;
    EntityPlayer player = event.getEntity();
    if (wingsCosmetic.isPurchasedBy(event.getEntity().getUniqueID()) && !player.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
        if (packageIfReady == null || packageIfReady.getCachedSettings().isWingsDisabled())
            return;
        renderWings(player, event.getPartialTicks(), event.getX(), event.getY(), event.getZ());
    }
}
Also used : HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) EntityPlayer(net.minecraft.entity.player.EntityPlayer) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 2 with HyperiumPurchase

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

the class ButtCosmetic method preCopy.

@InvokeEvent(priority = Priority.HIGH)
public void preCopy(PreCopyPlayerModelAnglesEvent event) {
    if (!(event.getModel() instanceof IMixinModelPlayer))
        return;
    if (!isPurchasedBy(event.getEntity().getUniqueID())) {
        ((IMixinModelPlayer) event.getModel()).getButt().showModel = false;
        return;
    }
    HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(event.getEntity().getUniqueID());
    if (packageIfReady == null)
        return;
    ((IMixinModelPlayer) event.getModel()).getButt().showModel = !packageIfReady.getCachedSettings().isButtDisabled();
    ((IMixinModelPlayer) event.getModel()).getButt().offsetY = event.getEntity().isSneaking() ? -.45F : -.4F;
    ((IMixinModelPlayer) event.getModel()).getButt().offsetZ = event.getEntity().isSneaking() ? .3F : 0F;
}
Also used : IMixinModelPlayer(cc.hyperium.mixinsimp.client.model.IMixinModelPlayer) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 3 with HyperiumPurchase

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

the class HamsterCompanion method renderPlayer.

@InvokeEvent
public void renderPlayer(RenderPlayerEvent e) {
    if (Minecraft.getMinecraft().theWorld == null)
        return;
    UUID uuid = e.getEntity().getUniqueID();
    if (!isPurchasedBy(uuid) || hamsters.containsKey(uuid) || toAdd.contains(e.getEntity()))
        return;
    HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(uuid);
    if (packageIfReady == null || packageIfReady.getCachedSettings().getCurrentCompanion() != EnumPurchaseType.HAMSTER_COMPANION) {
        return;
    }
    toAdd.add(e.getEntity());
}
Also used : HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase)

Example 4 with HyperiumPurchase

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

the class CosmeticHat method onPlayerRender.

@InvokeEvent
public void onPlayerRender(RenderPlayerEvent e) {
    Minecraft mc = Minecraft.getMinecraft();
    AbstractClientPlayer player = e.getEntity();
    if (CosmeticsUtil.shouldHide(getPurchaseType()))
        return;
    if (isPurchasedBy(player.getUniqueID()) && !player.isInvisible()) {
        HyperiumPurchase packageIfReady = PurchaseApi.getInstance().getPackageIfReady(player.getUniqueID());
        if (packageIfReady.getCachedSettings().getCurrentHatType() != getPurchaseType())
            return;
        GlStateManager.pushMatrix();
        GlStateManager.translate(e.getX(), e.getY(), e.getZ());
        double scale = 1.0F;
        double rotate = interpolate(player.prevRotationYawHead, player.rotationYawHead, e.getPartialTicks());
        double rotate1 = interpolate(player.prevRotationPitch, player.rotationPitch, e.getPartialTicks());
        GL11.glScaled(-scale, -scale, scale);
        GL11.glTranslated(0.0, -((player.height - (player.isSneaking() ? .25 : 0)) - .38) / scale, 0.0);
        GL11.glRotated(180.0 + rotate, 0.0, 1.0, 0.0);
        GL11.glRotated(rotate1, 1.0D, 0.0D, 0.0D);
        GlStateManager.translate(0, -.45, 0);
        /* Bind the hat texture and render the model */
        mc.getTextureManager().bindTexture(hatTexture);
        hatModel.render(player, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
        GlStateManager.popMatrix();
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase) Minecraft(net.minecraft.client.Minecraft) InvokeEvent(cc.hyperium.event.InvokeEvent)

Example 5 with HyperiumPurchase

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

the class ParticleGui method drawScreen.

@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
    if (queueBuild) {
        queueBuild = false;
        rebuild();
    }
    GlStateManager.scale(2.0, 2.0, 2.0);
    HyperiumPurchase self = PurchaseApi.getInstance().getSelf();
    if (self != null)
        credits = self.getResponse().optInt("remaining_credits");
    String s = I18n.format("gui.cosmetics.credits") + ": " + credits;
    fontRendererObj.drawString(s, (ResolutionUtil.current().getScaledWidth() >> 2) - (fontRendererObj.getStringWidth(s) >> 1), 15, Color.MAGENTA.getRGB(), true);
    GlStateManager.scale(.5, .5, .5);
    s = I18n.format("gui.cosmetics.line1");
    fontRendererObj.drawString(s, (ResolutionUtil.current().getScaledWidth() >> 1) - (fontRendererObj.getStringWidth(s) >> 1), 50, Color.MAGENTA.getRGB(), true);
    s = I18n.format("gui.cosmetics.line2");
    fontRendererObj.drawString(s, (ResolutionUtil.current().getScaledWidth() >> 1) - (fontRendererObj.getStringWidth(s) >> 1), 61, Color.MAGENTA.getRGB(), true);
    s = I18n.format("gui.cosmetics.preview");
    GlStateManager.scale(2.0, 2.0, 2.0);
    int stringWidth = fontRendererObj.getStringWidth(s);
    int x1 = ResolutionUtil.current().getScaledWidth() / 4 - stringWidth / 4;
    int y1 = ResolutionUtil.current().getScaledHeight() / 4;
    fontRendererObj.drawString(s, x1, y1, Color.MAGENTA.getRGB(), true);
    GlStateManager.scale(.5, .5, .5);
    previewBlock = new GuiBlock(x1 * 2, x1 * 2 + stringWidth * 2, y1 * 2, y1 * 2 + 20);
    super.drawScreen(mouseX, mouseY, partialTicks);
    ScaledResolution current = ResolutionUtil.current();
    particleType.render(current.getScaledWidth() / 5, current.getScaledHeight() / 2, mouseX, mouseY);
    particleAnimation.render(current.getScaledWidth() * 4 / 5, current.getScaledHeight() / 2, mouseX, mouseY);
    if (overlay != null)
        overlay.render(mouseX, mouseY, width, height);
}
Also used : ScaledResolution(net.minecraft.client.gui.ScaledResolution) HyperiumPurchase(cc.hyperium.purchases.HyperiumPurchase)

Aggregations

HyperiumPurchase (cc.hyperium.purchases.HyperiumPurchase)15 InvokeEvent (cc.hyperium.event.InvokeEvent)8 JsonHolder (cc.hyperium.utils.JsonHolder)5 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 PurchaseLoadEvent (cc.hyperium.event.network.PurchaseLoadEvent)2 EnumParticleType (cc.hyperium.handlers.handlers.particle.EnumParticleType)2 NettyClient (cc.hyperium.netty.NettyClient)2 AbstractHyperiumPurchase (cc.hyperium.purchases.AbstractHyperiumPurchase)2 PurchaseApi (cc.hyperium.purchases.PurchaseApi)2 IOException (java.io.IOException)2 Minecraft (net.minecraft.client.Minecraft)2 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)2 GuiButton (net.minecraft.client.gui.GuiButton)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 ResourceLocation (net.minecraft.util.ResourceLocation)2 Hyperium (cc.hyperium.Hyperium)1 EventBus (cc.hyperium.event.EventBus)1 CarouselItem (cc.hyperium.gui.carousel.CarouselItem)1 PurchaseCarousel (cc.hyperium.gui.carousel.PurchaseCarousel)1 HyperiumOverlay (cc.hyperium.gui.main.HyperiumOverlay)1