Search in sources :

Example 26 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class ClientProxyControl method registerItemModel.

private void registerItemModel(Item toRegister) {
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    renderItem.getItemModelMesher().register(toRegister, 0, new ModelResourceLocation(ValkyrienWarfareControlMod.MODID + ":" + toRegister.getUnlocalizedName().substring(5), "inventory"));
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) ModelResourceLocation(net.minecraft.client.renderer.block.model.ModelResourceLocation)

Example 27 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Totemic by TeamTotemic.

the class PageRecipe method renderItem.

@SideOnly(Side.CLIENT)
public void renderItem(IGuiLexiconEntry gui, int xPos, int yPos, ItemStack stack, boolean accountForContainer) {
    RenderItem render = Minecraft.getMinecraft().getRenderItem();
    boolean mouseDown = Mouse.isButtonDown(0);
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableDepth();
    render.renderItemAndEffectIntoGUI(stack, xPos, yPos);
    render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRenderer, stack, xPos, yPos, null);
    net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
    GlStateManager.popMatrix();
    if (relativeMouseX >= xPos && relativeMouseY >= yPos && relativeMouseX <= xPos + 16 && relativeMouseY <= yPos + 16) {
        tooltipStack = stack;
        LexiconRecipeMappings.EntryData data = LexiconRecipeMappings.getDataForStack(tooltipStack);
        if (data != null && (data.entry != gui.getEntry() || data.page != gui.getPageOn())) {
            tooltipEntry = true;
            if (!mouseDownLastTick && mouseDown && GuiScreen.isShiftKeyDown()) {
                GuiLexiconEntry newGui = new GuiLexiconEntry(data.entry, (GuiScreen) gui);
                newGui.page = data.page;
                Minecraft.getMinecraft().displayGuiScreen(newGui);
            }
        }
        if (accountForContainer) {
            ItemStack containerStack = stack.getItem().getContainerItem(stack);
            if (!containerStack.isEmpty())
                tooltipContainerStack = containerStack;
        }
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) LexiconRecipeMappings(pokefenn.totemic.api.lexicon.LexiconRecipeMappings) ItemStack(net.minecraft.item.ItemStack) GuiLexiconEntry(pokefenn.totemic.client.gui.GuiLexiconEntry) IGuiLexiconEntry(pokefenn.totemic.api.internal.IGuiLexiconEntry) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 28 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project ConvenientAdditions by Necr0.

the class ItemView method drawItem.

public void drawItem(ItemStack stack) {
    RenderItem itemRender = GuiHelper.getRenderItem();
    itemRender.zLevel = 100.0F;
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.disableDepth();
    itemRender.renderItemAndEffectIntoGUI(Helper.getClientPlayer(), stack, posX, posY);
    itemRender.renderItemOverlayIntoGUI(GuiHelper.getFontRenderer(), stack, posX, posY, null);
    itemRender.zLevel = 0.0F;
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 29 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Solar by Martacus.

the class RenderOfferingShrine method render.

@Override
public void render(TileOfferingShrine tileEntity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    GlStateManager.disableLighting();
    GlStateManager.scale(0.2F, 0.2F, 0.2F);
    GlStateManager.rotate(90, 1, 0, 0);
    float percentage = tileEntity.getRunningTicks() / TileOfferingShrine.OFFERING_TICKS;
    for (int i = 0; i < 8; i++) {
        ItemStack drawStack = tileEntity.getItemStackHandler().getStackInSlot(i);
        if (drawStack.isEmpty()) {
            continue;
        }
        GlStateManager.pushMatrix();
        GL11.glTranslatef(places[i][0], places[i][1], -1.3f);
        RenderHelper.enableStandardItemLighting();
        if (drawStack.getItem() instanceof ItemBlock) {
            GL11.glTranslatef(0, 0, -0.25f);
        }
        if (!tileEntity.getOfferingRecipe().equalsIgnoreCase("")) {
            GlStateManager.translate(0, 0, -percentage * 5);
        }
        itemRenderer.renderItem(drawStack, ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.popMatrix();
    }
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) ItemStack(net.minecraft.item.ItemStack) ItemBlock(net.minecraft.item.ItemBlock)

Example 30 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Solar by Martacus.

the class RenderSunburntChest method render.

@Override
public void render(TileSunburntChest tileEntity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    GlStateManager.translate(0.2, 0.65, 0.2);
    GlStateManager.disableLighting();
    GlStateManager.scale(0.3F, 0.3F, 0.3F);
    for (int i = 0; i < 9; i++) {
        ItemStack drawStack = tileEntity.getItemStackHandler().getStackInSlot(i);
        if (drawStack.isEmpty()) {
            continue;
        }
        int xLoc = i % 3;
        int yLoc = (int) Math.floor(i / 3);
        GlStateManager.pushMatrix();
        GL11.glTranslatef(xLoc, 0, yLoc);
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(drawStack, ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.popMatrix();
    }
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) ItemStack(net.minecraft.item.ItemStack)

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