ModelVillager .java

net.minecraft.client.model.ModelVillager (class, 87 lines): members: rightVillagerLeg, leftVillagerLeg, villagerArms, villagerBody, villagerHead, render.

net.minecraft.client.modelclass87 linesclientextends ModelBase4.4 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 (6)

villagerHead
villagerBody
villagerArms
rightVillagerLeg
leftVillagerLeg
villagerNose

Code Graph: Dependencies (4)

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

Full Source

ModelVillager.java87 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.model;
2
3
import net.minecraft.entity.Entity;
4
import net.minecraft.util.MathHelper;
5
6
public class ModelVillager extends ModelBase
7
{
8
    /** The head box of the VillagerModel */
9
    public ModelRenderer villagerHead;
10
11
    /** The body of the VillagerModel */
12
    public ModelRenderer villagerBody;
13
14
    /** The arms of the VillagerModel */
15
    public ModelRenderer villagerArms;
16
17
    /** The right leg of the VillagerModel */
18
    public ModelRenderer rightVillagerLeg;
19
20
    /** The left leg of the VillagerModel */
21
    public ModelRenderer leftVillagerLeg;
22
    public ModelRenderer villagerNose;
23
24
    public ModelVillager(float p_i1163_1_)
25
    {
26
        this(p_i1163_1_, 0.0F, 64, 64);
27
    }
28
29
    public ModelVillager(float p_i1164_1_, float p_i1164_2_, int p_i1164_3_, int p_i1164_4_)
30
    {
31
        this.villagerHead = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_);
32
        this.villagerHead.setRotationPoint(0.0F, 0.0F + p_i1164_2_, 0.0F);
33
        this.villagerHead.setTextureOffset(0, 0).addBox(-4.0F, -10.0F, -4.0F, 8, 10, 8, p_i1164_1_);
34
        this.villagerNose = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_);
35
        this.villagerNose.setRotationPoint(0.0F, p_i1164_2_ - 2.0F, 0.0F);
36
        this.villagerNose.setTextureOffset(24, 0).addBox(-1.0F, -1.0F, -6.0F, 2, 4, 2, p_i1164_1_);
37
        this.villagerHead.addChild(this.villagerNose);
38
        this.villagerBody = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_);
39
        this.villagerBody.setRotationPoint(0.0F, 0.0F + p_i1164_2_, 0.0F);
40
        this.villagerBody.setTextureOffset(16, 20).addBox(-4.0F, 0.0F, -3.0F, 8, 12, 6, p_i1164_1_);
41
        this.villagerBody.setTextureOffset(0, 38).addBox(-4.0F, 0.0F, -3.0F, 8, 18, 6, p_i1164_1_ + 0.5F);
42
        this.villagerArms = (new ModelRenderer(this)).setTextureSize(p_i1164_3_, p_i1164_4_);
43
        this.villagerArms.setRotationPoint(0.0F, 0.0F + p_i1164_2_ + 2.0F, 0.0F);
44
        this.villagerArms.setTextureOffset(44, 22).addBox(-8.0F, -2.0F, -2.0F, 4, 8, 4, p_i1164_1_);
45
        this.villagerArms.setTextureOffset(44, 22).addBox(4.0F, -2.0F, -2.0F, 4, 8, 4, p_i1164_1_);
46
        this.villagerArms.setTextureOffset(40, 38).addBox(-4.0F, 2.0F, -2.0F, 8, 4, 4, p_i1164_1_);
47
        this.rightVillagerLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(p_i1164_3_, p_i1164_4_);
48
        this.rightVillagerLeg.setRotationPoint(-2.0F, 12.0F + p_i1164_2_, 0.0F);
49
        this.rightVillagerLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1164_1_);
50
        this.leftVillagerLeg = (new ModelRenderer(this, 0, 22)).setTextureSize(p_i1164_3_, p_i1164_4_);
51
        this.leftVillagerLeg.mirror = true;
52
        this.leftVillagerLeg.setRotationPoint(2.0F, 12.0F + p_i1164_2_, 0.0F);
53
        this.leftVillagerLeg.addBox(-2.0F, 0.0F, -2.0F, 4, 12, 4, p_i1164_1_);
54
    }
55
56
    /**
57
     * Sets the models various rotation angles then renders the model.
58
     */
59
    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)
60
    {
61
        this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
62
        this.villagerHead.render(scale);
63
        this.villagerBody.render(scale);
64
        this.rightVillagerLeg.render(scale);
65
        this.leftVillagerLeg.render(scale);
66
        this.villagerArms.render(scale);
67
    }
68
69
    /**
70
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
71
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
72
     * "far" arms and legs can swing at most.
73
     */
74
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
75
    {
76
        this.villagerHead.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
77
        this.villagerHead.rotateAngleX = headPitch / (180F / (float)Math.PI);
78
        this.villagerArms.rotationPointY = 3.0F;
79
        this.villagerArms.rotationPointZ = -1.0F;
80
        this.villagerArms.rotateAngleX = -0.75F;
81
        this.rightVillagerLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F) * 1.4F * limbSwingAmount * 0.5F;
82
        this.leftVillagerLeg.rotateAngleX = MathHelper.cos(limbSwing * 0.6662F + (float)Math.PI) * 1.4F * limbSwingAmount * 0.5F;
83
        this.rightVillagerLeg.rotateAngleY = 0.0F;
84
        this.leftVillagerLeg.rotateAngleY = 0.0F;
85
    }
86
}
87

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