Search in sources :

Example 31 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project RebornCore by TechReborn.

the class StackInfoHUD method renderItemStack.

public void renderItemStack(ItemStack stack, int x, int y) {
    if (stack != EMPTY) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        RenderHelper.enableGUIStandardItemLighting();
        RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
        itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
        GL11.glDisable(GL11.GL_LIGHTING);
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 32 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project TechReborn by TechReborn.

the class TRBuilder method renderItemStack.

public void renderItemStack(ItemStack stack, int x, int y) {
    if (stack != EMPTY) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        RenderHelper.enableGUIStandardItemLighting();
        RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
        itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
        GL11.glDisable(GL11.GL_LIGHTING);
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 33 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Tropicraft by Tropicraft.

the class RenderBambooItemFrame method renderItem.

private void renderItem(EntityBambooItemFrame itemFrame) {
    ItemStack itemstack = itemFrame.getDisplayedItem();
    if (!itemstack.isEmpty()) {
        EntityItem entityitem = new EntityItem(itemFrame.world, 0.0D, 0.0D, 0.0D, itemstack);
        Item item = entityitem.getItem().getItem();
        entityitem.getItem().setCount(1);
        entityitem.hoverStart = 0.0F;
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        int i = itemFrame.getRotation();
        if (item instanceof net.minecraft.item.ItemMap) {
            i = i % 4 * 2;
        }
        GlStateManager.rotate((float) i * 360.0F / 8.0F, 0.0F, 0.0F, 1.0F);
        if (item instanceof net.minecraft.item.ItemMap) {
            this.renderManager.renderEngine.bindTexture(MAP_BACKGROUND_TEXTURES);
            GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
            float f = 0.0078125F;
            GlStateManager.scale(f, f, f);
            GlStateManager.translate(-64.0F, -64.0F, 0.0F);
            MapData mapdata = Items.FILLED_MAP.getMapData(entityitem.getItem(), itemFrame.world);
            GlStateManager.translate(0.0F, 0.0F, -1.0F);
            if (mapdata != null) {
                this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, true);
            }
        } else {
            GlStateManager.scale(0.5F, 0.5F, 0.5F);
            if (!this.itemRenderer.shouldRenderItemIn3D(entityitem.getItem()) || item instanceof ItemSkull) {
                GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
            }
            GlStateManager.pushAttrib();
            RenderHelper.enableStandardItemLighting();
            this.itemRenderer.renderItem(entityitem.getItem(), ItemCameraTransforms.TransformType.FIXED);
            RenderHelper.disableStandardItemLighting();
            GlStateManager.popAttrib();
        }
        GlStateManager.enableLighting();
        GlStateManager.popMatrix();
    }
}
Also used : EntityItem(net.minecraft.entity.item.EntityItem) Item(net.minecraft.item.Item) RenderItem(net.minecraft.client.renderer.RenderItem) MapData(net.minecraft.world.storage.MapData) ItemStack(net.minecraft.item.ItemStack) EntityItem(net.minecraft.entity.item.EntityItem) ItemSkull(net.minecraft.item.ItemSkull)

Example 34 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Cavern2 by kegare.

the class GuiListSlot method drawItemStack.

public void drawItemStack(RenderItem renderer, @Nullable IBlockState state, int x, int y, FontRenderer fontRenderer, @Nullable String overlay) {
    if (state == null) {
        return;
    }
    Item item = Item.getItemFromBlock(CaveRenderingRegistry.getRenderBlock(state.getBlock()));
    if (item == Items.AIR) {
        return;
    }
    int meta = state.getBlock().getMetaFromState(state);
    drawItemStack(renderer, new ItemStack(item, 1, meta), x, y, fontRenderer, overlay);
}
Also used : Item(net.minecraft.item.Item) RenderItem(net.minecraft.client.renderer.RenderItem) ItemStack(net.minecraft.item.ItemStack)

Example 35 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project HorsePower by GoryMoon.

the class ColorGetter method getTextureAtlasSprite.

@Nullable
private static TextureAtlasSprite getTextureAtlasSprite(ItemStack itemStack) {
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    ItemModelMesher itemModelMesher = renderItem.getItemModelMesher();
    IBakedModel itemModel = itemModelMesher.getItemModel(itemStack);
    return itemModel.getParticleTexture();
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) ItemModelMesher(net.minecraft.client.renderer.ItemModelMesher) IBakedModel(net.minecraft.client.renderer.block.model.IBakedModel) Nullable(javax.annotation.Nullable)

Aggregations

RenderItem (net.minecraft.client.renderer.RenderItem)55 ItemStack (net.minecraft.item.ItemStack)18 Minecraft (net.minecraft.client.Minecraft)11 FontRenderer (net.minecraft.client.gui.FontRenderer)10 Item (net.minecraft.item.Item)7 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)6 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)6 EntityItem (net.minecraft.entity.item.EntityItem)6 ItemModelMesher (net.minecraft.client.renderer.ItemModelMesher)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 TextureManager (net.minecraft.client.renderer.texture.TextureManager)4 ArrayList (java.util.ArrayList)3 IBlockState (net.minecraft.block.state.IBlockState)3 ItemBlock (net.minecraft.item.ItemBlock)3 Vec3d (net.minecraft.util.math.Vec3d)3 Block (net.minecraft.block.Block)2 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)2 EnumFacing (net.minecraft.util.EnumFacing)2