View difference between Paste ID: tBR8p3Ti and HHnuSn0r
SHOW: | | - or go back to the newest paste.
1
public class ThaumicGenRenderer extends TileEntitySpecialRenderer {
2
	
3
	
4
	private static final ResourceLocation TEX = new ResourceLocation(Knowledge.MODID+":"+"textures/models/ThaumicGen_model.png");
5
	
6
	private ModelThaumicGen model;
7
	
8
	public ThaumicGenRenderer() {
9
		this.model = new ModelThaumicGen();
10
	}
11
12
	@Override
13
	public void renderTileEntityAt(TileEntity te, double x, double y, double z, float f) {
14
		
15
		
16
		GL11.glPushMatrix();
17
        GL11.glTranslatef((float)x, (float)y, (float)z);
18
        GL11.glRotatef(0F, 0, 0, 0);
19
        GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
20
        GL11.glEnable(GL11.GL_BLEND);
21
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
22
        TileEntityThaumicGen t = (TileEntityThaumicGen)te;
23
        renderBlockYour(t, t.getWorldObj(), t.xCoord, t.yCoord, t.zCoord, TKBlocks.dummytg);
24
        //GL11.glDisable(GL11.GL_BLEND);
25
        GL11.glPopMatrix();
26
		
27
	}
28
	
29
	private void renderBlockYour(TileEntityThaumicGen te, World world, int i, int j, int k, Block block) {
30
		TileEntityThaumicGen t = (TileEntityThaumicGen)te;
31
        Tessellator tessellator = Tessellator.instance;
32
        float f = block.getLightValue(world, i, j, k);
33
        int l = world.getLightBrightnessForSkyBlocks(i, j, k, 0);
34
        int l1 = l % 65536;
35
        int l2 = l / 65536;
36
        tessellator.setColorOpaque_F(f, f, f);
37
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)l1, (float)l2);      
38
        int dir = world.getBlockMetadata(i, j, k);
39
        switch(t.getFacing().ordinal()) {
40
        case 2:
41
			GL11.glRotatef(180, 0, 1, 0);
42
			GL11.glTranslatef(0F, -1.5F, 1F); // +0.5, -0.5, +1
43
			break;
44
		case 3:
45
			GL11.glRotatef(0, 0, 1, 0);
46
			GL11.glTranslatef(1F, -1.5F, 0F);
47
			break;
48
		case 4:
49
			GL11.glRotatef(90, 0, 1, 0);
50
			GL11.glTranslatef(1F, -1.5F, 1F);
51
			break;
52
		case 5:
53
			GL11.glRotatef(270, 0F, 1F, 0F);
54
			GL11.glTranslatef(0F, -1.5F, 0F);
55
			break;
56
        default: break;
57
        }
58
        GL11.glRotatef(dir * (-90F), 0F, 1F, 0F);
59
        GL11.glTranslatef(-0.5F, 0F, -0.5F);
60
        Minecraft.getMinecraft().renderEngine.bindTexture(TEX);
61
        this.model.render((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
62
        this.model.renderFloor((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
63
        //this.model.renderGlass((Entity)null, 0.0F, 0.0F, -0.1F, 0.0F, 0.0F, 0.0625F);
64
        
65
    }
66
67
}
68
69
70
71
72
73
74
75
76
77
78
79
public class ModelThaumicGen extends ModelBase {
80
    public ModelRenderer Jar;
81
    public ModelRenderer Top;
82
    public ModelRenderer Bottom;
83
    public ModelRenderer JarInside;
84
    public ModelRenderer CoilA;
85
    public ModelRenderer CoilB;
86
    public ModelRenderer CoilC;
87
    public ModelRenderer CoilD;
88
    public ModelRenderer CoilA_1;
89
    public ModelRenderer CoilB_1;
90
    public ModelRenderer CoilC_1;
91
    public ModelRenderer CoilD_1;
92
    public ModelRenderer ConnectorA;
93
    public ModelRenderer ConnectorB;
94
    public ModelRenderer ConnectorC;
95
    public ModelRenderer ConnectorD;
96
    public ModelRenderer TrimFBA;
97
    public ModelRenderer TrimFBB;
98
    public ModelRenderer TrimFBC;
99
    public ModelRenderer TrimFBD;
100
    public ModelRenderer TrimLRC;
101
    public ModelRenderer TrimLRD;
102
    public ModelRenderer TrimLRA;
103
    public ModelRenderer TrimLRB;
104
    public ModelRenderer TrimTDA;
105
    public ModelRenderer TrimTDB;
106
    public ModelRenderer TrimTDC;
107
    public ModelRenderer TrimTDD;
108
    public ModelRenderer ConnectorA_1;
109
    public ModelRenderer ConnectorB_1;
110
    public ModelRenderer ConnectorC_1;
111
    public ModelRenderer ConnectorD_1;
112
113
    public ModelThaumicGen() {
114
        this.textureWidth = 64;
115
        this.textureHeight = 64;
116
        this.ConnectorA = new ModelRenderer(this, 0, 17);
117
        this.ConnectorA.setRotationPoint(-7.0F, 18.0F, 0.0F);
118
        this.ConnectorA.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
119
        this.setRotateAngle(ConnectorA, 0.0F, 0.0F, -0.19198621771937624F);
120
        this.TrimFBC = new ModelRenderer(this, 60, 43);
121
        this.TrimFBC.setRotationPoint(7.0F, -2.0F, -7.0F);
122
        this.TrimFBC.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
123
        this.setRotateAngle(TrimFBC, 1.5707963267948966F, 0.0F, 0.0F);
124
        this.CoilC = new ModelRenderer(this, 56, 20);
125
        this.CoilC.setRotationPoint(-3.3F, -5.000000000000003F, 3.3F);
126
        this.CoilC.addBox(-2.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F);
127
        this.setRotateAngle(CoilC, -0.19198621771937624F, 0.0F, -0.19198621771937624F);
128
        this.CoilB = new ModelRenderer(this, 56, 20);
129
        this.CoilB.setRotationPoint(-3.3F, -5.000000000000003F, -3.3F);
130
        this.CoilB.addBox(-2.0F, 0.0F, -2.0F, 2, 3, 2, 0.0F);
131
        this.setRotateAngle(CoilB, 0.19198621771937624F, 0.0F, -0.19198621771937624F);
132
        this.Bottom = new ModelRenderer(this, 0, 0);
133
        this.Bottom.setRotationPoint(0.0F, 24.0F, 0.0F);
134
        this.Bottom.addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12, 0.0F);
135
        this.setRotateAngle(Bottom, 0.0F, 0.0F, 3.141592653589793F);
136
        this.TrimTDC = new ModelRenderer(this, 60, 43);
137
        this.TrimTDC.setRotationPoint(7.0F, -2.0F, 6.0F);
138
        this.TrimTDC.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
139
        this.Jar = new ModelRenderer(this, 0, 32);
140
        this.Jar.setRotationPoint(0.0F, -2.4F, 0.0F);
141
        this.Jar.addBox(-6.0F, 0.0F, -6.0F, 12, 20, 12, 0.0F);
142
        this.TrimFBA = new ModelRenderer(this, 60, 43);
143
        this.TrimFBA.setRotationPoint(-6.0F, -2.0F, -7.0F);
144
        this.TrimFBA.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
145
        this.setRotateAngle(TrimFBA, 1.5707963267948966F, 0.0F, 0.0F);
146
        this.TrimTDA = new ModelRenderer(this, 60, 43);
147
        this.TrimTDA.setRotationPoint(-6.0F, -2.0F, 6.0F);
148
        this.TrimTDA.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
149
        this.CoilD = new ModelRenderer(this, 56, 20);
150
        this.CoilD.setRotationPoint(3.3F, -5.000000000000003F, -3.3F);
151
        this.CoilD.addBox(0.0F, 0.0F, -2.0F, 2, 3, 2, 0.0F);
152
        this.setRotateAngle(CoilD, 0.19198621771937624F, 0.0F, 0.19198621771937624F);
153
        this.CoilD_1 = new ModelRenderer(this, 56, 29);
154
        this.CoilD_1.setRotationPoint(3.0F, -1.0F, -2.0F);
155
        this.CoilD_1.addBox(0.0F, -1.4F, -2.0F, 1, 3, 1, 0.0F);
156
        this.setRotateAngle(CoilD_1, 0.19198621771937624F, 0.0F, 0.19198621771937624F);
157
        this.CoilA = new ModelRenderer(this, 56, 20);
158
        this.CoilA.setRotationPoint(3.3F, -5.000000000000003F, 3.3F);
159
        this.CoilA.addBox(0.0F, 0.0F, 0.0F, 2, 3, 2, 0.0F);
160
        this.setRotateAngle(CoilA, -0.19198621771937624F, 0.0F, 0.19198621771937624F);
161
        this.TrimFBB = new ModelRenderer(this, 60, 43);
162
        this.TrimFBB.setRotationPoint(-6.0F, 19.0F, -7.0F);
163
        this.TrimFBB.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
164
        this.setRotateAngle(TrimFBB, 1.5707963267948966F, 0.0F, 0.0F);
165
        this.ConnectorD = new ModelRenderer(this, 18, 21);
166
        this.ConnectorD.setRotationPoint(0.0F, 18.0F, -7.0F);
167
        this.ConnectorD.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
168
        this.setRotateAngle(ConnectorD, 0.19198621771937624F, 0.0F, 0.0F);
169
        this.JarInside = new ModelRenderer(this, 28, 0);
170
        //this.JarInside.setRotationPoint(0.0F, 0.0F, 0.0F);
171
        this.JarInside.setRotationPoint(0.0F, 10.2F, 0.0F);
172
        this.JarInside.addBox(-6.0F, 0.0F, -6.0F, 12, 0, 12, 0.0F);
173
        this.ConnectorA_1 = new ModelRenderer(this, 0, 17);
174
        this.ConnectorA_1.setRotationPoint(-7.0F, -1.9999999999999791F, 0.0F);
175
        this.ConnectorA_1.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
176
        this.setRotateAngle(ConnectorA_1, 0.0F, 0.0F, -2.949606435870417F);
177
        this.TrimLRA = new ModelRenderer(this, 60, 43);
178
        this.TrimLRA.setRotationPoint(-6.0F, -2.0F, -7.0F);
179
        this.TrimLRA.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
180
        this.setRotateAngle(TrimLRA, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
181
        this.TrimLRD = new ModelRenderer(this, 60, 43);
182
        this.TrimLRD.setRotationPoint(-6.0F, 19.0F, -7.0F);
183
        this.TrimLRD.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
184
        this.setRotateAngle(TrimLRD, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
185
        this.CoilB_1 = new ModelRenderer(this, 56, 29);
186
        this.CoilB_1.setRotationPoint(-2.0F, -1.0F, -2.0F);
187
        this.CoilB_1.addBox(-2.0F, -1.4F, -2.0F, 1, 3, 1, 0.0F);
188
        this.setRotateAngle(CoilB_1, 0.19198621771937624F, 0.0F, -0.19198621771937624F);
189
        this.CoilC_1 = new ModelRenderer(this, 56, 29);
190
        this.CoilC_1.setRotationPoint(-2.0F, -1.0F, 3.0F);
191
        this.CoilC_1.addBox(-2.0F, -1.4F, 0.0F, 1, 3, 1, 0.0F);
192
        this.setRotateAngle(CoilC_1, -0.19198621771937624F, 0.0F, -0.19198621771937624F);
193
        this.TrimTDD = new ModelRenderer(this, 60, 43);
194
        this.TrimTDD.mirror = true;
195
        this.TrimTDD.setRotationPoint(7.0F, -2.0F, -7.0F);
196
        this.TrimTDD.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
197
        this.ConnectorC = new ModelRenderer(this, 18, 21);
198
        this.ConnectorC.setRotationPoint(0.0F, 18.0F, 7.0F);
199
        this.ConnectorC.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
200
        this.setRotateAngle(ConnectorC, -0.19198621771937624F, 0.0F, 0.0F);
201
        this.TrimLRB = new ModelRenderer(this, 60, 43);
202
        this.TrimLRB.setRotationPoint(-6.0F, -2.0F, 6.0F);
203
        this.TrimLRB.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
204
        this.setRotateAngle(TrimLRB, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
205
        this.ConnectorC_1 = new ModelRenderer(this, 18, 21);
206
        this.ConnectorC_1.setRotationPoint(0.0F, -1.9999999999999791F, 7.0F);
207
        this.ConnectorC_1.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
208
        this.setRotateAngle(ConnectorC_1, -0.19198621771937624F, 0.0F, 3.141592653589793F);
209
        this.Top = new ModelRenderer(this, 0, 0);
210
        this.Top.setRotationPoint(0.0F, -8.0F, 0.0F);
211
        this.Top.addBox(-6.0F, 0.0F, -6.0F, 12, 4, 12, 0.0F);
212
        this.ConnectorB_1 = new ModelRenderer(this, 0, 17);
213
        this.ConnectorB_1.setRotationPoint(7.0F, -1.9999999999999791F, 0.0F);
214
        this.ConnectorB_1.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
215
        this.setRotateAngle(ConnectorB_1, 0.0F, 0.0F, 2.949606435870417F);
216
        this.TrimTDB = new ModelRenderer(this, 60, 43);
217
        this.TrimTDB.setRotationPoint(-6.0F, -2.0F, -7.0F);
218
        this.TrimTDB.addBox(-1.0F, 0.0F, 0.0F, 1, 20, 1, 0.0F);
219
        this.ConnectorB = new ModelRenderer(this, 0, 17);
220
        this.ConnectorB.setRotationPoint(7.0F, 18.0F, 0.0F);
221
        this.ConnectorB.addBox(-1.0F, 0.0F, -3.0F, 2, 4, 6, 0.0F);
222
        this.setRotateAngle(ConnectorB, 0.0F, 0.0F, 0.19198621771937624F);
223
        this.TrimLRC = new ModelRenderer(this, 60, 43);
224
        this.TrimLRC.setRotationPoint(-6.0F, 19.0F, 6.0F);
225
        this.TrimLRC.addBox(-1.0F, 0.0F, 0.0F, 1, 12, 1, 0.0F);
226
        this.setRotateAngle(TrimLRC, 1.5707963267948966F, 1.5707963267948966F, 0.0F);
227
        this.CoilA_1 = new ModelRenderer(this, 56, 29);
228
        this.CoilA_1.setRotationPoint(3.0F, -1.0F, 3.0F);
229
        this.CoilA_1.addBox(0.0F, -1.4F, 0.0F, 1, 3, 1, 0.0F);
230
        this.setRotateAngle(CoilA_1, -0.19198621771937624F, 0.0F, 0.19198621771937624F);
231
        this.ConnectorD_1 = new ModelRenderer(this, 18, 21);
232
        this.ConnectorD_1.setRotationPoint(0.0F, -1.9999999999999791F, -7.0F);
233
        this.ConnectorD_1.addBox(-3.0F, 0.0F, -1.0F, 6, 4, 2, 0.0F);
234
        this.setRotateAngle(ConnectorD_1, 0.19198621771937624F, 0.0F, 3.141592653589793F);
235
        this.TrimFBD = new ModelRenderer(this, 60, 43);
236
        this.TrimFBD.setRotationPoint(7.0F, 19.0F, -7.0F);
237
        this.TrimFBD.addBox(-1.0F, 0.0F, 0.0F, 1, 14, 1, 0.0F);
238
        this.setRotateAngle(TrimFBD, 1.5707963267948966F, 0.0F, 0.0F);
239
        
240
    }
241
242
    @Override
243
    public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) { 
244
        this.ConnectorA.render(f5);
245
        this.TrimFBC.render(f5);
246
        this.CoilC.render(f5);
247
        this.CoilB.render(f5);
248
        this.Bottom.render(f5);
249
        this.TrimTDC.render(f5);
250
        this.TrimFBA.render(f5);
251
        this.TrimTDA.render(f5);
252
        this.CoilD.render(f5);
253
        this.CoilD_1.render(f5);
254
        this.CoilA.render(f5);
255
        this.TrimFBB.render(f5);
256
        this.ConnectorD.render(f5);
257
        this.ConnectorA_1.render(f5);
258
        this.TrimLRA.render(f5);
259
        this.TrimLRD.render(f5);
260
        this.CoilB_1.render(f5);
261
        this.CoilC_1.render(f5);
262
        this.TrimTDD.render(f5);
263
        this.ConnectorC.render(f5);
264
        this.TrimLRB.render(f5);
265
        this.ConnectorC_1.render(f5);
266
        this.Top.render(f5);
267
        this.ConnectorB_1.render(f5);
268
        this.TrimTDB.render(f5);
269
        this.ConnectorB.render(f5);
270
        this.TrimLRC.render(f5);
271
        this.CoilA_1.render(f5);
272
        this.ConnectorD_1.render(f5);
273
        this.TrimFBD.render(f5);
274
       
275
    }
276
    
277
    
278
    public void renderFloor(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
279
    	
280
    	GL11.glPushMatrix();
281
        GL11.glTranslatef(this.JarInside.offsetX, this.JarInside.offsetY, this.JarInside.offsetZ);
282
        GL11.glTranslatef(this.JarInside.rotationPointX * f5, this.JarInside.rotationPointY * f5, this.JarInside.rotationPointZ * f5);
283
        GL11.glScaled(1.07D, 1.0D, 1.07D);
284
        GL11.glTranslatef(-this.JarInside.offsetX, -this.JarInside.offsetY, -this.JarInside.offsetZ);
285
        GL11.glTranslatef(-this.JarInside.rotationPointX * f5, -this.JarInside.rotationPointY * f5, -this.JarInside.rotationPointZ * f5);
286
        this.JarInside.render(f5);
287
        GL11.glPopMatrix();
288
    }
289
    
290
    public void renderGlass(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
291
    	
292
    	
293
    	GL11.glPushMatrix();
294
        GL11.glTranslatef(this.Jar.offsetX, this.Jar.offsetY, this.Jar.offsetZ);
295
        GL11.glTranslatef(this.Jar.rotationPointX * f5, this.Jar.rotationPointY * f5, this.Jar.rotationPointZ * f5);
296
        GL11.glScaled(1.07D, 1.04D, 1.07D);
297
        GL11.glTranslatef(-this.Jar.offsetX, -this.Jar.offsetY, -this.Jar.offsetZ);
298
        GL11.glTranslatef(-this.Jar.rotationPointX * f5, -this.Jar.rotationPointY * f5, -this.Jar.rotationPointZ * f5);
299
        this.Jar.render(f5);
300
        GL11.glPopMatrix();
301
    }
302
303
    /**
304
     * This is a helper function from Tabula to set the rotation of model parts
305
     */
306
    public void setRotateAngle(ModelRenderer modelRenderer, float x, float y, float z) {
307
        modelRenderer.rotateAngleX = x;
308
        modelRenderer.rotateAngleY = y;
309
        modelRenderer.rotateAngleZ = z;
310
    }
311
}