use of net.minecraft.client.renderer.RenderItem in project Metalworks by canitzp.
the class Util method renderItemInWorld.
@SideOnly(Side.CLIENT)
public static void renderItemInWorld(ItemStack stack) {
if (!stack.isEmpty()) {
Minecraft mc = Minecraft.getMinecraft();
RenderItem renderer = mc.getRenderItem();
TextureManager manager = mc.getTextureManager();
IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null);
manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.pushMatrix();
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.FIXED, false);
renderer.renderItem(stack, model);
GlStateManager.cullFace(GlStateManager.CullFace.BACK);
GlStateManager.popMatrix();
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
manager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
}
}
use of net.minecraft.client.renderer.RenderItem in project ForestryMC by ForestryMC.
the class WidgetCamouflageTab method draw.
@Override
public void draw(int startX, int startY) {
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft minecraft = Minecraft.getMinecraft();
TextureManager textureManager = minecraft.getTextureManager();
textureManager.bindTexture(manager.gui.textureFile);
manager.gui.drawTexturedModalRect(startX + xPos, startY + yPos, 196, 0, 48, 25);
if (handlerSlot != null) {
manager.gui.drawTexturedModalRect(startX + xPos + 44, startY + yPos, 196, 25, 24, 25);
}
if (!typeStack.isEmpty()) {
textureManager.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderItem renderItem = minecraft.getRenderItem();
renderItem.renderItemIntoGUI(typeStack, startX + xPos + 6, startY + yPos + 6);
}
greenhouseSlot.draw(startX, startY);
if (handlerSlot != null) {
handlerSlot.draw(startX, startY);
}
}
use of net.minecraft.client.renderer.RenderItem in project ForestryMC by ForestryMC.
the class WidgetClimateModifier method draw.
public void draw(int startX, int startY) {
if (!isVisible()) {
return;
}
TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
textureManager.bindTexture(modifier.getTextureMap());
TextureAtlasSprite icon = modifier.getIcon();
if (icon == null) {
RenderHelper.enableGUIStandardItemLighting();
ItemStack stack = modifier.getIconItemStack();
FontRenderer font = null;
if (!stack.isEmpty()) {
font = stack.getItem().getFontRenderer(stack);
}
if (font == null) {
font = parent.gui.getFontRenderer();
}
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
itemRender.renderItemAndEffectIntoGUI(null, stack, xPos + startX, yPos + startY);
itemRender.renderItemOverlayIntoGUI(font, stack, xPos + startX, yPos + startY, null);
RenderHelper.disableStandardItemLighting();
} else {
parent.gui.drawTexturedModalRect(startX + xPos, startY + yPos, icon, 16, 16);
}
}
use of net.minecraft.client.renderer.RenderItem in project ForestryMC by ForestryMC.
the class GuiUtil method drawItemStack.
public static void drawItemStack(FontRenderer fontRenderer, ItemStack stack, int xPos, int yPos) {
FontRenderer font = null;
if (!stack.isEmpty()) {
font = stack.getItem().getFontRenderer(stack);
}
if (font == null) {
font = fontRenderer;
}
RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
itemRender.renderItemAndEffectIntoGUI(stack, xPos, yPos);
itemRender.renderItemOverlayIntoGUI(font, stack, xPos, yPos, null);
}
use of net.minecraft.client.renderer.RenderItem in project GregTech by GregTechCE.
the class Widget method drawItemStack.
@SideOnly(Side.CLIENT)
protected static void drawItemStack(ItemStack itemStack, int x, int y, @Nullable String altTxt) {
GlStateManager.pushMatrix();
GlStateManager.translate(0.0F, 0.0F, 32.0F);
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.enableRescaleNormal();
GlStateManager.enableLighting();
RenderHelper.enableGUIStandardItemLighting();
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, 240.0f, 240.0f);
Minecraft mc = Minecraft.getMinecraft();
RenderItem itemRender = mc.getRenderItem();
itemRender.renderItemAndEffectIntoGUI(itemStack, x, y);
itemRender.renderItemOverlayIntoGUI(mc.fontRenderer, itemStack, x, y, altTxt);
GlStateManager.disableRescaleNormal();
GlStateManager.disableLighting();
GlStateManager.color(1F, 1F, 1F, 1F);
GlStateManager.popMatrix();
GlStateManager.enableBlend();
GlStateManager.disableDepth();
}
Aggregations