ModelBat .java

net.minecraft.client.model.ModelBat (class, 112 lines): members: batOuterRightWing, batOuterLeftWing, batRightWing, batLeftWing, batBody, batHead, render.

net.minecraft.client.modelclass112 linesclientextends ModelBase5.2 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)

batHead
batBody
batRightWing
batLeftWing
batOuterRightWing
batOuterLeftWing

Code Graph: Dependencies (5)

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

Full Source

ModelBat.java112 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.model;
2
3
import net.minecraft.entity.Entity;
4
import net.minecraft.entity.passive.EntityBat;
5
import net.minecraft.util.MathHelper;
6
7
public class ModelBat extends ModelBase
8
{
9
    private ModelRenderer batHead;
10
11
    /** The body box of the bat model. */
12
    private ModelRenderer batBody;
13
14
    /** The inner right wing box of the bat model. */
15
    private ModelRenderer batRightWing;
16
17
    /** The inner left wing box of the bat model. */
18
    private ModelRenderer batLeftWing;
19
20
    /** The outer right wing box of the bat model. */
21
    private ModelRenderer batOuterRightWing;
22
23
    /** The outer left wing box of the bat model. */
24
    private ModelRenderer batOuterLeftWing;
25
26
    public ModelBat()
27
    {
28
        this.textureWidth = 64;
29
        this.textureHeight = 64;
30
        this.batHead = new ModelRenderer(this, 0, 0);
31
        this.batHead.addBox(-3.0F, -3.0F, -3.0F, 6, 6, 6);
32
        ModelRenderer modelrenderer = new ModelRenderer(this, 24, 0);
33
        modelrenderer.addBox(-4.0F, -6.0F, -2.0F, 3, 4, 1);
34
        this.batHead.addChild(modelrenderer);
35
        ModelRenderer modelrenderer1 = new ModelRenderer(this, 24, 0);
36
        modelrenderer1.mirror = true;
37
        modelrenderer1.addBox(1.0F, -6.0F, -2.0F, 3, 4, 1);
38
        this.batHead.addChild(modelrenderer1);
39
        this.batBody = new ModelRenderer(this, 0, 16);
40
        this.batBody.addBox(-3.0F, 4.0F, -3.0F, 6, 12, 6);
41
        this.batBody.setTextureOffset(0, 34).addBox(-5.0F, 16.0F, 0.0F, 10, 6, 1);
42
        this.batRightWing = new ModelRenderer(this, 42, 0);
43
        this.batRightWing.addBox(-12.0F, 1.0F, 1.5F, 10, 16, 1);
44
        this.batOuterRightWing = new ModelRenderer(this, 24, 16);
45
        this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F);
46
        this.batOuterRightWing.addBox(-8.0F, 1.0F, 0.0F, 8, 12, 1);
47
        this.batLeftWing = new ModelRenderer(this, 42, 0);
48
        this.batLeftWing.mirror = true;
49
        this.batLeftWing.addBox(2.0F, 1.0F, 1.5F, 10, 16, 1);
50
        this.batOuterLeftWing = new ModelRenderer(this, 24, 16);
51
        this.batOuterLeftWing.mirror = true;
52
        this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F);
53
        this.batOuterLeftWing.addBox(0.0F, 1.0F, 0.0F, 8, 12, 1);
54
        this.batBody.addChild(this.batRightWing);
55
        this.batBody.addChild(this.batLeftWing);
56
        this.batRightWing.addChild(this.batOuterRightWing);
57
        this.batLeftWing.addChild(this.batOuterLeftWing);
58
    }
59
60
    /**
61
     * Sets the models various rotation angles then renders the model.
62
     */
63
    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)
64
    {
65
        this.setRotationAngles(p_78088_2_, p_78088_3_, p_78088_4_, p_78088_5_, p_78088_6_, scale, entityIn);
66
        this.batHead.render(scale);
67
        this.batBody.render(scale);
68
    }
69
70
    /**
71
     * Sets the model's various rotation angles. For bipeds, par1 and par2 are used for animating the movement of arms
72
     * and legs, where par1 represents the time(so that arms and legs swing back and forth) and par2 represents how
73
     * "far" arms and legs can swing at most.
74
     */
75
    public void setRotationAngles(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn)
76
    {
77
        if (((EntityBat)entityIn).getIsBatHanging())
78
        {
79
            float f = (180F / (float)Math.PI);
80
            this.batHead.rotateAngleX = headPitch / (180F / (float)Math.PI);
81
            this.batHead.rotateAngleY = (float)Math.PI - netHeadYaw / (180F / (float)Math.PI);
82
            this.batHead.rotateAngleZ = (float)Math.PI;
83
            this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F);
84
            this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F);
85
            this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F);
86
            this.batBody.rotateAngleX = (float)Math.PI;
87
            this.batRightWing.rotateAngleX = -0.15707964F;
88
            this.batRightWing.rotateAngleY = -((float)Math.PI * 2F / 5F);
89
            this.batOuterRightWing.rotateAngleY = -1.7278761F;
90
            this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX;
91
            this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY;
92
            this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY;
93
        }
94
        else
95
        {
96
            float f1 = (180F / (float)Math.PI);
97
            this.batHead.rotateAngleX = headPitch / (180F / (float)Math.PI);
98
            this.batHead.rotateAngleY = netHeadYaw / (180F / (float)Math.PI);
99
            this.batHead.rotateAngleZ = 0.0F;
100
            this.batHead.setRotationPoint(0.0F, 0.0F, 0.0F);
101
            this.batRightWing.setRotationPoint(0.0F, 0.0F, 0.0F);
102
            this.batLeftWing.setRotationPoint(0.0F, 0.0F, 0.0F);
103
            this.batBody.rotateAngleX = ((float)Math.PI / 4F) + MathHelper.cos(ageInTicks * 0.1F) * 0.15F;
104
            this.batBody.rotateAngleY = 0.0F;
105
            this.batRightWing.rotateAngleY = MathHelper.cos(ageInTicks * 1.3F) * (float)Math.PI * 0.25F;
106
            this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY;
107
            this.batOuterRightWing.rotateAngleY = this.batRightWing.rotateAngleY * 0.5F;
108
            this.batOuterLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY * 0.5F;
109
        }
110
    }
111
}
112

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