Search in sources :

Example 1 with RenderPlayerSP

use of com.tntmodders.takumi.client.render.sp.RenderPlayerSP in project takumicraft by TNTModders.

the class TakumiClientEvents method renderPlayer.

@SubscribeEvent
public void renderPlayer(Pre event) {
    if (TakumiUtils.isApril(Minecraft.getMinecraft().world) && (event.getRenderer() instanceof RenderPlayer && !(event.getRenderer() instanceof RenderPlayerSP)) && event.getEntity() instanceof AbstractClientPlayer) {
        event.setCanceled(true);
        RenderPlayerSP sp = new RenderPlayerSP(event.getRenderer().getRenderManager());
        sp.doRender(((AbstractClientPlayer) event.getEntity()), event.getX(), event.getY(), event.getZ(), ((AbstractClientPlayer) event.getEntity()).rotationYaw, event.getPartialRenderTick());
    }
    if (event.getEntity().isPotionActive(TakumiPotionCore.INVERSION)) {
        GlStateManager.popMatrix();
        GlStateManager.rotate(180, 1, 0, 0);
        GlStateManager.translate(0, -1.9, 0);
    }
    if (event.getEntity().isPotionActive(TakumiPotionCore.CREEPERED)) {
        GlStateManager.popMatrix();
        float f = this.getCreeperFlashIntensity(event.getEntity(), event.getPartialRenderTick());
        if (f > 0) {
            float f1 = 1.0F + MathHelper.sin(f * 100.0F) * f * 0.01F;
            f = MathHelper.clamp(f, 0.0F, 1.0F);
            f = f * f;
            f = f * f;
            float f2 = (1.0F + f * 0.4F) * f1;
            float f3 = (1.0F + f * 0.1F) / f1;
            GlStateManager.scale(f2, f3, f2);
        }
    }
}
Also used : AbstractClientPlayer(net.minecraft.client.entity.AbstractClientPlayer) RenderPlayerSP(com.tntmodders.takumi.client.render.sp.RenderPlayerSP) RenderPlayer(net.minecraft.client.renderer.entity.RenderPlayer) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

RenderPlayerSP (com.tntmodders.takumi.client.render.sp.RenderPlayerSP)1 AbstractClientPlayer (net.minecraft.client.entity.AbstractClientPlayer)1 RenderPlayer (net.minecraft.client.renderer.entity.RenderPlayer)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1