本文整理匯總了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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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);
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
}
}
示例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);
}