Search in sources :

Example 1 with RenderItem

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

the class GuiButtonItem method drawButton.

@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
    if (this.visible) {
        ClientUtils.bindTexture("immersiveengineering:textures/gui/hudElements.png");
        GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
        this.hovered = mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
        GlStateManager.enableBlend();
        GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
        GlStateManager.blendFunc(770, 771);
        this.drawTexturedModalRect(xPosition, yPosition, 24 + (state ? 18 : 0), 128, width, height);
        this.mouseDragged(mc, mouseX, mouseY);
        if (item != null) {
            this.zLevel = 200.0F;
            RenderItem itemRender = mc.getRenderItem();
            itemRender.zLevel = 200.0F;
            FontRenderer font = item.getItem().getFontRenderer(item);
            if (font == null)
                font = mc.fontRendererObj;
            itemRender.renderItemAndEffectIntoGUI(item, xPosition + 1, yPosition + 1);
            this.zLevel = 0.0F;
            itemRender.zLevel = 0.0F;
            if (!state) {
                RenderHelper.enableStandardItemLighting();
                GlStateManager.disableLighting();
                GlStateManager.disableDepth();
                ClientUtils.drawColouredRect(xPosition + 1, yPosition + 1, 16, 16, 0x77444444);
                GlStateManager.enableLighting();
                GlStateManager.enableDepth();
            }
            RenderHelper.disableStandardItemLighting();
        }
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 2 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project SilentGems by SilentChaos512.

the class GuiQuiverArrowOverlay method renderArrow.

private void renderArrow(ItemStack stack, int count, EntityPlayer player) {
    Minecraft mc = Minecraft.getMinecraft();
    RenderItem itemRenderer = mc.getRenderItem();
    FontRenderer fontRenderer = mc.fontRenderer;
    ScaledResolution res = new ScaledResolution(mc);
    int y = res.getScaledHeight() - 19;
    int x = res.getScaledWidth() / 2 + 97;
    itemRenderer.renderItemAndEffectIntoGUI(player, stack, x, y);
    // this.itemRenderer.renderItemOverlays(this.mc.fontRenderer, stack, p_184044_1_, p_184044_2_);
    String str = Integer.toString(count);
    int strWidth = fontRenderer.getStringWidth(str);
    fontRenderer.drawStringWithShadow(str, x + 14, y + 9, 0xFFFFFF);
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) ScaledResolution(net.minecraft.client.gui.ScaledResolution) FontRenderer(net.minecraft.client.gui.FontRenderer) Minecraft(net.minecraft.client.Minecraft)

Example 3 with RenderItem

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

the class FarmLogicSlot method draw.

@Override
public void draw(int startX, int startY) {
    if (!getStackIndex().isEmpty()) {
        Minecraft minecraft = Minecraft.getMinecraft();
        TextureManager textureManager = minecraft.getTextureManager();
        textureManager.bindTexture(getLogic().getTextureMap());
        RenderItem renderItem = minecraft.getRenderItem();
        renderItem.renderItemIntoGUI(getStackIndex(), startX + xPos, startY + yPos);
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) TextureManager(net.minecraft.client.renderer.texture.TextureManager) Minecraft(net.minecraft.client.Minecraft)

Example 4 with RenderItem

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

the class GuiAutoCrafting 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 5 with RenderItem

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

the class ConfigSlotElement method draw.

@Override
public void draw(GuiBase gui) {
    super.draw(gui);
    ItemStack stack = inventory.getStackInSlot(id);
    int xPos = x + 1 + gui.guiLeft;
    int yPos = y + 1 + gui.guiTop;
    GlStateManager.enableDepth();
    GlStateManager.pushMatrix();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
    renderItem.renderItemAndEffectIntoGUI(gui.mc.player, stack, xPos, yPos);
    renderItem.renderItemOverlayIntoGUI(gui.mc.fontRenderer, stack, xPos, yPos, null);
    GlStateManager.disableDepth();
    GlStateManager.disableLighting();
    GlStateManager.popMatrix();
    if (isHovering) {
        drawSprite(gui, type.getButtonHoverOverlay(), x, y);
    }
    elements.forEach(elementBase -> elementBase.draw(gui));
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) ItemStack(net.minecraft.item.ItemStack)

Aggregations

RenderItem (net.minecraft.client.renderer.RenderItem)51 ItemStack (net.minecraft.item.ItemStack)17 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