Applied-Energistics-2-tiler.../client/render/ItemRenderer.java

48 lines
1.2 KiB
Java
Raw Normal View History

package appeng.client.render;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
import org.lwjgl.opengl.GL11;
public class ItemRenderer implements IItemRenderer
{
public static final ItemRenderer instance = new ItemRenderer();
@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)
{
GL11.glPushMatrix();
2014-02-09 02:34:52 +01:00
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
GL11.glEnable( GL11.GL_ALPHA_TEST );
GL11.glEnable( GL11.GL_DEPTH_TEST );
GL11.glEnable( GL11.GL_BLEND );
2014-02-12 03:31:27 +01:00
GL11.glBlendFunc( GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA );
2014-02-09 02:34:52 +01:00
GL11.glColor4f( 1.0f, 1.0f, 1.0f, 1.0f );
if ( type == ItemRenderType.ENTITY )
GL11.glTranslatef( -0.5f, -0.5f, -0.5f );
if ( type == ItemRenderType.INVENTORY )
GL11.glTranslatef( 0.0f, -0.1f, 0.0f );
2014-02-14 03:26:32 +01:00
WorldRender.instance.renderItemBlock( item );
2014-02-09 02:34:52 +01:00
GL11.glPopAttrib();
GL11.glPopMatrix();
}
}