ModelChicken .java

net.minecraft.client.model.ModelChicken (class): members: rightWing, leftWing, rightLeg, leftLeg, bill, chin, body, head, setRotationAngles, render.

net.minecraft.client.modelclass106 linesclientextends ModelBase4.5 KB

API Surface (2)

void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)

Fields & Constants (8)

head
body
rightLeg
leftLeg
rightWing
leftWing
bill
chin

Code Graph: Dependencies (5)

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

Full Source

ModelChicken.java106 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.model;
2
3
import net.minecraft.client.renderer.GlStateManager;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.util.MathHelper;
6
7
public class ModelChicken extends ModelBase
8
{
9
    public ModelRenderer head;
10
    public ModelRenderer body;
11
    public ModelRenderer rightLeg;
12
    public ModelRenderer leftLeg;
13
    public ModelRenderer rightWing;
14
    public ModelRenderer leftWing;
15
    public ModelRenderer bill;
16
    public ModelRenderer chin;
17
18
    public ModelChicken()
19
    {
20
        int i = 16;
21
        this.head = new ModelRenderer(this, 0, 0);
22
        this.head.addBox(-2.0F, -6.0F, -2.0F, 4, 6, 3, 0.0F);
23
        this.head.setRotationPoint(0.0F, (float)(-1 + i), -4.0F);
24
        this.bill = new ModelRenderer(this, 14, 0);
25
        this.bill.addBox(-2.0F, -4.0F, -4.0F, 4, 2, 2, 0.0F);
26
        this.bill.setRotationPoint(0.0F, (float)(-1 + i), -4.0F);
27
        this.chin = new ModelRenderer(this, 14, 4);
28
        this.chin.addBox(-1.0F, -2.0F, -3.0F, 2, 2, 2, 0.0F);
29
        this.chin.setRotationPoint(0.0F, (float)(-1 + i), -4.0F);
30
        this.body = new ModelRenderer(this, 0, 9);
31
        this.body.addBox(-3.0F, -4.0F, -3.0F, 6, 8, 6, 0.0F);
32
        this.body.setRotationPoint(0.0F, (float)i, 0.0F);
33
        this.rightLeg = new ModelRenderer(this, 26, 0);
34
        this.rightLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3);
35
        this.rightLeg.setRotationPoint(-2.0F, (float)(3 + i), 1.0F);
36
        this.leftLeg = new ModelRenderer(this, 26, 0);
37
        this.leftLeg.addBox(-1.0F, 0.0F, -3.0F, 3, 5, 3);
38
        this.leftLeg.setRotationPoint(1.0F, (float)(3 + i), 1.0F);
39
        this.rightWing = new ModelRenderer(this, 24, 13);
40
        this.rightWing.addBox(0.0F, 0.0F, -3.0F, 1, 4, 6);
41
        this.rightWing.setRotationPoint(-4.0F, (float)(-3 + i), 0.0F);
42
        this.leftWing = new ModelRenderer(this, 24, 13);
43
        this.leftWing.addBox(-1.0F, 0.0F, -3.0F, 1, 4, 6);
44
        this.leftWing.setRotationPoint(4.0F, (float)(-3 + i), 0.0F);
45
    }
46
47
    /**
48
     * Sets the models various rotation angles then renders the model.
49
     */
50
    public void render(Entity entityIn, float p_78088_2_, float p_78088_3_, float p_78088_4_, float p_78088_5_, float p_78088_6_, float scale)
51
    {
52
        this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
53
54
        if (this.isChild)
55
        {
56
            float f = 2.0F;
57
            GlStateManager.pushMatrix();
58
            GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale);
59
            this.head.render(scale);
60
            this.bill.render(scale);
61
            this.chin.render(scale);
62
            GlStateManager.popMatrix();
63
            GlStateManager.pushMatrix();
64
            GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
65
            GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
66
            this.body.render(scale);
67
            this.rightLeg.render(scale);
68
            this.leftLeg.render(scale);
69
            this.rightWing.render(scale);
70
            this.leftWing.render(scale);
71
            GlStateManager.popMatrix();
72
        }
73
        else
74
        {
75
            this.head.render(scale);
76
            this.bill.render(scale);
77
            this.chin.render(scale);
78
            this.body.render(scale);
79
            this.rightLeg.render(scale);
80
            this.leftLeg.render(scale);
81
            this.rightWing.render(scale);
82
            this.leftWing.render(scale);
83
        }
84
    }
85
86
    /**
87
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
88
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
89
     * "far" arms and legs can swing at most.
90
     */
91
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
92
    {
93
        this.head.rotateAngleX = headPitch / (180F / (float)Math.PI);
94
        this.head.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
95
        this.bill.rotateAngleX = this.head.rotateAngleX;
96
        this.bill.rotateAngleY = this.head.rotateAngleY;
97
        this.chin.rotateAngleX = this.head.rotateAngleX;
98
        this.chin.rotateAngleY = this.head.rotateAngleY;
99
        this.body.rotateAngleX = ((float)Math.PI / 2F);
100
        this.rightLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount;
101
        this.leftLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount;
102
        this.rightWing.rotateAngleZ = ageInTicks;
103
        this.leftWing.rotateAngleZ = -ageInTicks;
104
    }
105
}
106

Deobfuscated MCP 1.8.9 source of ModelChicken from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/model/ModelChicken.java), stored verbatim.