-
Notifications
You must be signed in to change notification settings - Fork 4
/
TombStoneItemRenderer.java
75 lines (59 loc) · 1.95 KB
/
TombStoneItemRenderer.java
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
package TombStone;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.client.FMLClientHandler;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class TombStoneItemRenderer implements IItemRenderer
{
private final TombStoneModel modelBox;
public TombStoneItemRenderer()
{
modelBox = new TombStoneModel();
}
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type)
{
return true;
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
{
return true;
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
{
// TODO: Figure out why it is invisible in your hand
switch(type)
{
case ENTITY:{
renderTombStoneItem(0f, 0f, 0f, 0.5f);
return;
}
case EQUIPPED:{
renderTombStoneItem(0f, 1f, 1f, 0.5f);
return;
}
case INVENTORY:{
renderTombStoneItem(0f, 0f, 0f, 0.5f);
return;
}
default:return;
}
}
private void renderTombStoneItem(float x, float y, float z, float scale)
{
GL11.glPushMatrix();
// disable lighting in inventory render
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef((float)x + 0.5F, (float)y + 0.75F * 1.0F, (float)z + 0.5F);
GL11.glScalef(1.0F, 1.0F, 1.0F);
FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/TombStone/textures/tombstone.png");
this.modelBox.renderBase();
FMLClientHandler.instance().getClient().renderEngine.bindTexture("/mods/TombStone/textures/tombstone2.png");
this.modelBox.renderHeadstone();
// re-enable lighting
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
}