blob: f180f75fa02afcc729507a43a2cbe0fec8529c3f (
plain)
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
|
package ihl.processing.metallurgy;
import org.lwjgl.opengl.GL11;
import ic2.api.tile.IWrenchable;
import ihl.IHLModInfo;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
public class WoodenRollingMachineRender extends TileEntitySpecialRenderer{
private WoodenRollingMachinePart1Model model = new WoodenRollingMachinePart1Model();
private ResourceLocation tex = new ResourceLocation(IHLModInfo.MODID+":textures/blocks/woodenRollingMachine.png");
private final float scale=1F/16F;
public WoodenRollingMachineRender() {}
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float par8)
{
int rotation = 0;
if(tile.getWorldObj() != null)
{
switch (((IWrenchable)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;
}
}
else
{
return;
}
WoodenRollingMachinePart1TileEntity cte = (WoodenRollingMachinePart1TileEntity)tile;
GL11.glPushMatrix();
GL11.glTranslatef((float)x + 0.5F, (float)y + 1.5F, (float)z + 0.5F);
GL11.glScalef(1.0F, -1F, -1F);
GL11.glRotatef(rotation*90, 0.0F, 1.0F, 0.0F);
bindTexture(tex);
model.Base.render(scale);
if(cte.getActive())
{
model.RotatingPart1.rotateAngleZ+=0.01F;
model.RotatingPart2.rotateAngleZ+=0.01F;
model.RotatingPart3.rotateAngleZ+=0.01F;
model.RotatingPart4.rotateAngleZ-=0.01F;
model.RotatingPart1.render(scale);
model.RotatingPart2.render(scale);
model.RotatingPart3.render(scale);
model.RotatingPart4.render(scale);
model.MotorPart1.rotateAngleZ-=0.03F;
model.MotorPart1.render(scale);
model.MotorPart2.render(scale);
model.Belt1.render(scale);
model.Belt2.render(scale);
}
else
{
model.RotatingPart1.rotateAngleZ=0.0F;
model.RotatingPart2.rotateAngleZ=0.0F;
model.RotatingPart3.rotateAngleZ=0.0F;
model.RotatingPart4.rotateAngleZ=0.0F;
if(cte.assembled)
{
model.RotatingPart1.render(scale);
model.RotatingPart2.render(scale);
model.RotatingPart3.render(scale);
model.RotatingPart4.render(scale);
}
model.MotorPart1.render(scale);
model.MotorPart2.render(scale);
model.Belt1.render(scale);
model.Belt2.render(scale);
}
GL11.glPopMatrix(); //end
}
}
|