Java 类net.minecraft.client.renderer.ItemRenderer 实例源码

项目:Backmemed    文件:ShadersRender.java   
public static void renderItemFP(ItemRenderer itemRenderer, float par1, boolean renderTranslucent)
{
    GlStateManager.depthMask(true);

    if (renderTranslucent)
    {
        GlStateManager.depthFunc(519);
        GL11.glPushMatrix();
        IntBuffer intbuffer = Shaders.activeDrawBuffers;
        Shaders.setDrawBuffers(Shaders.drawBuffersNone);
        Shaders.renderItemKeepDepthMask = true;
        itemRenderer.renderItemInFirstPerson(par1);
        Shaders.renderItemKeepDepthMask = false;
        Shaders.setDrawBuffers(intbuffer);
        GL11.glPopMatrix();
    }

    GlStateManager.depthFunc(515);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    itemRenderer.renderItemInFirstPerson(par1);
}
项目:ARKCraft    文件:Utils.java   
public static void setItemRendererEquippProgress(float From0To1, boolean isSmooth)
{
    ItemRenderer IR = Minecraft.getMinecraft().entityRenderer.itemRenderer;
    if (IR != null) try
    {
        if (!isSmooth)
        {
            if (prevEquippedProgress == null) prevEquippedProgress = ItemRenderer.class.getDeclaredField(
                    "prevEquippedProgress");
            prevEquippedProgress.setAccessible(true);
            prevEquippedProgress.setFloat(IR, From0To1);
        }
        if (equippedProgress == null) equippedProgress = ItemRenderer.class.getDeclaredField("equippedProgress");
        equippedProgress.setAccessible(true);
        equippedProgress.setFloat(IR, From0To1);
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
项目:Coding    文件:ItemRenderHelper.java   
private static void renderItemIn2D(Tessellator tess, float minU, float minV, float maxU, float maxV, int scaleX, int scaleY, float negZLevel, boolean isGlowing) {
    if( isGlowing ) {
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_LIGHT0);
        GL11.glDisable(GL11.GL_LIGHT1);
        GL11.glDisable(GL11.GL_COLOR_MATERIAL);

        float prevLGTX = OpenGlHelper.lastBrightnessX;
        float prevLGTY = OpenGlHelper.lastBrightnessY;
        char bright = 0x000F0;
        int brightX = bright % 65536;
        int brightY = bright / 65536;

        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, brightX / 1.0F, brightY / 1.0F);
        ItemRenderer.renderItemIn2D(tess, minU, minV, maxU, maxV, scaleX, scaleY, negZLevel);
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);

        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_LIGHT0);
        GL11.glEnable(GL11.GL_LIGHT1);
        GL11.glEnable(GL11.GL_COLOR_MATERIAL);
    } else {
        ItemRenderer.renderItemIn2D(tess, minU, minV, maxU, maxV, scaleX, scaleY, negZLevel);
    }
}
项目:ComponentEquipment    文件:PersistiumInfuserTileEntityRenderer.java   
private RenderBlocks getRenderBlocks()
{
       RenderBlocks renderBlocksInstance;
       try
       {
        Field field = ItemRenderer.class.getDeclaredFields()[ 4 ];
        field.setAccessible( true );
        renderBlocksInstance = ( RenderBlocks ) field.get( RenderManager.instance.itemRenderer );
       }
       catch ( Exception exception )
       {
        exception.printStackTrace();
        return null;
       }

       return renderBlocksInstance;
}
项目:AdvancedRocketry    文件:RendererBucket.java   
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    // ====================== Render item texture ======================
    FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(item);
    int color = fluidStack.getFluid().getColor();

    IIcon fluidIcon = item.getIconIndex();
    IIcon bucketIcon = Items.bucket.getIconIndex(new ItemStack(Items.bucket));
    if(type == ItemRenderType.INVENTORY) {
        GL11.glEnable(GL11.GL_ALPHA_TEST);
        RenderItem.getInstance().renderIcon(0, 0, bucketIcon, 16, 16);

        GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));

        RenderItem.getInstance().renderIcon(0, 0, fluidIcon, 16, 16);
        GL11.glColor3f(1f, 1f, 1f);
    }
    else {

        ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)bucketIcon).getMinU(), ((IIcon)bucketIcon).getMinV(), ((IIcon)bucketIcon).getMaxU(), ((IIcon)bucketIcon).getMaxV(), ((IIcon)bucketIcon).getIconWidth(), ((IIcon)bucketIcon).getIconHeight(), 0.1f);
        GL11.glColor3ub((byte)((color >>> 16) & 0xFF), (byte)((color >>> 8) & 0xFF), (byte)(color & 0xFF));
        ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)fluidIcon).getMinU(), ((IIcon)fluidIcon).getMinV(), ((IIcon)fluidIcon).getMaxU(), ((IIcon)fluidIcon).getMaxV(), ((IIcon)fluidIcon).getIconWidth(), ((IIcon)fluidIcon).getIconHeight(), 0.1f);
        GL11.glColor3f(1f, 1f, 1f);
    }
}
项目:AdvancedRocketry    文件:RendererLaserGun.java   
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {

    IIcon icon = item.getIconIndex();

    GL11.glPushMatrix();
    if(type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glTranslatef(1.3f, .3f, 0);
        GL11.glRotated(210, 0, 0, 1);
        GL11.glRotated(180, 1, 0, 0);

        ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)icon).getMinU(), ((IIcon)icon).getMinV(), ((IIcon)icon).getMaxU(), ((IIcon)icon).getMaxV(), ((IIcon)icon).getIconWidth(), ((IIcon)icon).getIconHeight(), 0.1f);
    }
    else if(type == ItemRenderType.EQUIPPED) {
        GL11.glTranslatef(0.7f, 1.3f, 0);
        GL11.glRotated(-70, 0, 0, 1);
        GL11.glRotated(180, 1, 0, 0);
        ItemRenderer.renderItemIn2D(Tessellator.instance, ((IIcon)icon).getMinU(), ((IIcon)icon).getMinV(), ((IIcon)icon).getMaxU(), ((IIcon)icon).getMaxV(), ((IIcon)icon).getIconWidth(), ((IIcon)icon).getIconHeight(), 0.1f);

    }
        GL11.glPopMatrix();
}
项目:Gadomancy    文件:RenderGolemHelper.java   
public static void renderCore(EntityGolemBase golem, AdditionalGolemCore core) {
    GL11.glPushMatrix();

    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
    GL11.glTranslatef(0.0875F, -0.96F, 0.15F + (golem.getGolemDecoration().contains("P") ? 0.03F : 0.0F));
    GL11.glScaled(0.175D, 0.175D, 0.175D);
    GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);

    ItemStack coreItem = core.getItem();
    IIcon icon = coreItem.getItem().getIcon(coreItem, 0);
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMinU();
    float f4 = icon.getMaxV();
    Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
    ItemRenderer.renderItemIn2D(Tessellator.instance, f1, f2, f3, f4, icon.getIconWidth(), icon.getIconHeight(), 0.2F);

    GL11.glPopMatrix();
}
项目:MineFantasy    文件:TileEntityFurnaceRendererMF.java   
private void renderDoor(TileEntityFurnaceMF tile, int x, int y, int w, int h, int tw, int th) {
    Minecraft mc = Minecraft.getMinecraft();

    float f = 0.01F / (float)tw;
    float f1 = 0.01F / (float)th;

    float x1 = (float)x / (float)tw + f;
    float x2 = (float)(x + w) / tw - f;
    float y1 = (float)y / th + f1;
    float y2 = (float)(y + h) / th - f1;

    Tessellator image = Tessellator.instance;
    float xPos = 0.5F;
    float yPos = 0.0F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
    float var13 = 1F;
    GL11.glScalef(var13, var13, var13);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-1F, -1F, 0.0F);
    ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);


}
项目:MineFantasy    文件:TileEntityFurnaceRendererMF.java   
private void renderDoorHeater(TileEntityFurnaceMF tile, int x, int y, int w, int h, int tw, int th) {
    Minecraft mc = Minecraft.getMinecraft();

    float f = 0.01F / (float)tw;
    float f1 = 0.01F / (float)th;

    float x1 = (float)x / (float)tw + f;
    float x2 = (float)(x + w) / tw - f;
    float y1 = (float)y / th + f1;
    float y2 = (float)(y + h) / th - f1;

    Tessellator image = Tessellator.instance;
    float xPos = 0.5F;
    float yPos = 1.0F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
    float var13 = 1F;
    GL11.glScalef(var13, var13, var13);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-1F, -1F, 0.0F);
    ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);


}
项目:MineFantasy    文件:TileEntityOvenRenderer.java   
private void renderRack(TileEntityOven tile, int x, int y, int w, int h,
        int tw, int th) {
    Minecraft mc = Minecraft.getMinecraft();

    float f = 0.01F / (float) tw;
    float f1 = 0.01F / (float) th;

    float x1 = (float) x / (float) tw + f;
    float x2 = (float) (x + w) / tw - f;
    float y1 = (float) y / th + f1;
    float y2 = (float) (y + h) / th - f1;

    Tessellator image = Tessellator.instance;
    float xPos = 0.5F;
    float yPos = 0.0F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
    float var13 = 1F;
    GL11.glScalef(var13, var13, var13);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-1F, -1F, 0.0F);
    ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
项目:MineFantasy    文件:TileEntityOvenRenderer.java   
private void renderHatch(TileEntityOven tile, int x, int y, int w,
        int h, int tw, int th) {
    Minecraft mc = Minecraft.getMinecraft();

    float f = 0.01F / (float) tw;
    float f1 = 0.01F / (float) th;

    float x1 = (float) x / (float) tw + f;
    float x2 = (float) (x + w) / tw - f;
    float y1 = (float) y / th + f1;
    float y2 = (float) (y + h) / th - f1;

    Tessellator image = Tessellator.instance;
    float xPos = 0.5F;
    float yPos = 1.0F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
    float var13 = 1F;
    GL11.glScalef(var13, var13, var13);
    GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-1F, -1F, 0.0F);
    ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
项目:MineFantasy    文件:TileEntityTripHammerRenderer.java   
private void renderWheel(TileEntityTripHammer tile, int x, int y, int w, int h, int tw, int th) {
    Minecraft mc = Minecraft.getMinecraft();

    float f = 0.01F / (float)tw;
       float f1 = 0.01F / (float)th;

    float x1 = (float)x / (float)tw + f;
    float x2 = (float)(x + w) / tw - f;
    float y1 = (float)y / th + f1;
    float y2 = (float)(y + h) / th - f1;

       Tessellator image = Tessellator.instance;
       float xPos = 0.5F;
       float yPos = 0.5F;
       GL11.glEnable(GL12.GL_RESCALE_NORMAL);
       GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
       float var13 = 1F;
       GL11.glScalef(var13, var13, var13);
       GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
       GL11.glTranslatef(-1F, -1F, 0.0F);
       ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
项目:MineFantasy    文件:TileEntitySpinningWheelRenderer.java   
private void renderWheel(TileEntitySpinningWheel tile, int x, int y, int w, int h, int tw, int th) {
    Minecraft mc = Minecraft.getMinecraft();

    float f = 0.01F / (float)tw;
       float f1 = 0.01F / (float)th;

    float x1 = (float)x / (float)tw + f;
    float x2 = (float)(x + w) / tw - f;
    float y1 = (float)y / th + f1;
    float y2 = (float)(y + h) / th - f1;

       Tessellator image = Tessellator.instance;
       float xPos = 0.5F;
       float yPos = 0.5F;
       GL11.glEnable(GL12.GL_RESCALE_NORMAL);
       GL11.glTranslatef(-xPos, -yPos, pixel(0.5F));
       float var13 = 1F;
       GL11.glScalef(var13, var13, var13);
       GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
       GL11.glTranslatef(-1F, -1F, 0.0F);
       ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, tw, th, 0.0625F);

}
项目:MagicalRings    文件:RenderGhostSword.java   
public void render3D(ItemStack item) {
    glPushMatrix();
    IIcon icon = item.getItem().getIcon(item, 0);
    if (icon == null)
        return;
    Tessellator tess = Tessellator.instance;
    float uv1 = icon.getMinU();
    float uv2 = icon.getMaxU();
    float uv3 = icon.getMinV();
    float uv4 = icon.getMaxV();
    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    glColor4f(1f, 1f, 1f, 0.5f);
    ItemRenderer.renderItemIn2D(tess, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
    glColor4f(1f, 1f, 1f, 1f);
    glDisable(GL_BLEND);
    glPopMatrix();
}
项目:Chisel-2    文件:PlayerSpecials.java   
@Override
public void renderExtras(EntityPlayer player, boolean post) {
    if (!post) {
        GL11.glPushMatrix();
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
        if (player.isSneaking()) {
            GL11.glRotatef(28.64789F, 1.0F, 0.0F, 0.0F);
        }
        boolean armor = player.getCurrentArmor(1) != null;
        GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glTranslatef(-0.25F, -0.85F, armor ? 0.2F : 0.28F);
        GL11.glScalef(0.5F, 0.5F, 0.5F);
        GL11.glColor3f(1.0F, 1.0F, 1.0F);
        int light = 0xF000F0;
        int lightmapX = light % 0x10000;
        int lightmapY = light / 0x10000;
        OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);

        IIcon icon = toRender.getIconIndex();
        ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 1.0F / 16.0F);
        GL11.glPopMatrix();
    }
}
项目:Farrago    文件:RifleItemRenderer.java   
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    EntityClientPlayerMP player = ((EntityClientPlayerMP) data[1]);
    float scopeMult = Math.min((FarragoMod.scopeTicks+ClientProxy.timer.renderPartialTicks)/5f, 1.0f);
    GL11.glTranslatef(1.0f, 0f, 0f);
    GL11.glRotatef(180F, 1.0f, 0.0f, 0.0f);
    GL11.glRotatef(180F, 0.0f, 0.0f, 1.0f);
    if (FarragoMod.scoped) {
        if (player.isUsingItem()) {
            GL11.glTranslatef(0f, scopeMult*-0.5f, scopeMult*0.4f);
            GL11.glRotatef(5F, 0.0f, scopeMult, 0.0f);
            GL11.glRotatef(10F, scopeMult, 0.0f, 0.0f);
        } else {
            GL11.glTranslatef(0f, 0f, scopeMult);
            GL11.glRotatef(-2F, scopeMult, scopeMult, 0.0f);
        }
    }
    IIcon icon = item.getItem().getIcon(item, 0, player, player.getItemInUse(), player.getItemInUseCount());
    ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMinU(), icon.getMinV(), icon.getMaxU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625f);
}
项目:Farrago    文件:UndefinedItemRenderer.java   
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    float mult = 1;
    if (type == ItemRenderType.INVENTORY) {
        mult = 16;
    }
    if (Minecraft.getMinecraft().thePlayer != null) {
        rand.setSeed((int)((Minecraft.getMinecraft().thePlayer.ticksExisted+ClientProxy.timer.renderPartialTicks)*100)*item.hashCode());
    }
    IIcon icon = item.getIconIndex();
    for (int i = 0; i < rand.nextInt(80)+30; i++) {
        GL11.glPushMatrix();
            GL11.glScalef(mult*rand.nextFloat(), mult*rand.nextFloat(), 0);
            GL11.glTranslatef((mult*((rand.nextFloat()*4)-2)), (mult*((rand.nextFloat()*4)-2)), (mult*((rand.nextFloat()*4)-2)));
            ItemRenderer.renderItemIn2D(Tessellator.instance, rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), rand.nextFloat(), icon.getIconWidth(), icon.getIconHeight(), rand.nextFloat());
        GL11.glPopMatrix();
    }
}
项目:Battlegear2    文件:BattlegearRenderHelper.java   
/**
 * Add scrolling support for equip animation on offhand
 * @param itemRenderer
 * @param mc
 */
public static void updateEquippedItem(ItemRenderer itemRenderer, Minecraft mc) {
    IOffhandRender offhandRender = (IOffhandRender)itemRenderer;
    //offhandRender.setPrevEquippedProgress(offhandRender.getEquippedProgress());
    if (mc.player.isRowingBoat() || !BattlegearUtils.isPlayerInBattlemode(mc.player))
        return;
    EntityPlayer var1 = mc.player;
    ItemStack var2 = var1.getHeldItemOffhand();
    if (offhandRender.getItemToRender().isEmpty() || var2.isEmpty())
        return;
    int slot = var1.inventory.currentItem + InventoryPlayerBattle.WEAPON_SETS;
    boolean reequip = offhandRender.getItemToRender().getItem().shouldCauseReequipAnimation(offhandRender.getItemToRender(), var2, offhandRender.getEquippedItemSlot() != slot);
    if(reequip) {
        offhandRender.setEquippedProgress(offhandRender.getPrevEquippedProgress());
        float increment = MathHelper.clamp(-offhandRender.getEquippedProgress(), -PROGRESS_INCREMENT_LIMIT, PROGRESS_INCREMENT_LIMIT);
        offhandRender.setEquippedProgress(offhandRender.getEquippedProgress() + increment);
    }

    if (offhandRender.getEquippedProgress() < 0.1F) {
        offhandRender.setItemToRender(var2);
        offhandRender.setEquippedItemSlot(slot);
    }
}
项目:NetCraft    文件:ItemArcPadRenderer.java   
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    GL11.glPushMatrix();
    FMLClientHandler.instance().getClient().renderEngine
            .bindTexture("/gui/items.png");
    Icon icon = item.getItem().getIcon(item, 0);

    Tessellator tessellator = Tessellator.instance;
    float f = icon.getMinU();
    float f1 = icon.getMaxU();
    float f2 = icon.getMinV();
    float f3 = icon.getMaxV();
    float f4 = 0.0F;
    float f5 = 0.3F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glTranslatef(-f4, -f5, 0.0F);
    float f6 = 1.5F;
    GL11.glScalef(f6, f6, f6);
    GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
    GL11.glTranslatef(-0.9375F, -0.0625F, 0.0F);
    ItemRenderer.renderItemIn2D(tessellator, f1, f2, f, f3,
            icon.getSheetWidth(), icon.getSheetHeight(), 0.0625F);
    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}
项目:pnc-repressurized    文件:ItemMinigun.java   
@SideOnly(Side.CLIENT)
private void suppressSwitchAnimation() {
    Minecraft mc = Minecraft.getMinecraft();
    ItemRenderer renderer = mc.entityRenderer.itemRenderer;
    renderer.updateEquippedItem();
    renderer.equippedProgressMainHand = 1;
    renderer.prevEquippedProgressMainHand = 1;
}
项目:ClientAPI    文件:MixinItemRenderer.java   
@Inject(method = "renderItemInFirstPerson(Lnet/minecraft/client/entity/AbstractClientPlayer;FFLnet/minecraft/util/EnumHand;FLnet/minecraft/item/ItemStack;F)V", at = @At("HEAD"), cancellable = true)
private void renderItemInFirstPerson(AbstractClientPlayer p_187457_1_, float p_187457_2_, float p_187457_3_, EnumHand p_187457_4_, float p_187457_5_, ItemStack p_187457_6_, float p_187457_7_, CallbackInfo ci) {
    ItemRenderEvent event = new ItemRenderEvent((ItemRenderer) (Object) this, p_187457_2_, p_187457_4_, p_187457_5_, p_187457_6_, p_187457_7_);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        ci.cancel();
}
项目:ClientAPI    文件:ItemRenderEvent.java   
public ItemRenderEvent(ItemRenderer itemRenderer, float partialTicks, EnumHand hand, float swingProgress, ItemStack stack, float rechargeProgress) {
    this.itemRenderer = itemRenderer;
    this.partialTicks = partialTicks;
    this.hand = hand;
    this.swingProgress = swingProgress;
    this.stack = stack;
    this.rechargeProgress = rechargeProgress;

    this.handSide = hand == EnumHand.MAIN_HAND ? mc.player.getPrimaryHand() : mc.player.getPrimaryHand().opposite();
}
项目:ArcaneMagic    文件:ClientEvents.java   
@SubscribeEvent
public static void onRenderHand(RenderSpecificHandEvent ev)
{
    EntityPlayer player = Minecraft.getMinecraft().player;
    if (!player.isSneaking() && ev.getItemStack().getItem() instanceof ItemParchment)
    {

        float f = player.getSwingProgress(ev.getPartialTicks());
        float f1 = player.prevRotationPitch
                + (player.rotationPitch - player.prevRotationPitch) * ev.getPartialTicks();

        ItemRenderer itemrenderer = Minecraft.getMinecraft().getItemRenderer();

        float prevEquipProgress = ev.getHand() == EnumHand.MAIN_HAND ? itemrenderer.prevEquippedProgressMainHand
                : itemrenderer.prevEquippedProgressOffHand;
        float equipProgress = ev.getHand() == EnumHand.MAIN_HAND ? itemrenderer.equippedProgressMainHand
                : itemrenderer.equippedProgressOffHand;
        float f5 = 1.0F - (prevEquipProgress + (equipProgress - prevEquipProgress) * ev.getPartialTicks());

        GlStateManager.pushMatrix();
        GlStateManager.pushAttrib();

        if (ev.getHand() == EnumHand.MAIN_HAND && player.getHeldItemOffhand().isEmpty())
        {
            GLHelper.renderParchmentFirstPerson(f1, f5, f, ev.getItemStack());
        } else
        {
            EnumHandSide enumhandside = ev.getHand() == EnumHand.MAIN_HAND ? player.getPrimaryHand()
                    : player.getPrimaryHand().opposite();
            GLHelper.renderParchmentFirstPersonSide(f5, enumhandside, f, ev.getItemStack());
        }

        GlStateManager.popAttrib();
        GlStateManager.popMatrix();
        ev.setCanceled(true);
    }
}
项目:BaseClient    文件:ShadersRender.java   
public static void renderItemFP(ItemRenderer itemRenderer, float par1)
{
    GlStateManager.depthMask(true);
    GlStateManager.depthFunc(515);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    itemRenderer.renderItemInFirstPerson(par1);
}
项目:SerenityCE    文件:MixinItemRenderer.java   
@Redirect(method = "renderItemInFirstPerson", at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.ItemRenderer.transformFirstPersonItem(FF)V", ordinal = 2))
public void injectCustomTransform(ItemRenderer itemRenderer, float equipProgress, float swingProgress) {
    try {
        if (Serenity.getInstance().getModuleManager().getModule(BlockHit.class).isEnabled()) {
            transformFirstPersonItem(equipProgress, Minecraft.getMinecraft().thePlayer.getSwingProgress(((MinecraftExtension) Minecraft.getMinecraft()).getTimer().renderPartialTicks));
        } else {
            transformFirstPersonItem(equipProgress, swingProgress);
        }
    } catch (Exception e) {
        transformFirstPersonItem(equipProgress, swingProgress);
    }
}
项目:SignPicture    文件:CustomItemSignRenderer.java   
private void renderSign() {
    final IIcon iicon = Items.sign.getIconFromDamage(0);
    TextureUtil.func_152777_a(false, false, 1f);
    final float f = iicon.getMinU();
    final float f1 = iicon.getMaxU();
    final float f2 = iicon.getMinV();
    final float f3 = iicon.getMaxV();
    ItemRenderer.renderItemIn2D(WRenderer.t, f1, f2, f, f3, iicon.getIconWidth(), iicon.getIconHeight(), 0.0625f);
}
项目:CodeChickenLib    文件:CCItemRenderer.java   
public CCItemRenderer(ItemRenderer parent) {
    super(parent.mc);
    this.wrapped = parent;
    ObfMapping mapping = new ObfMapping("net/minecraft/client/renderer/ItemRenderer", "field_178111_g");
    ReflectionManager.setField(mapping, this, parent.renderManager);
    mapping = new ObfMapping("net/minecraft/client/renderer/ItemRenderer", "field_178112_h");
    ReflectionManager.setField(mapping, this, parent.itemRenderer);
}
项目:MobCages    文件:RenderCage.java   
public void render3DTexture(int index, float thickness)
{
    Tessellator tess = Tessellator.instance;
       float var9 = (float)(index % 16 * 16 + 0) / 256.0F;
       float var10 = (float)(index % 16 * 16 + 16) / 256.0F;
       float var11 = (float)(index / 16 * 16 + 0) / 256.0F;
       float var12 = (float)(index / 16 * 16 + 16) / 256.0F;
       ItemRenderer.renderItemIn2D(tess, var10, var11, var9, var12, 256, 256, thickness); 
}
项目:LambdaLib    文件:RenderUtils.java   
public static void renderOverlayEquip(ResourceLocation src) {
    //Setup
    GL11.glDepthFunc(GL11.GL_EQUAL);
    GL11.glDisable(GL11.GL_LIGHTING);
    loadTexture(src);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
    float f7 = 0.76F;
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    //Push texture mat
    GL11.glPushMatrix();
    float f8 = 0.125F;
    GL11.glScalef(f8, f8, f8);
    float f9 = GameTimer.getAbsTime() % 3000L / 3000.0F * 8.0F;
    GL11.glTranslatef(f9, 0.0F, 0.0F); //xOffset loops between 0.0 and 8.0
    GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();

    //Second pass
    GL11.glPushMatrix();
    GL11.glScalef(f8, f8, f8);
    f9 = GameTimer.getAbsTime() % 4873L / 4873.0F * 8.0F; //Loop between 0 and 8, longer loop
    GL11.glTranslatef(-f9, 0.0F, 0.0F); //Still xOffset
    GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F); //However, different rotation!
    ItemRenderer.renderItemIn2D(t, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F);
    GL11.glPopMatrix();
    //Pop texture mat
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
}
项目:JAM    文件:CompressedRenderHandler.java   
private void renderEquipped(ItemStack stack) {
    GL11.glPushMatrix();
    Tessellator tessellator = Tessellator.instance;

    int meta = stack.getItemDamage();
    for (int pass = 0; pass < stack.getItem().getRenderPasses(meta); ++pass) {
        IIcon icon = stack.getItem().getIconFromDamageForRenderPass(meta, pass);
        if (icon == null) {
            continue;
        }

        if (renderItem.renderWithColor) {
            int color = stack.getItem().getColorFromItemStack(stack, pass);
            float c1 = (float) (color >> 16 & 255) / 255.0F;
            float c2 = (float) (color >> 8 & 255) / 255.0F;
            float c3 = (float) (color & 255) / 255.0F;

            GL11.glColor4f(c1, c2, c3, 1.0F);
        }

        float uv1 = icon.getMinU();
        float uv2 = icon.getMaxU();
        float uv3 = icon.getMinV();
        float uv4 = icon.getMaxV();

        ItemRenderer.renderItemIn2D(tessellator, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), PIXEL);
    }

    GL11.glPopMatrix();
}
项目:DaVincing    文件:CanvasRenderer.java   
private void renderEquipped(IIcon icon) {
  Tessellator var5 = Tessellator.instance;
  float var7 = icon.getMinU();
  float var8 = icon.getMaxU();
  float var9 = icon.getMinV();
  float var10 = icon.getMaxV();
  ItemRenderer.renderItemIn2D(var5, var8, var9, var7, var10, 256, 256, 0.0625F);
}
项目:Gadomancy    文件:RenderGolemHelper.java   
public static void renderCarriedItemsFix(EntityGolemBase golem) {
    GL11.glPushMatrix();

    GL11.glScaled(0.4D, 0.4D, 0.4D);

    GL11.glTranslatef(-0.5F, 2.5F, -1.25F);
    GL11.glRotatef(180.0F, 1.0F, 0.0F, 0.0F);

    ItemStack item = golem.getCarriedForDisplay();

    int renderPass = 0;
    do {
        IIcon icon = item.getItem().getIcon(item, renderPass);
        if (icon != null) {
            Color color = new Color(item.getItem().getColorFromItemStack(item, renderPass));
            GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());

            ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(),
                    icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

            GL11.glColor3f(1.0F, 1.0F, 1.0F);
        }
        renderPass++;
    } while (renderPass < item.getItem().getRenderPasses(item.getItemDamage()));

    GL11.glPopMatrix();
}
项目:MineFantasy    文件:TileEntityTanningRackRenderer.java   
private void renderHungItem(TileEntityTanningRack tile, double d, double d1,
        double d2, float f) {
    Minecraft mc = Minecraft.getMinecraft();
    ItemStack itemstack = tile.getHung();
    if(itemstack != null)
    {
        Item item = itemstack.getItem();
        mc.renderEngine.bindTexture(TextureMap.locationItemsTexture);

        Tessellator image = Tessellator.instance;
        Icon index = item.getIconFromDamage(itemstack.getItemDamage());
        float x1 = index.getMinU();
        float x2 = index.getMaxU();
        float y1 = index.getMinV();
        float y2 = index.getMaxV();
        float xPos = 0.5F;
        float yPos = -0.5F;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        GL11.glTranslatef(-xPos, -yPos, 0.0F);
        float var13 = 1F;
        GL11.glScalef(var13, var13, var13);
        //GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
        GL11.glTranslatef(-1F, -1F, 0.0F);
        ItemRenderer.renderItemIn2D(image, x2, y1, x1, y2, index.getIconWidth(), index.getIconHeight(), 0.0625F);
    }

}
项目:Imperium    文件:TileEntityCampfireRenderer.java   
private void drawItem(ItemStack itemStack) {
    //itemIcon = Items.beef.getIconFromDamage(0);
    if (itemStack == null) return;
    IIcon itemIcon = itemStack.getIconIndex();
    GL11.glTranslated(transX, transY, transZ);
    GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
    u = itemIcon.getMinU();
    v = itemIcon.getMinV();
    U = itemIcon.getMaxU();
    V = itemIcon.getMaxV();
    GL11.glScalef(transScale, transScale, transScale);
    ItemRenderer.renderItemIn2D(tessellator, U, v, u, V, itemIcon.getIconWidth(), itemIcon.getIconHeight(), 0.0625F);
}
项目:minepainter    文件:CanvasRenderer.java   
private void renderEquipped(IIcon icon)
{
    Tessellator var5 = Tessellator.instance;
    float var7 = icon.getMinU();
    float var8 = icon.getMaxU();
    float var9 = icon.getMinV();
    float var10 = icon.getMaxV();
    ItemRenderer.renderItemIn2D(var5, var8, var9, var7, var10, 256, 256, 0.0625F);
}
项目:MagicalRings    文件:RenderRing.java   
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    Tessellator tess = Tessellator.instance;
    for (int i = 0; i < 3; i++) {
        GL11.glPushMatrix();
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
        IIcon icon = item.getItem().getIcon(item, i);
        int rgb = item.getItem().getColorFromItemStack(item, i);
        float r = (rgb >> 16 & 255) / 255.0F;
        float g = (rgb >> 8 & 255) / 255.0F;
        float b = (rgb & 255) / 255.0F;

        if (icon == null)
            continue;

        float uv1 = icon.getMinU();
        float uv2 = icon.getMaxU();
        float uv3 = icon.getMinV();
        float uv4 = icon.getMaxV();

        GL11.glColor4f(r, g, b, 1f);

        ItemRenderer.renderItemIn2D(tess, uv2, uv3, uv1, uv4, icon.getIconWidth(), icon.getIconHeight(), 0.0625F);

        GL11.glColor4f(1f, 1f, 1f, 1f);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glPopMatrix();
    }
}
项目:RuneCraftery    文件:EntityRenderer.java   
public EntityRenderer(Minecraft p_i1246_1_) {
   this.field_78531_r = p_i1246_1_;
   this.field_78516_c = new ItemRenderer(p_i1246_1_);
   this.field_78513_d = new DynamicTexture(16, 16);
   this.field_110922_T = p_i1246_1_.func_110434_K().func_110578_a("lightMap", this.field_78513_d);
   this.field_78504_Q = this.field_78513_d.func_110565_c();
}
项目:The-Derpy-Shiz-Mod    文件:RenderBigItem.java   
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
    GL11.glPushMatrix();
    if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        GL11.glTranslatef(-0.7F, -0.25F, 0.0F);
    } else {
        GL11.glTranslatef(-1.0F-(ip*0), -0.25F+(ip*5), 0.01F);
    }
    GL11.glScaled(2, 2, 1);
    IIcon icon = stack.getIconIndex();
    ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), ip);
    GL11.glPopMatrix();
}
项目:The-Derpy-Shiz-Mod    文件:RenderDarkSword.java   
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
    if (type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
        if (!(data[1] instanceof EntityLivingBase) || ((EntityLivingBase)data[1]).isInvisible()) {
            return;
        }
    }
    IIcon icon = stack.getIconIndex();
    ItemRenderer.renderItemIn2D(Tessellator.instance, icon.getMaxU(), icon.getMinV(), icon.getMinU(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight(), 0.0625F);
}
项目:Battlegear2    文件:BattlegearRenderHelper.java   
/**
 * Add Shield swing for the offhand first person view
 * @param progress Equip Progress for offhand
 * @param player The player
 * @param itemRenderer
 */
public static void renderItemInFirstPerson(float progress, EntityPlayer player, ItemRenderer itemRenderer) {

    IOffhandRender offhandRender = (IOffhandRender)itemRenderer;
    if (offhandRender.getItemToRender().getItem() instanceof IShield) {

        GlStateManager.pushMatrix();

        float swingProgress =
                (float)((IBattlePlayer)player).getSpecialActionTimer() / (
                        float)((IShield)offhandRender.getItemToRender().getItem()).getBashTimer(
                        offhandRender.getItemToRender());
        swingProgress = MathHelper.sin(swingProgress * (float) Math.PI);
        GlStateManager.translate(-0.59F + 0.25F * swingProgress,
                -0.53F - progress * 0.6F,
                -0.8F - 0.25F * swingProgress);

        if(((IBattlePlayer)player).isBlockingWithShield()){
            GlStateManager.translate(0.25F, 0.15F, 0);
        }

        GlStateManager.rotate(- 35F * swingProgress, 0, 1, 0);

        itemRenderer.renderItem(player, offhandRender.getItemToRender(), ItemCameraTransforms.TransformType.FIRST_PERSON_LEFT_HAND);

        GlStateManager.popMatrix();
    }
}