2014-04-23 03:36:26 +02:00
|
|
|
package appeng.client.render.items;
|
|
|
|
|
2014-04-23 07:18:44 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.client.renderer.RenderHelper;
|
2014-04-23 03:36:26 +02:00
|
|
|
import net.minecraft.client.renderer.entity.RenderItem;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraftforge.client.IItemRenderer;
|
|
|
|
|
|
|
|
import org.lwjgl.input.Keyboard;
|
2014-04-23 07:18:44 +02:00
|
|
|
import org.lwjgl.opengl.GL11;
|
2014-04-23 03:36:26 +02:00
|
|
|
|
2014-04-23 07:30:29 +02:00
|
|
|
import appeng.items.misc.ItemEncodedPattern;
|
2014-04-23 03:36:26 +02:00
|
|
|
|
|
|
|
public class ItemEncodedPatternRenderer implements IItemRenderer
|
|
|
|
{
|
|
|
|
|
|
|
|
RenderItem ri = new RenderItem();
|
|
|
|
boolean resursive;
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean handleRenderType(ItemStack item, ItemRenderType type)
|
|
|
|
{
|
|
|
|
boolean isShiftHeld = Keyboard.isKeyDown( Keyboard.KEY_LSHIFT ) || Keyboard.isKeyDown( Keyboard.KEY_RSHIFT );
|
|
|
|
|
|
|
|
if ( resursive == false && type == IItemRenderer.ItemRenderType.INVENTORY && isShiftHeld )
|
|
|
|
{
|
2014-04-23 07:30:29 +02:00
|
|
|
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
|
|
|
if ( iep.getOutput( item ) != null )
|
2014-04-23 03:36:26 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderItem(ItemRenderType type, ItemStack item, Object... data)
|
|
|
|
{
|
|
|
|
resursive = true;
|
|
|
|
|
2014-04-23 07:30:29 +02:00
|
|
|
ItemEncodedPattern iep = (ItemEncodedPattern) item.getItem();
|
|
|
|
|
|
|
|
ItemStack is = iep.getOutput( item );
|
2014-04-23 07:18:44 +02:00
|
|
|
Minecraft mc = Minecraft.getMinecraft();
|
2014-04-23 03:36:26 +02:00
|
|
|
|
2014-04-23 07:18:44 +02:00
|
|
|
GL11.glPushAttrib( GL11.GL_ALL_ATTRIB_BITS );
|
|
|
|
RenderHelper.enableGUIStandardItemLighting();
|
|
|
|
ri.renderItemAndEffectIntoGUI( mc.fontRenderer, mc.getTextureManager(), is, 0, 0 );
|
|
|
|
RenderHelper.disableStandardItemLighting();
|
|
|
|
GL11.glPopAttrib();
|
2014-04-23 03:36:26 +02:00
|
|
|
|
|
|
|
resursive = false;
|
|
|
|
}
|
|
|
|
}
|