1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
|
package ihl.tunneling_shield;
import net.minecraft.client.renderer.entity.Render;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import ihl.IHLModInfo;
public class DriverRenderEntity extends Render{
private DriverModel model = new DriverModel();
private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/shield.png");
private float rotationSpeed=0F;
private float rotationAmount=1F;
private float rotationAmount2=0F;
private float shiftCorrection=0F;
public DriverRenderEntity()
{
super();
}
@Override
public void doRender(Entity entity, double x, double y, double z, float arg4, float arg5)
{
double d;
double d1;
double d2;
if(((DriverEntity)entity).parent!=null)
{
DriverTileEntity tile = ((DriverEntity)entity).parent;
float shift=tile.getModelShiftAmount();
d=x-entity.lastTickPosX+tile.xCoord;
d1=y-entity.lastTickPosY+tile.yCoord;
d2=z-entity.lastTickPosZ+tile.zCoord;
int rotation = 0;
if(tile.getWorldObj() != null)
{
switch (tile.getFacing())
{
case 2:
rotation = 0;
break;
case 5:
rotation = 1;
break;
case 3:
rotation = 2;
break;
case 4:
rotation = 3;
break;
default:
rotation = 0;
}
}
bindTexture(tex);
GL11.glPushMatrix();
GL11.glTranslatef((float)d + 0.5F, (float)d1 + 1.5F, (float)d2 + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
if(tile.hasShield && tile.getActive() && tile.shaftDestroyedAtA==0)
{
rotationAmount+=0.01F;
}
rotationAmount2 += 0.01F;
if(tile.hasShield)
{
if(tile.shaftDestroyedAtA==0)
{
model.ShieldB.rotateAngleZ=rotationAmount+(float)Math.PI/8.0F;
model.ShieldB.offsetZ=shift;
model.ShieldB.render(1.0F/16.0F);
model.ShieldC.rotateAngleZ=rotationAmount+3*(float)Math.PI/8.0F;
model.ShieldC.offsetZ=shift;
model.ShieldC.render(1.0F/16.0F);
if(tile.advancedShield)
{
model.AdvancedShieldA.rotateAngleZ=rotationAmount+(float)Math.PI/4.0F;
model.AdvancedShieldA.offsetZ=shift;
model.AdvancedShieldA.render(1.0F/16.0F);
}
else
{
model.ShieldA.rotateAngleZ=rotationAmount+(float)Math.PI/4.0F;
model.ShieldA.offsetZ=shift;
model.ShieldA.render(1.0F/16.0F);
}
model.Shield.rotateAngleZ=rotationAmount;
model.Shield.offsetZ=shift;
model.Shield.render(1.0F/16.0F);
GL11.glScalef(1.0F, 1.0F, 1.0F + shift);
model.ShaftA.offsetZ=0.5F;
model.ShaftB.offsetZ=0.5F;
model.ShaftA.rotateAngleZ=rotationAmount;
model.ShaftB.rotateAngleZ=rotationAmount;
model.ShaftA.render(1.0F/16.0F);
model.ShaftB.render(1.0F/16.0F);
}
else
{
model.ShieldB.rotateAngleZ=rotationAmount+(float)Math.PI/8.0F;
model.ShieldC.rotateAngleZ=rotationAmount+3*(float)Math.PI/8.0F;
model.ShieldA.rotateAngleZ=rotationAmount+(float)Math.PI/4.0F;
model.AdvancedShieldA.rotateAngleZ=rotationAmount+(float)Math.PI/4.0F;
model.Shield.rotateAngleZ=rotationAmount;
model.ShaftA.rotateAngleZ=rotationAmount;
model.ShieldB.offsetZ=shift;
model.ShieldB.render(1.0F/16.0F);
model.ShieldC.offsetZ=shift;
model.ShieldC.render(1.0F/16.0F);
if(tile.advancedShield)
{
model.AdvancedShieldA.offsetZ=shift;
model.AdvancedShieldA.render(1.0F/16.0F);
}
else
{
model.ShieldA.offsetZ=shift;
model.ShieldA.render(1.0F/16.0F);
}
model.Shield.offsetZ=shift;
model.Shield.render(1.0F/16.0F);
GL11.glScalef(1.0F, 1.0F, tile.shaftDestroyedAtA*2);
model.ShaftB.offsetZ=0.5F-0.2F/tile.shaftDestroyedAtA;
model.ShaftB.rotateAngleZ=rotationAmount2;
model.ShaftB.render(1.0F/16.0F);
GL11.glScalef(1.0F, 1.0F, (shift-tile.shaftDestroyedAtB)/tile.shaftDestroyedAtA);
model.ShaftA.offsetZ=0.5F*(tile.shaftDestroyedAtB+0.5F)/(shift-tile.shaftDestroyedAtB);
model.ShaftA.render(1.0F/16.0F);
}
}
GL11.glPopMatrix(); //end
}
}
@Override
protected ResourceLocation getEntityTexture(Entity arg0) {
return this.tex;
}
}
|