ModelArmorStand .java

net.minecraft.client.model.ModelArmorStand (class, 134 lines): members: standRightSide, standLeftSide, standWaist, standBase, postRenderArm, render.

net.minecraft.client.modelclass134 linesclientextends ModelArmorStandArmor6.5 KB

API Surface (3)

void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
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 postRenderArm(float scale)

Fields & Constants (4)

standRightSide
standLeftSide
standWaist
standBase

Code Graph: Dependencies (5)

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

Full Source

ModelArmorStand.java134 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.item.EntityArmorStand;
6
7
public class ModelArmorStand extends ModelArmorStandArmor
8
{
9
    public ModelRenderer standRightSide;
10
    public ModelRenderer standLeftSide;
11
    public ModelRenderer standWaist;
12
    public ModelRenderer standBase;
13
14
    public ModelArmorStand()
15
    {
16
        this(0.0F);
17
    }
18
19
    public ModelArmorStand(float p_i46306_1_)
20
    {
21
        super(p_i46306_1_, 64, 64);
22
        this.bipedHead = new ModelRenderer(this, 0, 0);
23
        this.bipedHead.addBox(-1.0F, -7.0F, -1.0F, 2, 7, 2, p_i46306_1_);
24
        this.bipedHead.setRotationPoint(0.0F, 0.0F, 0.0F);
25
        this.bipedBody = new ModelRenderer(this, 0, 26);
26
        this.bipedBody.addBox(-6.0F, 0.0F, -1.5F, 12, 3, 3, p_i46306_1_);
27
        this.bipedBody.setRotationPoint(0.0F, 0.0F, 0.0F);
28
        this.bipedRightArm = new ModelRenderer(this, 24, 0);
29
        this.bipedRightArm.addBox(-2.0F, -2.0F, -1.0F, 2, 12, 2, p_i46306_1_);
30
        this.bipedRightArm.setRotationPoint(-5.0F, 2.0F, 0.0F);
31
        this.bipedLeftArm = new ModelRenderer(this, 32, 16);
32
        this.bipedLeftArm.mirror = true;
33
        this.bipedLeftArm.addBox(0.0F, -2.0F, -1.0F, 2, 12, 2, p_i46306_1_);
34
        this.bipedLeftArm.setRotationPoint(5.0F, 2.0F, 0.0F);
35
        this.bipedRightLeg = new ModelRenderer(this, 8, 0);
36
        this.bipedRightLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, p_i46306_1_);
37
        this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
38
        this.bipedLeftLeg = new ModelRenderer(this, 40, 16);
39
        this.bipedLeftLeg.mirror = true;
40
        this.bipedLeftLeg.addBox(-1.0F, 0.0F, -1.0F, 2, 11, 2, p_i46306_1_);
41
        this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
42
        this.standRightSide = new ModelRenderer(this, 16, 0);
43
        this.standRightSide.addBox(-3.0F, 3.0F, -1.0F, 2, 7, 2, p_i46306_1_);
44
        this.standRightSide.setRotationPoint(0.0F, 0.0F, 0.0F);
45
        this.standRightSide.showModel = true;
46
        this.standLeftSide = new ModelRenderer(this, 48, 16);
47
        this.standLeftSide.addBox(1.0F, 3.0F, -1.0F, 2, 7, 2, p_i46306_1_);
48
        this.standLeftSide.setRotationPoint(0.0F, 0.0F, 0.0F);
49
        this.standWaist = new ModelRenderer(this, 0, 48);
50
        this.standWaist.addBox(-4.0F, 10.0F, -1.0F, 8, 2, 2, p_i46306_1_);
51
        this.standWaist.setRotationPoint(0.0F, 0.0F, 0.0F);
52
        this.standBase = new ModelRenderer(this, 0, 32);
53
        this.standBase.addBox(-6.0F, 11.0F, -6.0F, 12, 1, 12, p_i46306_1_);
54
        this.standBase.setRotationPoint(0.0F, 12.0F, 0.0F);
55
    }
56
57
    /**
58
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
59
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
60
     * "far" arms and legs can swing at most.
61
     */
62
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
63
    {
64
        super.setRotationAngles(limbSwing, limbSwingAmount, ageInTicks, netHeadYaw, headPitch, scaleFactor, entityIn);
65
66
        if (entityIn instanceof EntityArmorStand)
67
        {
68
            EntityArmorStand entityarmorstand = (EntityArmorStand)entityIn;
69
            this.bipedLeftArm.showModel = entityarmorstand.getShowArms();
70
            this.bipedRightArm.showModel = entityarmorstand.getShowArms();
71
            this.standBase.showModel = !entityarmorstand.hasNoBasePlate();
72
            this.bipedLeftLeg.setRotationPoint(1.9F, 12.0F, 0.0F);
73
            this.bipedRightLeg.setRotationPoint(-1.9F, 12.0F, 0.0F);
74
            this.standRightSide.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
75
            this.standRightSide.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
76
            this.standRightSide.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
77
            this.standLeftSide.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
78
            this.standLeftSide.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
79
            this.standLeftSide.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
80
            this.standWaist.rotateAngleX = 0.017453292F * entityarmorstand.getBodyRotation().getX();
81
            this.standWaist.rotateAngleY = 0.017453292F * entityarmorstand.getBodyRotation().getY();
82
            this.standWaist.rotateAngleZ = 0.017453292F * entityarmorstand.getBodyRotation().getZ();
83
            float f = (entityarmorstand.getLeftLegRotation().getX() + entityarmorstand.getRightLegRotation().getX()) / 2.0F;
84
            float f1 = (entityarmorstand.getLeftLegRotation().getY() + entityarmorstand.getRightLegRotation().getY()) / 2.0F;
85
            float f2 = (entityarmorstand.getLeftLegRotation().getZ() + entityarmorstand.getRightLegRotation().getZ()) / 2.0F;
86
            this.standBase.rotateAngleX = 0.0F;
87
            this.standBase.rotateAngleY = 0.017453292F * -entityIn.rotationYaw;
88
            this.standBase.rotateAngleZ = 0.0F;
89
        }
90
    }
91
92
    /**
93
     * Sets the models various rotation angles then renders the model.
94
     */
95
    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)
96
    {
97
        super.render(entityIn, p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale);
98
        GlStateManager.pushMatrix();
99
100
        if (this.isChild)
101
        {
102
            float f = 2.0F;
103
            GlStateManager.scale(1.0F / f, 1.0F / f, 1.0F / f);
104
            GlStateManager.translate(0.0F, 24.0F * scale, 0.0F);
105
            this.standRightSide.render(scale);
106
            this.standLeftSide.render(scale);
107
            this.standWaist.render(scale);
108
            this.standBase.render(scale);
109
        }
110
        else
111
        {
112
            if (entityIn.isSneaking())
113
            {
114
                GlStateManager.translate(0.0F, 0.2F, 0.0F);
115
            }
116
117
            this.standRightSide.render(scale);
118
            this.standLeftSide.render(scale);
119
            this.standWaist.render(scale);
120
            this.standBase.render(scale);
121
        }
122
123
        GlStateManager.popMatrix();
124
    }
125
126
    public void postRenderArm(float scale)
127
    {
128
        boolean flag = this.bipedRightArm.showModel;
129
        this.bipedRightArm.showModel = true;
130
        super.postRenderArm(scale);
131
        this.bipedRightArm.showModel = flag;
132
    }
133
}
134

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