summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/tileentity/renders/TileEntityHandPedestalRender.java
blob: da8fa58fbce6599db6a173e6e9db1827fb63b044 (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
package darkknight.jewelrycraft.tileentity.renders;

import org.lwjgl.opengl.GL11;

import darkknight.jewelrycraft.model.ModelHandPedestal;
import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;

/**
 * @author Paul Fulham (pau101)
 */
public class TileEntityHandPedestalRender
		extends TileEntitySpecialRenderer {
	private ModelHandPedestal	model;
	private ResourceLocation	texture;

	/**
	 * @param model
	 * @param texture
	 */
	public TileEntityHandPedestalRender(ModelHandPedestal model,
			ResourceLocation texture) {
		this.model = model;
		this.texture = texture;
	}

	/**
	 * @param te
	 * @param x
	 * @param y
	 * @param z
	 * @param partialRenderTicks
	 */
	@Override
	public void renderTileEntityAt(TileEntity te, double x, double y,
			double z, float partialRenderTicks) {
		GL11.glPushMatrix();
		GL11.glTranslatef((float) x + 0.5F, (float) y + 1.5F,
				(float) z + 0.5F);
		TileEntityHandPedestal pedestal = (TileEntityHandPedestal) te;
		bindTexture(texture);
		GL11.glRotatef(180, 0, 0, 1);
		GL11.glRotatef(pedestal.getWorldObj() == null ? 180
				: pedestal.getBlockMetadata() % 8 / 8F
						* 360,
				0, 1, 0);
		model.render(pedestal, partialRenderTicks, 0.0625F);
		GL11.glPopMatrix();
	}
}