use of net.minecraftforge.client.IItemRenderer in project LogisticsPipes by RS485.
the class LogisticsRenderPipe method renderItemStackOnSign.
public void renderItemStackOnSign(ItemStack itemstack) {
if (itemstack == null || itemstack.getItem() == null) {
// Only happens on false configuration
return;
}
Item item = itemstack.getItem();
IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemstack, ItemRenderType.INVENTORY);
Minecraft.getMinecraft().renderEngine.bindTexture(itemstack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
GL11.glPushMatrix();
if (customRenderer != null) {
if (customRenderer.shouldUseRenderHelper(ItemRenderType.INVENTORY, itemstack, ItemRendererHelper.INVENTORY_BLOCK)) {
GL11.glScalef(0.20F, -0.20F, -0.01F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-45.0F, 0.0F, 1.0F, 0.0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
customRenderer.renderItem(ItemRenderType.INVENTORY, itemstack, renderBlocks);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
} else {
GL11.glScalef(0.018F, -0.018F, -0.01F);
GL11.glTranslatef(-7F, -8F, 0F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
customRenderer.renderItem(ItemRenderType.INVENTORY, itemstack, renderBlocks);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
}
} else if (item instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(item).getRenderType())) {
GL11.glScalef(0.20F, -0.20F, -0.01F);
GL11.glRotatef(210.0F, 1.0F, 0.0F, 0.0F);
GL11.glRotatef(-45.0F, 0.0F, 1.0F, 0.0F);
renderBlocks.useInventoryTint = false;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
renderBlocks.renderBlockAsItem(Block.getBlockFromItem(item), itemstack.getItemDamage(), 1.0F);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
} else {
GL11.glScalef(0.02F, -0.02F, -0.01F);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_LIGHT0);
GL11.glDisable(GL11.GL_LIGHT1);
GL11.glDisable(GL11.GL_COLOR_MATERIAL);
GL11.glTranslatef(-8F, -8F, 0.0F);
if (item.requiresMultipleRenderPasses()) {
for (int var14 = 0; var14 < item.getRenderPasses(itemstack.getItemDamage()); ++var14) {
IIcon var15 = item.getIconFromDamageForRenderPass(itemstack.getItemDamage(), var14);
renderItem(var15);
}
} else {
renderItem(item.getIconIndex(itemstack));
}
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_LIGHT0);
GL11.glEnable(GL11.GL_LIGHT1);
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
}
GL11.glPopMatrix();
}
Aggregations