use of net.minecraft.client.renderer.RenderItem in project GregTech by GregTechCE.
the class FacadeRenderer method renderItemCover.
public static void renderItemCover(CCRenderState ccrs, int side, ItemStack renderStack, Cuboid6 bounds) {
Minecraft minecraft = Minecraft.getMinecraft();
RenderItem renderItem = minecraft.getRenderItem();
IBakedModel model = renderItem.getItemModelWithOverrides(renderStack, null, null);
IBlockState state = FacadeHelper.lookupBlockForItem(renderStack);
String cacheKey = state.getBlock().getRegistryName() + "|" + state.getBlock().getMetaFromState(state);
List<CCQuad> renderQuads = itemQuadCache.getIfPresent(cacheKey);
if (renderQuads == null) {
List<BakedQuad> quads = new ArrayList<>(model.getQuads(null, null, 0));
for (EnumFacing face : EnumFacing.VALUES) {
quads.addAll(model.getQuads(null, face, 0));
}
renderQuads = applyItemTint(sliceQuads(CCQuad.fromArray(quads), side, bounds), renderStack);
itemQuadCache.put(cacheKey, renderQuads);
}
AdvCCRSConsumer consumer = new AdvCCRSConsumer(ccrs);
consumer.setTranslation(new Matrix4().translate(Vector3.center.copy().subtract(bounds.center())).scale(1.05, 1.05, 1.05));
for (CCQuad quad : renderQuads) {
quad.pipe(consumer);
}
}
use of net.minecraft.client.renderer.RenderItem in project SilentGems by SilentChaos512.
the class RenderTileChaosAltar method renderItem.
private void renderItem(World world, ItemStack stack, float partialTicks) {
RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
if (stack != null) {
// GlStateManager.translate(0.5, 0.5, 0.5);
EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, stack.copy());
StackHelper.setCount(entityitem.getEntityItem(), 1);
entityitem.hoverStart = 0.0F;
GlStateManager.pushMatrix();
GlStateManager.disableLighting();
float rotation = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
GlStateManager.rotate(rotation, 0.0F, 1.0F, 0);
Vec3d vec = new Vec3d(0.0, 0.25, 0.0);
GlStateManager.translate(vec.xCoord, vec.yCoord, vec.zCoord);
float scale = 0.5f;
GlStateManager.scale(scale, scale, scale);
GlStateManager.pushAttrib();
RenderHelper.enableStandardItemLighting();
itemRenderer.renderItem(entityitem.getEntityItem(), ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting();
GlStateManager.popAttrib();
GlStateManager.enableLighting();
GlStateManager.popMatrix();
}
}
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();
}
Aggregations