LayerCape .java

net.minecraft.client.renderer.entity.layers.LayerCape (class): members: playerRenderer, shouldCombineTextures, doRenderLayer. imports: RenderPlayer.

net.minecraft.client.renderer.entity.layersclass64 linesclient3.5 KB

Implements

API Surface (2)

void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
boolean shouldCombineTextures()

Fields & Constants (1)

playerRenderer

Code Graph: Dependencies (6)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

LayerCape.java64 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.renderer.entity.layers;
2
3
import net.minecraft.client.entity.AbstractClientPlayer;
4
import net.minecraft.client.renderer.GlStateManager;
5
import net.minecraft.client.renderer.entity.RenderPlayer;
6
import net.minecraft.entity.player.EnumPlayerModelParts;
7
import net.minecraft.util.MathHelper;
8
9
public class LayerCape implements LayerRenderer<AbstractClientPlayer>
10
{
11
    private final RenderPlayer playerRenderer;
12
13
    public LayerCape(RenderPlayer playerRendererIn)
14
    {
15
        this.playerRenderer = playerRendererIn;
16
    }
17
18
    public void doRenderLayer(AbstractClientPlayer entitylivingbaseIn, float p_177141_2_, float p_177141_3_, float partialTicks, float p_177141_5_, float p_177141_6_, float p_177141_7_, float scale)
19
    {
20
        if (entitylivingbaseIn.hasPlayerInfo() && !entitylivingbaseIn.isInvisible() && entitylivingbaseIn.isWearing(EnumPlayerModelParts.CAPE) && entitylivingbaseIn.getLocationCape() != null)
21
        {
22
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
23
            this.playerRenderer.bindTexture(entitylivingbaseIn.getLocationCape());
24
            GlStateManager.pushMatrix();
25
            GlStateManager.translate(0.0F, 0.0F, 0.125F);
26
            double d0 = entitylivingbaseIn.prevChasingPosX + (entitylivingbaseIn.chasingPosX - entitylivingbaseIn.prevChasingPosX) * (double)partialTicks - (entitylivingbaseIn.prevPosX + (entitylivingbaseIn.posX - entitylivingbaseIn.prevPosX) * (double)partialTicks);
27
            double d1 = entitylivingbaseIn.prevChasingPosY + (entitylivingbaseIn.chasingPosY - entitylivingbaseIn.prevChasingPosY) * (double)partialTicks - (entitylivingbaseIn.prevPosY + (entitylivingbaseIn.posY - entitylivingbaseIn.prevPosY) * (double)partialTicks);
28
            double d2 = entitylivingbaseIn.prevChasingPosZ + (entitylivingbaseIn.chasingPosZ - entitylivingbaseIn.prevChasingPosZ) * (double)partialTicks - (entitylivingbaseIn.prevPosZ + (entitylivingbaseIn.posZ - entitylivingbaseIn.prevPosZ) * (double)partialTicks);
29
            float f = entitylivingbaseIn.prevRenderYawOffset + (entitylivingbaseIn.renderYawOffset - entitylivingbaseIn.prevRenderYawOffset) * partialTicks;
30
            double d3 = (double)MathHelper.sin(f * (float)Math.PI / 180.0F);
31
            double d4 = (double)(-MathHelper.cos(f * (float)Math.PI / 180.0F));
32
            float f1 = (float)d1 * 10.0F;
33
            f1 = MathHelper.clamp_float(f1, -6.0F, 32.0F);
34
            float f2 = (float)(d0 * d3 + d2 * d4) * 100.0F;
35
            float f3 = (float)(d0 * d4 - d2 * d3) * 100.0F;
36
37
            if (f2 < 0.0F)
38
            {
39
                f2 = 0.0F;
40
            }
41
42
            float f4 = entitylivingbaseIn.prevCameraYaw + (entitylivingbaseIn.cameraYaw - entitylivingbaseIn.prevCameraYaw) * partialTicks;
43
            f1 = f1 + MathHelper.sin((entitylivingbaseIn.prevDistanceWalkedModified + (entitylivingbaseIn.distanceWalkedModified - entitylivingbaseIn.prevDistanceWalkedModified) * partialTicks) * 6.0F) * 32.0F * f4;
44
45
            if (entitylivingbaseIn.isSneaking())
46
            {
47
                f1 += 25.0F;
48
            }
49
50
            GlStateManager.rotate(6.0F + f2 / 2.0F + f1, 1.0F, 0.0F, 0.0F);
51
            GlStateManager.rotate(f3 / 2.0F, 0.0F, 0.0F, 1.0F);
52
            GlStateManager.rotate(-f3 / 2.0F, 0.0F, 1.0F, 0.0F);
53
            GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
54
            this.playerRenderer.getMainModel().renderCape(0.0625F);
55
            GlStateManager.popMatrix();
56
        }
57
    }
58
59
    public boolean shouldCombineTextures()
60
    {
61
        return false;
62
    }
63
}
64

Deobfuscated MCP 1.8.9 source of LayerCape from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/renderer/entity/layers/LayerCape.java), stored verbatim.