use of net.minecraft.client.renderer.RenderItem in project minecolonies by Minecolonies.
the class ItemIcon method drawItemStack.
/**
* Modified from GuiContainer
*/
private void drawItemStack(final ItemStack stack, final int x, final int y) {
if (ItemStackUtils.isEmpty(itemStack)) {
return;
}
final RenderItem itemRender = mc.getRenderItem();
GlStateManager.translate(x, y, GUI_ITEM_Z_TRANSLATE);
GlStateManager.scale(this.getWidth() / DEFAULT_ITEMSTACK_SIZE, this.getHeight() / DEFAULT_ITEMSTACK_SIZE, 1f);
FontRenderer font = stack.getItem().getFontRenderer(stack);
if (font == null) {
font = mc.fontRenderer;
}
itemRender.renderItemAndEffectIntoGUI(stack, 0, 0);
itemRender.renderItemOverlayIntoGUI(font, stack, 0, 0, null);
}
use of net.minecraft.client.renderer.RenderItem in project Binnie by ForestryMC.
the class FlowerAlyzerPlugin method drawAnalyticsPage1.
@SideOnly(Side.CLIENT)
@Override
public void drawAnalyticsPage1(GuiScreen gui, ItemStack itemStack) {
lastTopOffset = 10;
guiLeft = (gui.width - 246) / 2;
guiTop = (gui.height - 238) / 2;
IFlower flower = BotanyAPI.flowerRoot.getMember(itemStack);
if (flower == null) {
return;
}
ItemStack renderP = getIconStacks().get(flower.getGenome().getPrimary().getUID());
ItemStack renderS = getIconStacks().get(flower.getGenome().getSecondary().getUID());
gui.mc.fontRenderer.drawString("Active", guiLeft + 10 + COLUMN_1, guiTop + 10, 0xffffff);
gui.mc.fontRenderer.drawString("Inactive", guiLeft + 10 + COLUMN_2, guiTop + 10, 0xffffff);
if (renderP != null && renderS != null) {
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
itemRender.renderItemAndEffectIntoGUI(renderP, guiLeft + 10 + COLUMN_1, guiTop + 10 + 12);
itemRender.renderItemOverlayIntoGUI(gui.mc.fontRenderer, renderP, guiLeft + 10 + COLUMN_1, guiTop + 10 + 12, null);
itemRender.renderItemAndEffectIntoGUI(renderS, guiLeft + 10 + COLUMN_2, guiTop + 10 + 12);
itemRender.renderItemOverlayIntoGUI(gui.mc.fontRenderer, renderS, guiLeft + 10 + COLUMN_1, guiTop + 10 + 12, null);
}
guiTop += ROW_SIZE * 3;
for (EnumFlowerChromosome chromosom : firstPageChromosome) {
drawChromosome(gui, chromosom, flower);
}
}
use of net.minecraft.client.renderer.RenderItem in project Binnie by ForestryMC.
the class RenderUtil method drawItem.
public static void drawItem(final Point pos, final ItemStack itemStack, final boolean rotating) {
GlStateManager.enableBlend();
GlStateManager.enableDepth();
GlStateManager.pushAttrib();
Preconditions.checkNotNull(itemStack);
Minecraft minecraft = Minecraft.getMinecraft();
RenderHelper.enableGUIStandardItemLighting();
RenderItem renderItem = minecraft.getRenderItem();
FontRenderer font = getFontRenderer(minecraft, itemStack);
if (rotating) {
GlStateManager.pushMatrix();
final float phase = Minecraft.getSystemTime() / 20;
/**
* {@link RenderItem#setupGuiTransform(int, int, boolean)} It adds 100 to zLevel from
* {@link RenderItem#renderItemAndEffectIntoGUI(net.minecraft.entity.EntityLivingBase, net.minecraft.item.ItemStack, int, int)}.
* So z=150
*/
GlStateManager.translate(8, 8, 150);
GlStateManager.rotate(phase, 0, -0.866f, 0.5f);
GlStateManager.translate(-8, -8, -150);
}
renderItem.renderItemAndEffectIntoGUI(null, itemStack, pos.xPos(), pos.yPos());
if (rotating) {
GlStateManager.popMatrix();
}
renderItem.renderItemOverlayIntoGUI(font, itemStack, pos.xPos(), pos.yPos(), null);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib();
GlStateManager.disableBlend();
GlStateManager.disableDepth();
}
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, float partialTicks) {
if (this.visible) {
ClientUtils.bindTexture("immersiveengineering:textures/gui/hud_elements.png");
GlStateManager.color(1.0F, 1.0F, 1.0F, 0.5F);
this.hovered = mouseX >= this.x && mouseY >= this.y && mouseX < this.x + this.width && mouseY < this.y + this.height;
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
GlStateManager.blendFunc(770, 771);
this.drawTexturedModalRect(x, y, 24 + (state ? 18 : 0), 128, width, height);
this.mouseDragged(mc, mouseX, mouseY);
if (!item.isEmpty()) {
this.zLevel = 200.0F;
RenderItem itemRender = mc.getRenderItem();
itemRender.zLevel = 200.0F;
FontRenderer font = item.getItem().getFontRenderer(item);
if (font == null)
font = mc.fontRenderer;
itemRender.renderItemAndEffectIntoGUI(item, x + 1, y + 1);
this.zLevel = 0.0F;
itemRender.zLevel = 0.0F;
if (!state) {
RenderHelper.enableStandardItemLighting();
GlStateManager.disableLighting();
GlStateManager.disableDepth();
ClientUtils.drawColouredRect(x + 1, y + 1, 16, 16, 0x77444444);
GlStateManager.enableLighting();
GlStateManager.enableDepth();
}
RenderHelper.disableStandardItemLighting();
}
}
}
use of net.minecraft.client.renderer.RenderItem in project LogisticsPipes by RS485.
the class ItemStackRenderer method renderInWorld.
public void renderInWorld() {
assert renderManager != null;
assert renderItem != null;
assert scaleX != 0.0F;
assert scaleY != 0.0F;
assert scaleZ != 0.0F;
if (entityitem == null || !ItemStack.areItemStacksEqual(entityitem.getItem(), itemstack)) {
Objects.requireNonNull(world, "World is needed for EntityItem creation");
if (itemstack.isEmpty()) {
// :itemcard: 🤷
itemstack = new ItemStack(LPItems.itemCard);
}
entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, itemstack);
entityitem.getItem().setCount(1);
entityitem.hoverStart = 0.0F;
}
Item item = itemstack.getItem();
if (item instanceof ItemBlock) {
Block block = ((ItemBlock) item).getBlock();
if (block instanceof BlockPane) {
GlStateManager.scale(0.5F, 0.5F, 0.5F);
}
} else if (item == LPItems.requestTable) {
GlStateManager.scale(0.5F, 0.5F, 0.5F);
}
itemEntityRenderer.doRender(entityitem, posX, posY, zLevel, 0.0F, partialTickTime);
}
Aggregations