ModelSpider .java

net.minecraft.client.model.ModelSpider (class): members: spiderBody, spiderHead, spiderLeg1, spiderLeg2, spiderLeg3, spiderLeg4, spiderLeg5, spiderLeg6.

net.minecraft.client.modelclass153 linesclientextends ModelBase6.8 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 (11)

spiderHead
spiderNeck
spiderBody
spiderLeg1
spiderLeg2
spiderLeg3
spiderLeg4
spiderLeg5
spiderLeg6
spiderLeg7
spiderLeg8

Code Graph: Dependencies (4)

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

Full Source

ModelSpider.java153 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 ModelSpider extends ModelBase
7
{
8
    /** The spider's head box */
9
    public ModelRenderer spiderHead;
10
11
    /** The spider's neck box */
12
    public ModelRenderer spiderNeck;
13
14
    /** The spider's body box */
15
    public ModelRenderer spiderBody;
16
17
    /** Spider's first leg */
18
    public ModelRenderer spiderLeg1;
19
20
    /** Spider's second leg */
21
    public ModelRenderer spiderLeg2;
22
23
    /** Spider's third leg */
24
    public ModelRenderer spiderLeg3;
25
26
    /** Spider's fourth leg */
27
    public ModelRenderer spiderLeg4;
28
29
    /** Spider's fifth leg */
30
    public ModelRenderer spiderLeg5;
31
32
    /** Spider's sixth leg */
33
    public ModelRenderer spiderLeg6;
34
35
    /** Spider's seventh leg */
36
    public ModelRenderer spiderLeg7;
37
38
    /** Spider's eight leg */
39
    public ModelRenderer spiderLeg8;
40
41
    public ModelSpider()
42
    {
43
        float f = 0.0F;
44
        int i = 15;
45
        this.spiderHead = new ModelRenderer(this, 32, 4);
46
        this.spiderHead.addBox(-4.0F, -4.0F, -8.0F, 8, 8, 8, f);
47
        this.spiderHead.setRotationPoint(0.0F, (float)i, -3.0F);
48
        this.spiderNeck = new ModelRenderer(this, 0, 0);
49
        this.spiderNeck.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6, f);
50
        this.spiderNeck.setRotationPoint(0.0F, (float)i, 0.0F);
51
        this.spiderBody = new ModelRenderer(this, 0, 12);
52
        this.spiderBody.addBox(-5.0F, -4.0F, -6.0F, 10, 8, 12, f);
53
        this.spiderBody.setRotationPoint(0.0F, (float)i, 9.0F);
54
        this.spiderLeg1 = new ModelRenderer(this, 18, 0);
55
        this.spiderLeg1.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f);
56
        this.spiderLeg1.setRotationPoint(-4.0F, (float)i, 2.0F);
57
        this.spiderLeg2 = new ModelRenderer(this, 18, 0);
58
        this.spiderLeg2.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f);
59
        this.spiderLeg2.setRotationPoint(4.0F, (float)i, 2.0F);
60
        this.spiderLeg3 = new ModelRenderer(this, 18, 0);
61
        this.spiderLeg3.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f);
62
        this.spiderLeg3.setRotationPoint(-4.0F, (float)i, 1.0F);
63
        this.spiderLeg4 = new ModelRenderer(this, 18, 0);
64
        this.spiderLeg4.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f);
65
        this.spiderLeg4.setRotationPoint(4.0F, (float)i, 1.0F);
66
        this.spiderLeg5 = new ModelRenderer(this, 18, 0);
67
        this.spiderLeg5.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f);
68
        this.spiderLeg5.setRotationPoint(-4.0F, (float)i, 0.0F);
69
        this.spiderLeg6 = new ModelRenderer(this, 18, 0);
70
        this.spiderLeg6.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f);
71
        this.spiderLeg6.setRotationPoint(4.0F, (float)i, 0.0F);
72
        this.spiderLeg7 = new ModelRenderer(this, 18, 0);
73
        this.spiderLeg7.addBox(-15.0F, -1.0F, -1.0F, 16, 2, 2, f);
74
        this.spiderLeg7.setRotationPoint(-4.0F, (float)i, -1.0F);
75
        this.spiderLeg8 = new ModelRenderer(this, 18, 0);
76
        this.spiderLeg8.addBox(-1.0F, -1.0F, -1.0F, 16, 2, 2, f);
77
        this.spiderLeg8.setRotationPoint(4.0F, (float)i, -1.0F);
78
    }
79
80
    /**
81
     * Sets the models various rotation angles then renders the model.
82
     */
83
    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)
84
    {
85
        this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
86
        this.spiderHead.render(scale);
87
        this.spiderNeck.render(scale);
88
        this.spiderBody.render(scale);
89
        this.spiderLeg1.render(scale);
90
        this.spiderLeg2.render(scale);
91
        this.spiderLeg3.render(scale);
92
        this.spiderLeg4.render(scale);
93
        this.spiderLeg5.render(scale);
94
        this.spiderLeg6.render(scale);
95
        this.spiderLeg7.render(scale);
96
        this.spiderLeg8.render(scale);
97
    }
98
99
    /**
100
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
101
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
102
     * "far" arms and legs can swing at most.
103
     */
104
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
105
    {
106
        this.spiderHead.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
107
        this.spiderHead.rotateAngleX = headPitch / (180F / (float)Math.PI);
108
        float f = ((float)Math.PI / 4F);
109
        this.spiderLeg1.rotateAngleZ = -f;
110
        this.spiderLeg2.rotateAngleZ = f;
111
        this.spiderLeg3.rotateAngleZ = -f * 0.74F;
112
        this.spiderLeg4.rotateAngleZ = f * 0.74F;
113
        this.spiderLeg5.rotateAngleZ = -f * 0.74F;
114
        this.spiderLeg6.rotateAngleZ = f * 0.74F;
115
        this.spiderLeg7.rotateAngleZ = -f;
116
        this.spiderLeg8.rotateAngleZ = f;
117
        float f1 = -0.0F;
118
        float f2 = 0.3926991F;
119
        this.spiderLeg1.rotateAngleY = f2 * 2.0F + f1;
120
        this.spiderLeg2.rotateAngleY = -f2 * 2.0F - f1;
121
        this.spiderLeg3.rotateAngleY = f2 * 1.0F + f1;
122
        this.spiderLeg4.rotateAngleY = -f2 * 1.0F - f1;
123
        this.spiderLeg5.rotateAngleY = -f2 * 1.0F + f1;
124
        this.spiderLeg6.rotateAngleY = f2 * 1.0F - f1;
125
        this.spiderLeg7.rotateAngleY = -f2 * 2.0F + f1;
126
        this.spiderLeg8.rotateAngleY = f2 * 2.0F - f1;
127
        float f3 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + 0.0F) * 0.4F) * limbSwingAmount;
128
        float f4 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + (float)Math.PI) * 0.4F) * limbSwingAmount;
129
        float f5 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + ((float)Math.PI / 2F)) * 0.4F) * limbSwingAmount;
130
        float f6 = -(MathHelper.cos(limbSwing * 0.6662F * 2.0F + ((float)Math.PI * 3F / 2F)) * 0.4F) * limbSwingAmount;
131
        float f7 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + 0.0F) * 0.4F) * limbSwingAmount;
132
        float f8 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + (float)Math.PI) * 0.4F) * limbSwingAmount;
133
        float f9 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + ((float)Math.PI / 2F)) * 0.4F) * limbSwingAmount;
134
        float f10 = Math.abs(MathHelper.sin(limbSwing * 0.6662F + ((float)Math.PI * 3F / 2F)) * 0.4F) * limbSwingAmount;
135
        this.spiderLeg1.rotateAngleY += f3;
136
        this.spiderLeg2.rotateAngleY += -f3;
137
        this.spiderLeg3.rotateAngleY += f4;
138
        this.spiderLeg4.rotateAngleY += -f4;
139
        this.spiderLeg5.rotateAngleY += f5;
140
        this.spiderLeg6.rotateAngleY += -f5;
141
        this.spiderLeg7.rotateAngleY += f6;
142
        this.spiderLeg8.rotateAngleY += -f6;
143
        this.spiderLeg1.rotateAngleZ += f7;
144
        this.spiderLeg2.rotateAngleZ += -f7;
145
        this.spiderLeg3.rotateAngleZ += f8;
146
        this.spiderLeg4.rotateAngleZ += -f8;
147
        this.spiderLeg5.rotateAngleZ += f9;
148
        this.spiderLeg6.rotateAngleZ += -f9;
149
        this.spiderLeg7.rotateAngleZ += f10;
150
        this.spiderLeg8.rotateAngleZ += -f10;
151
    }
152
}
153

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