ModelWolf .java

net.minecraft.client.model.ModelWolf (class): members: wolfHeadMain, wolfBody, wolfLeg1, wolfLeg2, wolfLeg3, wolfLeg4, wolfMane, wolfTail, render.

net.minecraft.client.modelclass178 linesclientextends ModelBase7.9 KB

API Surface (3)

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 setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)

Fields & Constants (8)

wolfHeadMain
wolfBody
wolfLeg1
wolfLeg2
wolfLeg3
wolfLeg4
wolfTail
wolfMane

Code Graph: Dependencies (7)

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

Full Source

ModelWolf.java178 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.entity.EntityLivingBase;
6
import net.minecraft.entity.passive.EntityWolf;
7
import net.minecraft.util.MathHelper;
8
9
public class ModelWolf extends ModelBase
10
{
11
    /** main box for the wolf head */
12
    public ModelRenderer wolfHeadMain;
13
14
    /** The wolf's body */
15
    public ModelRenderer wolfBody;
16
17
    /** Wolf'se first leg */
18
    public ModelRenderer wolfLeg1;
19
20
    /** Wolf's second leg */
21
    public ModelRenderer wolfLeg2;
22
23
    /** Wolf's third leg */
24
    public ModelRenderer wolfLeg3;
25
26
    /** Wolf's fourth leg */
27
    public ModelRenderer wolfLeg4;
28
29
    /** The wolf's tail */
30
    ModelRenderer wolfTail;
31
32
    /** The wolf's mane */
33
    ModelRenderer wolfMane;
34
35
    public ModelWolf()
36
    {
37
        float f = 0.0F;
38
        float f1 = 13.5F;
39
        this.wolfHeadMain = new ModelRenderer(this, 0, 0);
40
        this.wolfHeadMain.addBox(-3.0F, -3.0F, -2.0F, 6, 6, 4, f);
41
        this.wolfHeadMain.setRotationPoint(-1.0F, f1, -7.0F);
42
        this.wolfBody = new ModelRenderer(this, 18, 14);
43
        this.wolfBody.addBox(-4.0F, -2.0F, -3.0F, 6, 9, 6, f);
44
        this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F);
45
        this.wolfMane = new ModelRenderer(this, 21, 0);
46
        this.wolfMane.addBox(-4.0F, -3.0F, -3.0F, 8, 6, 7, f);
47
        this.wolfMane.setRotationPoint(-1.0F, 14.0F, 2.0F);
48
        this.wolfLeg1 = new ModelRenderer(this, 0, 18);
49
        this.wolfLeg1.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
50
        this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
51
        this.wolfLeg2 = new ModelRenderer(this, 0, 18);
52
        this.wolfLeg2.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
53
        this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
54
        this.wolfLeg3 = new ModelRenderer(this, 0, 18);
55
        this.wolfLeg3.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
56
        this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
57
        this.wolfLeg4 = new ModelRenderer(this, 0, 18);
58
        this.wolfLeg4.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
59
        this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
60
        this.wolfTail = new ModelRenderer(this, 9, 18);
61
        this.wolfTail.addBox(-1.0F, 0.0F, -1.0F, 2, 8, 2, f);
62
        this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
63
        this.wolfHeadMain.setTextureOffset(16, 14).addBox(-3.0F, -5.0F, 0.0F, 2, 2, 1, f);
64
        this.wolfHeadMain.setTextureOffset(16, 14).addBox(1.0F, -5.0F, 0.0F, 2, 2, 1, f);
65
        this.wolfHeadMain.setTextureOffset(0, 10).addBox(-1.5F, 0.0F, -5.0F, 3, 3, 4, f);
66
    }
67
68
    /**
69
     * Sets the models various rotation angles then renders the model.
70
     */
71
    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)
72
    {
73
        super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale);
74
        this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
75
76
        if (this.isChild)
77
        {
78
            float f = 2.0F;
79
            GlStateManager.pushMatrix();
80
            GlStateManager.translate(0.0F, 5.0F * scale, 2.0F * scale);
81
            this.wolfHeadMain.renderWithRotation(scale);
82
            GlStateManager.popMatrix();
83
            GlStateManager.pushMatrix();
84
            GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
85
            GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
86
            this.wolfBody.render(scale);
87
            this.wolfLeg1.render(scale);
88
            this.wolfLeg2.render(scale);
89
            this.wolfLeg3.render(scale);
90
            this.wolfLeg4.render(scale);
91
            this.wolfTail.renderWithRotation(scale);
92
            this.wolfMane.render(scale);
93
            GlStateManager.popMatrix();
94
        }
95
        else
96
        {
97
            this.wolfHeadMain.renderWithRotation(scale);
98
            this.wolfBody.render(scale);
99
            this.wolfLeg1.render(scale);
100
            this.wolfLeg2.render(scale);
101
            this.wolfLeg3.render(scale);
102
            this.wolfLeg4.render(scale);
103
            this.wolfTail.renderWithRotation(scale);
104
            this.wolfMane.render(scale);
105
        }
106
    }
107
108
    /**
109
     * Used for easily adding entity-dependent animations. The second and third float params here are the same second
110
     * and third as in the setRotationAngles method.
111
     */
112
    public void setLivingAnimations(EntityLivingBase entitylivingbaseIn, float p_78086_2_, float p_78086_3_, float partialTickTime)
113
    {
114
        EntityWolf entitywolf = (EntityWolf)entitylivingbaseIn;
115
116
        if (entitywolf.isAngry())
117
        {
118
            this.wolfTail.rotateAngleY = 0.0F;
119
        }
120
        else
121
        {
122
            this.wolfTail.rotateAngleY = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_;
123
        }
124
125
        if (entitywolf.isSitting())
126
        {
127
            this.wolfMane.setRotationPoint(-1.0F, 16.0F, -3.0F);
128
            this.wolfMane.rotateAngleX = ((float)Math.PI * 2F / 5F);
129
            this.wolfMane.rotateAngleY = 0.0F;
130
            this.wolfBody.setRotationPoint(0.0F, 18.0F, 0.0F);
131
            this.wolfBody.rotateAngleX = ((float)Math.PI / 4F);
132
            this.wolfTail.setRotationPoint(-1.0F, 21.0F, 6.0F);
133
            this.wolfLeg1.setRotationPoint(-2.5F, 22.0F, 2.0F);
134
            this.wolfLeg1.rotateAngleX = ((float)Math.PI * 3F / 2F);
135
            this.wolfLeg2.setRotationPoint(0.5F, 22.0F, 2.0F);
136
            this.wolfLeg2.rotateAngleX = ((float)Math.PI * 3F / 2F);
137
            this.wolfLeg3.rotateAngleX = 5.811947F;
138
            this.wolfLeg3.setRotationPoint(-2.49F, 17.0F, -4.0F);
139
            this.wolfLeg4.rotateAngleX = 5.811947F;
140
            this.wolfLeg4.setRotationPoint(0.51F, 17.0F, -4.0F);
141
        }
142
        else
143
        {
144
            this.wolfBody.setRotationPoint(0.0F, 14.0F, 2.0F);
145
            this.wolfBody.rotateAngleX = ((float)Math.PI / 2F);
146
            this.wolfMane.setRotationPoint(-1.0F, 14.0F, -3.0F);
147
            this.wolfMane.rotateAngleX = this.wolfBody.rotateAngleX;
148
            this.wolfTail.setRotationPoint(-1.0F, 12.0F, 8.0F);
149
            this.wolfLeg1.setRotationPoint(-2.5F, 16.0F, 7.0F);
150
            this.wolfLeg2.setRotationPoint(0.5F, 16.0F, 7.0F);
151
            this.wolfLeg3.setRotationPoint(-2.5F, 16.0F, -4.0F);
152
            this.wolfLeg4.setRotationPoint(0.5F, 16.0F, -4.0F);
153
            this.wolfLeg1.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_;
154
            this.wolfLeg2.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI) * 1.4F * p_78086_3_;
155
            this.wolfLeg3.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F + (float)Math.PI) * 1.4F * p_78086_3_;
156
            this.wolfLeg4.rotateAngleX = MathHelper.cos(p_78086_2_ * 0.6662F) * 1.4F * p_78086_3_;
157
        }
158
159
        this.wolfHeadMain.rotateAngleZ = entitywolf.getInterestedAngle(partialTickTime) + entitywolf.getShakeAngle(partialTickTime, 0.0F);
160
        this.wolfMane.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.08F);
161
        this.wolfBody.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.16F);
162
        this.wolfTail.rotateAngleZ = entitywolf.getShakeAngle(partialTickTime, -0.2F);
163
    }
164
165
    /**
166
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
167
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
168
     * "far" arms and legs can swing at most.
169
     */
170
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
171
    {
172
        super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
173
        this.wolfHeadMain.rotateAngleX = headPitch / (180F / (float)Math.PI);
174
        this.wolfHeadMain.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
175
        this.wolfTail.rotateAngleX = ageInTicks;
176
    }
177
}
178

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