Search in sources :

Example 11 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project RFTools by McJty.

the class RenderGameOverlayEventHandler method renderBuffs.

private static void renderBuffs() {
    if (buffs == null || buffs.isEmpty()) {
        return;
    }
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    PreferencesProperties preferences = McJtyLib.getPreferencesProperties(player);
    int x = preferences.getBuffX();
    int y = preferences.getBuffY();
    if (x == -1 || y == -1) {
        return;
    }
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    for (PlayerBuff buff : buffs) {
        Item item = getBuffItem(buff);
        if (item != null) {
            RenderItem itemRender = Minecraft.getMinecraft().getRenderItem();
            RenderHelper.renderItemStack(Minecraft.getMinecraft(), itemRender, new ItemStack(item), x, y, "", false);
            // itemRender.renderItem(new ItemStack(item), player, ItemCameraTransforms.TransformType.FIXED, true);
            x += BUFF_ICON_SIZE;
        }
    }
}
Also used : PreferencesProperties(mcjty.lib.preferences.PreferencesProperties) RenderItem(net.minecraft.client.renderer.RenderItem) Item(net.minecraft.item.Item) RenderItem(net.minecraft.client.renderer.RenderItem) EntityPlayerSP(net.minecraft.client.entity.EntityPlayerSP) ItemStack(net.minecraft.item.ItemStack)

Example 12 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project BloodMagic by WayofTime.

the class RenderDemonCrucible method renderItem.

private void renderItem(World world, ItemStack stack, float partialTicks) {
    RenderItem itemRenderer = mc.getRenderItem();
    if (!stack.isEmpty()) {
        GlStateManager.translate(0.5, 1.5, 0.5);
        EntityItem entityitem = new EntityItem(world, 0.0D, 0.0D, 0.0D, stack);
        entityitem.getItem().setCount(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);
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        GlStateManager.pushAttrib();
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(entityitem.getItem(), ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.popAttrib();
        GlStateManager.enableLighting();
        GlStateManager.popMatrix();
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) EntityItem(net.minecraft.entity.item.EntityItem)

Example 13 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Solar by Martacus.

the class RenderMenhir method render.

@Override
public void render(TileMenhir tileEntity, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
    if (tileEntity.getBaseMenhir() != tileEntity) {
        return;
    }
    ItemStack inputStack = tileEntity.getItemStackHandler().getStackInSlot(0);
    if (inputStack.isEmpty()) {
        return;
    }
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    if (!inputStack.isEmpty()) {
        GlStateManager.translate(0.5, 1.5, 0);
        GlStateManager.disableLighting();
        IBlockState blockState = tileEntity.getWorld().getBlockState(tileEntity.getPos().add(0, 1, 0));
        if (blockState.getBlock() != ModBlocks.MENHIR) {
            return;
        }
        EnumFacing enumFace = blockState.getValue(BlockMenhir.FACING);
        if (enumFace == EnumFacing.NORTH) {
            GlStateManager.translate(0, 0, 0.1);
        } else if (enumFace == EnumFacing.SOUTH) {
            GlStateManager.translate(0, 0, 0.9);
        } else if (enumFace == EnumFacing.WEST) {
            GlStateManager.rotate(90, 0.0F, 1.0F, 0);
            GlStateManager.translate(-0.5, 0, -0.4);
        } else if (enumFace == EnumFacing.EAST) {
            GlStateManager.rotate(90, 0.0F, 1.0F, 0);
            GlStateManager.translate(-0.5, 0, 0.4);
        }
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(inputStack, ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.enableLighting();
    }
    GlStateManager.popMatrix();
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem) IBlockState(net.minecraft.block.state.IBlockState) EnumFacing(net.minecraft.util.EnumFacing) ItemStack(net.minecraft.item.ItemStack)

Example 14 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Solar by Martacus.

the class RenderUtil method renderRisingFromTopOfBlock.

public static void renderRisingFromTopOfBlock(ItemStack renderItem, float height, float rotation) {
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    if (!renderItem.isEmpty()) {
        GlStateManager.translate(0.5, 1 + height, 0.5);
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        GlStateManager.rotate(rotation, 0F, 1.0F, 1f);
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(renderItem, ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.enableLighting();
        GlStateManager.popMatrix();
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Example 15 with RenderItem

use of net.minecraft.client.renderer.RenderItem in project Solar by Martacus.

the class RenderUtil method renderItemFloatingOnTileEntity.

public static void renderItemFloatingOnTileEntity(ItemStack renderItem) {
    RenderItem itemRenderer = Minecraft.getMinecraft().getRenderItem();
    if (!renderItem.isEmpty()) {
        GlStateManager.translate(0.5, 2, 0.5);
        GlStateManager.pushMatrix();
        GlStateManager.disableLighting();
        float rotation = (float) (720.0 * (System.currentTimeMillis() & 0x3FFFL) / 0x3FFFL);
        GlStateManager.rotate(rotation, 0.0F, 1.0F, 0);
        GlStateManager.scale(0.5F, 0.5F, 0.5F);
        RenderHelper.enableStandardItemLighting();
        itemRenderer.renderItem(renderItem, ItemCameraTransforms.TransformType.FIXED);
        RenderHelper.disableStandardItemLighting();
        GlStateManager.enableLighting();
        GlStateManager.popMatrix();
    }
}
Also used : RenderItem(net.minecraft.client.renderer.RenderItem)

Aggregations

RenderItem (net.minecraft.client.renderer.RenderItem)55 ItemStack (net.minecraft.item.ItemStack)18 Minecraft (net.minecraft.client.Minecraft)11 FontRenderer (net.minecraft.client.gui.FontRenderer)10 Item (net.minecraft.item.Item)7 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)6 ModelResourceLocation (net.minecraft.client.renderer.block.model.ModelResourceLocation)6 EntityItem (net.minecraft.entity.item.EntityItem)6 ItemModelMesher (net.minecraft.client.renderer.ItemModelMesher)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 TextureManager (net.minecraft.client.renderer.texture.TextureManager)4 ArrayList (java.util.ArrayList)3 IBlockState (net.minecraft.block.state.IBlockState)3 ItemBlock (net.minecraft.item.ItemBlock)3 Vec3d (net.minecraft.util.math.Vec3d)3 Block (net.minecraft.block.Block)2 EntityPlayerSP (net.minecraft.client.entity.EntityPlayerSP)2 ScaledResolution (net.minecraft.client.gui.ScaledResolution)2 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)2 EnumFacing (net.minecraft.util.EnumFacing)2