当前位置: 首页>>代码示例>>Java>>正文


Java RenderItem.renderItemAndEffectIntoGUI方法代码示例

本文整理汇总了Java中net.minecraft.client.renderer.RenderItem.renderItemAndEffectIntoGUI方法的典型用法代码示例。如果您正苦于以下问题:Java RenderItem.renderItemAndEffectIntoGUI方法的具体用法?Java RenderItem.renderItemAndEffectIntoGUI怎么用?Java RenderItem.renderItemAndEffectIntoGUI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.renderer.RenderItem的用法示例。


在下文中一共展示了RenderItem.renderItemAndEffectIntoGUI方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: drawDisabledSlot

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
/**
 * Draws a slot that is disabled...
 *
 * @param x          slot x
 * @param y          slot y
 * @param renderItem Item Render
 */
public static void drawDisabledSlot(int x, int y, RenderItem renderItem) {
    new GuiUtils().zLevel = 100.f;
    renderItem.zLevel = 100.0f;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int colorOverlay = new Color(139, 139, 139, 200).hashCode();
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    renderItem.renderItemAndEffectIntoGUI(new ItemStack(Blocks.AIR), x, y);
    new GuiUtils().drawGradientRect(x, y, x + 16, y + 16, colorOverlay, colorOverlay);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    new GuiUtils().zLevel = 0.0f;
    renderItem.zLevel = 0.0f;
}
 
开发者ID:TheDragonTeam,项目名称:TheDragonLib,代码行数:27,代码来源:GuiUtils.java

示例2: drawDisabledSlot

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
/**
 * Draws a slot that is disabled...
 *
 * @param x          slot x
 * @param y          slot y
 * @param renderItem Item Render
 */
public void drawDisabledSlot(int x, int y, RenderItem renderItem) {
    this.zLevel = 100.f;
    renderItem.zLevel = 100.0f;

    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int colorOverlay = new Color(139, 139, 139, 200).hashCode();
    GlStateManager.disableLighting();
    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    renderItem.renderItemAndEffectIntoGUI(new ItemStack(Blocks.BARRIER), x, y);
    this.drawGradientRect(x, y, x + 16, y + 16, colorOverlay, colorOverlay);
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableLighting();
    GlStateManager.enableDepth();
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);

    this.zLevel = 0.0f;
    renderItem.zLevel = 0.0f;
}
 
开发者ID:The-Acronym-Coders,项目名称:T.E.C.H,代码行数:27,代码来源:GuiHelper.java

示例3: drawItemStack

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
protected void drawItemStack(@Nonnull ItemStack stack, int x, int y, String overlayText) {
	if (stack.isEmpty()) return;

	RenderHelper.enableGUIStandardItemLighting();
	final RenderItem itemRenderer = parent.getItemRenderer();
	GlStateManager.translate(0.0F, 0.0F, 32.0F);
	this.zLevel = 200.0F;
	itemRenderer.zLevel = 200.0F;

	FontRenderer font = null;
	font = stack.getItem().getFontRenderer(stack);
	if (font == null) font = parent.getFontRenderer();

	itemRenderer.renderItemAndEffectIntoGUI(stack, x, y);
	itemRenderer.renderItemOverlayIntoGUI(font, stack, x, y, overlayText);
	this.zLevel = 0.0F;
	itemRenderer.zLevel = 0.0F;
	RenderHelper.disableStandardItemLighting();
}
 
开发者ID:OpenMods,项目名称:OpenModsLib,代码行数:20,代码来源:BaseComponent.java

示例4: drawItemStack

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
/**
 * Draws a transparent item in the slot
 *
 * @param itemStack  item to draw
 * @param x          slot x
 * @param y          slot y
 * @param renderItem Item Render
 */
public void drawItemStack(ItemStack itemStack, int x, int y, RenderItem renderItem, boolean transparent) {
    this.zLevel = 50.0f;
    renderItem.zLevel = 50.0f;

    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
    int colorOverlay = new Color(139, 139, 139, 160).hashCode();

    RenderHelper.enableGUIStandardItemLighting();
    renderItem.renderItemAndEffectIntoGUI(itemStack, x, y);

    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GlStateManager.disableDepth();
    GlStateManager.colorMask(true, true, true, false);
    if (transparent) {
        this.zLevel = 100.0f;
        renderItem.zLevel = 100.0f;
        this.drawGradientRect(x, y, x + 16, y + 16, colorOverlay, colorOverlay);
    }
    GlStateManager.colorMask(true, true, true, true);
    GlStateManager.enableDepth();

    GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

    this.zLevel = 0.0f;
    renderItem.zLevel = 0.0f;
}
 
开发者ID:The-Acronym-Coders,项目名称:T.E.C.H,代码行数:37,代码来源:GuiHelper.java

示例5: drawItem

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
public static void drawItem(int i, int j, ItemStack itemstack, FontRenderer fontRenderer) {
    enable3DRender();
    RenderItem drawItems = getRenderItem();
    float zLevel = drawItems.zLevel += 100F;
    try {
        drawItems.renderItemAndEffectIntoGUI(itemstack, i, j);
        drawItems.renderItemOverlays(fontRenderer, itemstack, i, j);

        if (!checkMatrixStack()) {
            throw new IllegalStateException("Modelview matrix stack too deep");
        }
        if (Tessellator.getInstance().getBuffer().isDrawing) {
            throw new IllegalStateException("Still drawing");
        }
    } catch (Exception e) {
        LogHelper.errorOnce(e, itemstack.toString(), "Error whilst rendering: " + itemstack);

        restoreMatrixStack();
        if (Tessellator.getInstance().getBuffer().isDrawing) {
            Tessellator.getInstance().draw();
        }

        drawItems.zLevel = zLevel;
        drawItems.renderItemIntoGUI(new ItemStack(Blocks.STONE), i, j);
    }

    enable2DRender();
    drawItems.zLevel = zLevel - 100;
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:30,代码来源:GuiHelper.java

示例6: renderItemStack

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
public static boolean renderItemStack(Minecraft mc, RenderItem itemRender, ItemStack itm, int x, int y, String txt, boolean highlight){
    GL11.glColor3f(1F, 1F, 1F);

    boolean isLightingEnabled = GL11.glIsEnabled(GL11.GL_LIGHTING);

    boolean rc = false;
    if (highlight){
        GL11.glDisable(GL11.GL_LIGHTING);
        drawVerticalGradientRect(x, y, x+16, y+16, 0x80ffffff, 0xffffffff);
    }
    if (itm != null && itm.getItem() != null) {
        rc = true;
        boolean isRescaleNormalEnabled = GL11.glIsEnabled(GL12.GL_RESCALE_NORMAL);
        GL11.glPushMatrix();
        GL11.glTranslatef(0.0F, 0.0F, 32.0F);
        GL11.glColor4f(1F, 1F, 1F, 1F);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glEnable(GL11.GL_LIGHTING);
        short short1 = 240;
        short short2 = 240;
        net.minecraft.client.renderer.RenderHelper.enableGUIStandardItemLighting();
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, short1 / 1.0F, short2 / 1.0F);
        itemRender.renderItemAndEffectIntoGUI(itm, x, y);
        itemRender.renderItemOverlayIntoGUI(mc.fontRendererObj, itm, x, y, txt);
        GL11.glPopMatrix();
        if (isRescaleNormalEnabled) {
            GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        } else {
            GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        }
    }

    if (isLightingEnabled) {
        GL11.glEnable(GL11.GL_LIGHTING);
    } else {
        GL11.glDisable(GL11.GL_LIGHTING);
    }

    return rc;
}
 
开发者ID:McJty,项目名称:AquaMunda,代码行数:41,代码来源:RenderHelper.java

示例7: renderItemOnScreen

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public void renderItemOnScreen(ItemStack current, int x, int y) {
  if (current == null) {
    return;
  }
  RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
  GlStateManager.color(1, 1, 1, 1);
  RenderHelper.enableStandardItemLighting();
  RenderHelper.enableGUIStandardItemLighting();
  itemRender.renderItemAndEffectIntoGUI(current, x, y);
  RenderHelper.disableStandardItemLighting();
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:14,代码来源:ClientProxy.java

示例8: renderItemOnGui

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
/**
 * In a GUI we already have the context of the itemrender and font
 */
public void renderItemOnGui(ItemStack stack, RenderItem itemRender, FontRenderer fontRendererObj, int x, int y) {
  if (stack == null) {
    return;
  }
  itemRender.renderItemAndEffectIntoGUI(stack, x, y);
  itemRender.renderItemOverlays(fontRendererObj, stack, x, y);
}
 
开发者ID:PrinceOfAmber,项目名称:Cyclic,代码行数:11,代码来源:ClientProxy.java

示例9: drawItem

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
@Override
protected void drawItem(ItemResourceDelegate item, Minecraft mc, RenderItem itemRender, double left, double top, float partialTicks, boolean isHighlighted)
{
    int x = (int)left;
    int y = (int)top;
    
    ItemStack stack = item.displayStack();
    GlStateManager.enableLighting();
    itemRender.renderItemAndEffectIntoGUI(stack, x, y);
    itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, stack, x, y, "");
    
    // itemRender doesn't clean this up, messes up highlight boxes
    this.drawQuantity(item.getQuantity(), x, y);
 }
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:15,代码来源:ItemStackPicker.java

示例10: renderItemAndEffectIntoGui

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
/** 
     * Size is in pixels.
     * Hat tip to McJty.
     */
    public static boolean renderItemAndEffectIntoGui(Minecraft mc, RenderItem itemRender, ItemStack itm, double x, double y, double contentSize)
    {
        boolean rc = false;

        if (itm != null && itm.getItem() != null) {
            rc = true;
            
            RenderHelper.enableGUIStandardItemLighting();
            GlStateManager.pushMatrix();
            GlStateManager.translate(x, y, 0);
            GlStateManager.scale(1 / 16f, 1 / 16f, 1 / 16f);
            GlStateManager.scale(contentSize, contentSize, contentSize);

            GlStateManager.enableRescaleNormal();
            OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0F, 240.0F);
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            GlStateManager.enableDepth();
 
            itemRender.renderItemAndEffectIntoGUI(itm, 0, 0);

            GlStateManager.popMatrix();
            GlStateManager.enableLighting();
            RenderHelper.disableStandardItemLighting();
//            RenderHelper.enableStandardItemLighting();
        }

        return rc;
    }
 
开发者ID:grondag,项目名称:Hard-Science,代码行数:33,代码来源:GuiUtil.java

示例11: renderItem

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
@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);
    RenderHelper.enableGUIStandardItemLighting();
    GlStateManager.enableRescaleNormal();
    GlStateManager.enableDepth();
    render.renderItemAndEffectIntoGUI(stack, xPos, yPos);
    render.renderItemOverlayIntoGUI(Minecraft.getMinecraft().fontRendererObj, stack, xPos, yPos, "");
    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);
            }
        } else tooltipEntry = false;

        if (accountForContainer) {
            ItemStack containerStack = stack.getItem().getContainerItem(stack);
            if (containerStack != null && containerStack.getItem() != null)
                tooltipContainerStack = containerStack;
        }
    }

    GlStateManager.disableLighting();
}
 
开发者ID:AdlyTempleton,项目名称:Aura-Cascade,代码行数:40,代码来源:PageRecipe.java

示例12: draw

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
@Override
public void draw(int mouseX, int mouseY, float partialTick) {
  RenderHelper.enableGUIStandardItemLighting();
  GL11.glEnable(GL11.GL_BLEND);
  RenderUtil.renderQuad2D(4, 4, 0, gui.getXSize() - 9, gui.getYSize() - 8, new Vector4f(0, 0, 0, 1));
  RenderUtil.renderQuad2D(6, 6, 0, gui.getXSize() - 13, gui.getYSize() - 12, new Vector4f(0.6, 0.6, 0.6, 1));

  Minecraft mc = Minecraft.getMinecraft();
  RenderItem itemRenderer = mc.getRenderItem();

  GL11.glEnable(GL11.GL_DEPTH_TEST);

  List<ItemStack> snapshot = filter.getSnapshot();
  int x = 15;
  int y = 10;
  int count = 0;
  for (ItemStack st : snapshot) {
    if (st != null) {
      itemRenderer.renderItemAndEffectIntoGUI(st, x, y);
    }
    x += 20;
    count++;
    if (count % 9 == 0) {
      x = 15;
      y += 20;
    }
  }
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:29,代码来源:ExistingItemFilterGui.java

示例13: renderItem

import net.minecraft.client.renderer.RenderItem; //导入方法依赖的package包/类
protected void renderItem(RenderItem renderer, FontRenderer font, ItemStack stack, int x, int y) {
    font.setUnicodeFlag(false);
    renderer.renderItemAndEffectIntoGUI(stack, x, y);
    renderer.renderItemOverlays(font, stack, x, y);
    font.setUnicodeFlag(true);
}
 
开发者ID:Guichaguri,项目名称:ProjectEon,代码行数:7,代码来源:RecipeElement.java


注:本文中的net.minecraft.client.renderer.RenderItem.renderItemAndEffectIntoGUI方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。