Search in sources :

Example 1 with IGuiLexiconEntry

use of pokefenn.totemic.api.internal.IGuiLexiconEntry 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)

Aggregations

RenderItem (net.minecraft.client.renderer.RenderItem)1 ItemStack (net.minecraft.item.ItemStack)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1 IGuiLexiconEntry (pokefenn.totemic.api.internal.IGuiLexiconEntry)1 LexiconRecipeMappings (pokefenn.totemic.api.lexicon.LexiconRecipeMappings)1 GuiLexiconEntry (pokefenn.totemic.client.gui.GuiLexiconEntry)1