Search in sources :

Example 16 with RenderItem

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

the class RenderUtil method renderLayingOnBlock.

public static void renderLayingOnBlock(ItemStack renderItem) {
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    if (!renderItem.isEmpty()) {
        GlStateManager.translate(0.5, 1, 0.5);
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        GlStateManager.rotate(180, 0.0F, 1.0F, 1);
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(renderItem, ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.enableLighting();
        GlStateManager.popMatrix();
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 17 with RenderItem

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

the class RenderUtil method renderLayingOnBlockWithCoords.

public static void renderLayingOnBlockWithCoords(ItemStack renderItem, double x, double y, double z) {
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    GlStateManager.translate(x, y, z);
    GlStateManager.pushMatrix();
    GlStateManager.disableLighting();
    GlStateManager.rotate(180, 0.0F, 1.0F, 1);
    GlStateManager.scale(0.5F, 0.5F, 0.5F);
    RenderHelper.enableStandardItemLighting();
    itemRenderer.renderItem(renderItem, ItemCameraTransforms.TransformType.FIXED);
    RenderHelper.disableStandardItemLighting();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 18 with RenderItem

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

the class GuiUtil method drawItemStackAt.

public static void drawItemStackAt(ItemStack stack, int x, int y) {
    RenderHelper.enableGUIStandardItemLighting();
    Minecraft mc = Minecraft.getMinecraft();
    RenderItem itemRender = mc.getRenderItem();
    itemRender.renderItemAndEffectIntoGUI(mc.player, stack, x, y);
    itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, stack, x, y, null);
    RenderHelper.disableStandardItemLighting();
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) Minecraft(net.minecraft.client.Minecraft)

Example 19 with RenderItem

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

the class GuiButtonItemTexture method drawButton.

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY, float ticks) {
    if (this.visible) {
        boolean flag = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
        mc.getTextureManager().bindTexture(BUTTON_TEXTURES);
        int u = textureU;
        int v = textureV;
        if (flag) {
            u += mc.fontRenderer.getStringWidth(this.NAME) + 25;
            v += mc.fontRenderer.getStringWidth(this.NAME) + 25;
            GL11.glPushMatrix();
            GL11.glColor4f(0f, 0f, 0f, 1f);
            this.drawTexturedModalRect(this.x, this.y, u, v, mc.fontRenderer.getStringWidth(this.NAME) + 25, height);
            GL11.glPopMatrix();
        }
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glEnable(32826);
        RenderHelper.enableStandardItemLighting();
        RenderHelper.enableGUIStandardItemLighting();
        RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
        itemRenderer.renderItemIntoGUI(itemstack, this.x, this.y);
        this.drawString(mc.fontRenderer, this.NAME, this.x + 20, this.y + 3, Color.white.getRGB());
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 20 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project ImmersiveEngineering by BluSunrize.

the class GuiRevolver method drawExternalGUI.

public static void drawExternalGUI(NonNullList<ItemStack> bullets, int bulletAmount) {
    ClientUtils.bindTexture("immersiveengineering:textures/gui/revolver.png");
    GlStateManager.color(1, 1, 1, 1);
    RenderHelper.disableStandardItemLighting();
    ClientUtils.drawTexturedRect(0, 1, 74, 74, 0 / 256f, 74 / 256f, 51 / 256f, 125 / 256f);
    if (bulletAmount >= 18)
        ClientUtils.drawTexturedRect(47, 1, 103, 74, 74 / 256f, 177 / 256f, 51 / 256f, 125 / 256f);
    else if (bulletAmount > 8)
        ClientUtils.drawTexturedRect(57, 1, 79, 39, 57 / 256f, 136 / 256f, 12 / 256f, 51 / 256f);
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableDepth();
    RenderItem ir = ClientUtils.mc().getRenderItem();
    int[][] slots = ContainerRevolver.slotPositions[bulletAmount >= 18 ? 2 : bulletAmount > 8 ? 1 : 0];
    for (int i = 0; i < bulletAmount; i++) {
        ItemStack b = bullets.get(i);
        if (!b.isEmpty()) {
            int x;
            int y;
            if (i == 0) {
                x = 29;
                y = 3;
            } else if (i - 1 < slots.length) {
                x = slots[i - 1][0];
                y = slots[i - 1][1];
            } else {
                int ii = i - (slots.length + 1);
                x = ii == 0 ? 48 : ii == 1 ? 29 : ii == 3 ? 2 : 10;
                y = ii == 1 ? 57 : ii == 3 ? 30 : ii == 4 ? 11 : 49;
            }
            ir.renderItemIntoGUI(b, x, y);
        }
    }
    GlStateManager.disableDepth();
}
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