protected void updateItemUse(Entity pEntity, int par2) {
    if (itemInUse.getItemUseAction() == EnumAction.DRINK) {
      pEntity.playSound("random.drink", 0.5F, pEntity.worldObj.rand.nextFloat() * 0.1F + 0.9F);
    }

    Random rand = new Random();

    if (itemInUse.getItemUseAction() == EnumAction.EAT) {

      for (int var3 = 0; var3 < par2; ++var3) {
        /*
        Vec3 var4 = new Vec3(((double)rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
        var4.rotateAroundX(-pEntity.rotationPitch * (float)Math.PI / 180.0F);
        var4.rotateAroundY(-pEntity.rotationYaw * (float)Math.PI / 180.0F);
        Vec3 var5 = new Vec3((double)rand.nextFloat() - 0.5D) * 0.3D, (double)(-rand.nextFloat()) * 0.6D - 0.3D, 0.6D);
        var5.rotateAroundX(-pEntity.rotationPitch * (float)Math.PI / 180.0F);
        var5.rotateAroundY(-pEntity.rotationYaw * (float)Math.PI / 180.0F);
        var5 = var5.addVector(pEntity.posX, pEntity.posY + (double)pEntity.getEyeHeight(), pEntity.posZ);
        */
        pEntity.worldObj.spawnParticle(
            EnumParticleTypes.ITEM_CRACK,
            pEntity.posX,
            pEntity.posY,
            pEntity.posZ,
            (rand.nextFloat() - 0.5D) * 0.1D,
            Math.random() * 0.1D + 0.1D,
            0.0D);
      }

      pEntity.playSound(
          "random.eat",
          0.5F + 0.5F * rand.nextInt(2),
          (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
    }
  }
  @Override
  @SideOnly(Side.CLIENT)
  public ModelBiped getArmorModel(
      EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {

    ModelBackBokken armorModel = null;
    if (itemStack != null) {
      if (itemStack.getItem() instanceof ItemArmourKatana) {
        int type = ((ItemArmor) itemStack.getItem()).armorType;

        if (type == 1) {
          armorModel = new ModelBackBokken();
          DataWatcher dw = entityLiving.getDataWatcher();
          armorModel.animationID = dw.getWatchableObjectString(20);
          armorModel.animationlastID = dw.getWatchableObjectString(26);
          armorModel.animationTick = dw.getWatchableObjectFloat(25);
        }
      }
    }
    if (entityLiving.getHeldItem() != null) {
      // armorModel.blade.isHidden = true;
      // armorModel.blade.isHidden = false;
      armorModel.handle.isHidden = entityLiving.getHeldItem().getItem() == NarutoItems.Katana;
    } else {
      // armorModel.blade.isHidden = false;
      armorModel.handle.isHidden = false;
    }

    if (armorModel != null) {
      armorModel.bipedBody.showModel = armorSlot == 1;

      armorModel.isSneak = entityLiving.isSneaking();
      armorModel.isRiding = entityLiving.isRiding();
      armorModel.isChild = entityLiving.isChild();
      armorModel.heldItemRight = entityLiving.getEquipmentInSlot(0) != null ? 1 : 0;
      armorModel.isSprinting = entityLiving.isSprinting();
      if (entityLiving instanceof EntityPlayer) {
        EntityPlayer entityPlayer = (EntityPlayer) entityLiving;
        if (itemStack != null && entityPlayer.getItemInUseCount() > 0) {
          EnumAction enumaction = itemStack.getItemUseAction();

          if (enumaction == EnumAction.block) {
            armorModel.heldItemRight = 3;
          } else if (enumaction == EnumAction.bow) {
            armorModel.aimedBow = true;
          } else if (enumaction == NarutoItems.Throw) {
            if (FMLClientHandler.instance().getClient().thePlayer == entityPlayer) {
              armorModel.isClientThrowing = true;
            } else {
              armorModel.isThrowing = true;
            }
          }
        }
      }
    }

    return armorModel;
  }
 /**
  * Bend the models when the item in left hand is used And stop the right hand inappropriate
  * bending
  */
 @SubscribeEvent(priority = EventPriority.LOW)
 public void renderPlayerLeftItemUsage(RenderLivingEvent.Pre event) {
   if (event.entity instanceof EntityPlayer) {
     EntityPlayer entityPlayer = (EntityPlayer) event.entity;
     ItemStack offhand =
         ((InventoryPlayerBattle) entityPlayer.inventory).getCurrentOffhandWeapon();
     if (offhand != null && event.renderer instanceof RenderPlayer) {
       ModelPlayer renderer = ((RenderPlayer) event.renderer).getPlayerModel();
       renderer.heldItemLeft = 1;
       if (entityPlayer.getItemInUseCount() > 0 && entityPlayer.getItemInUse() == offhand) {
         EnumAction enumaction = offhand.getItemUseAction();
         if (enumaction == EnumAction.BLOCK) {
           renderer.heldItemLeft = 3;
         } else if (enumaction == EnumAction.BOW) {
           renderer.aimedBow = true;
         }
         ItemStack mainhand = entityPlayer.inventory.getCurrentItem();
         renderer.heldItemRight = mainhand != null ? 1 : 0;
       } else if (((IBattlePlayer) entityPlayer).isBlockingWithShield()) {
         renderer.heldItemLeft = 3;
       }
     }
   }
 }
  /**
   * Renders the active item in the player's hand when in first person mode. Args: partialTickTime
   */
  public void renderItemInFirstPerson(float par1) {
    float f1 =
        this.prevEquippedProgress + (this.equippedProgress - this.prevEquippedProgress) * par1;
    EntityClientPlayerMP entityclientplayermp = this.mc.thePlayer;
    float f2 =
        entityclientplayermp.prevRotationPitch
            + (entityclientplayermp.rotationPitch - entityclientplayermp.prevRotationPitch) * par1;
    GL11.glPushMatrix();
    GL11.glRotatef(f2, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(
        entityclientplayermp.prevRotationYaw
            + (entityclientplayermp.rotationYaw - entityclientplayermp.prevRotationYaw) * par1,
        0.0F,
        1.0F,
        0.0F);
    RenderHelper.enableStandardItemLighting();
    GL11.glPopMatrix();
    float f3;
    float f4;

    if (entityclientplayermp instanceof EntityPlayerSP) {
      EntityPlayerSP entityplayersp = (EntityPlayerSP) entityclientplayermp;
      f3 =
          entityplayersp.prevRenderArmPitch
              + (entityplayersp.renderArmPitch - entityplayersp.prevRenderArmPitch) * par1;
      f4 =
          entityplayersp.prevRenderArmYaw
              + (entityplayersp.renderArmYaw - entityplayersp.prevRenderArmYaw) * par1;
      GL11.glRotatef((entityclientplayermp.rotationPitch - f3) * 0.1F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef((entityclientplayermp.rotationYaw - f4) * 0.1F, 0.0F, 1.0F, 0.0F);
    }

    ItemStack itemstack = this.itemToRender;
    f3 =
        this.mc.theWorld.getLightBrightness(
            MathHelper.floor_double(entityclientplayermp.posX),
            MathHelper.floor_double(entityclientplayermp.posY),
            MathHelper.floor_double(entityclientplayermp.posZ));
    f3 = 1.0F;
    int i =
        this.mc.theWorld.getLightBrightnessForSkyBlocks(
            MathHelper.floor_double(entityclientplayermp.posX),
            MathHelper.floor_double(entityclientplayermp.posY),
            MathHelper.floor_double(entityclientplayermp.posZ),
            0);
    int j = i % 65536;
    int k = i / 65536;
    OpenGlHelper.setLightmapTextureCoords(
        OpenGlHelper.lightmapTexUnit, (float) j / 1.0F, (float) k / 1.0F);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    float f5;
    float f6;
    float f7;

    if (itemstack != null) {
      i = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, 0);
      f7 = (float) (i >> 16 & 255) / 255.0F;
      f6 = (float) (i >> 8 & 255) / 255.0F;
      f5 = (float) (i & 255) / 255.0F;
      GL11.glColor4f(f3 * f7, f3 * f6, f3 * f5, 1.0F);
    } else {
      GL11.glColor4f(f3, f3, f3, 1.0F);
    }

    float f8;
    float f9;
    float f10;
    Render render;
    RenderPlayer renderplayer;

    if (itemstack != null && itemstack.getItem() instanceof ItemMap) {
      GL11.glPushMatrix();
      f4 = 0.8F;
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glTranslatef(
          -f5 * 0.4F,
          MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI * 2.0F) * 0.2F,
          -f6 * 0.2F);
      f7 = 1.0F - f2 / 45.0F + 0.1F;

      if (f7 < 0.0F) {
        f7 = 0.0F;
      }

      if (f7 > 1.0F) {
        f7 = 1.0F;
      }

      f7 = -MathHelper.cos(f7 * (float) Math.PI) * 0.5F + 0.5F;
      GL11.glTranslatef(0.0F, 0.0F * f4 - (1.0F - f1) * 1.2F - f7 * 0.5F + 0.04F, -0.9F * f4);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(f7 * -85.0F, 0.0F, 0.0F, 1.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));
      this.mc.renderEngine.resetBoundTexture();

      for (k = 0; k < 2; ++k) {
        int l = k * 2 - 1;
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.0F, -0.6F, 1.1F * (float) l);
        GL11.glRotatef((float) (-45 * l), 1.0F, 0.0F, 0.0F);
        GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef(59.0F, 0.0F, 0.0F, 1.0F);
        GL11.glRotatef((float) (-65 * l), 0.0F, 1.0F, 0.0F);
        render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
        renderplayer = (RenderPlayer) render;
        f10 = 1.0F;
        GL11.glScalef(f10, f10, f10);
        renderplayer.renderFirstPersonArm(this.mc.thePlayer);
        GL11.glPopMatrix();
      }

      f6 = entityclientplayermp.getSwingProgress(par1);
      f5 = MathHelper.sin(f6 * f6 * (float) Math.PI);
      f8 = MathHelper.sin(MathHelper.sqrt_float(f6) * (float) Math.PI);
      GL11.glRotatef(-f5 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f8 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-f8 * 80.0F, 1.0F, 0.0F, 0.0F);
      f9 = 0.38F;
      GL11.glScalef(f9, f9, f9);
      GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
      GL11.glTranslatef(-1.0F, -1.0F, 0.0F);
      f10 = 0.015625F;
      GL11.glScalef(f10, f10, f10);
      this.mc.renderEngine.bindTexture("/misc/mapbg.png");
      Tessellator tessellator = Tessellator.instance;
      GL11.glNormal3f(0.0F, 0.0F, -1.0F);
      tessellator.startDrawingQuads();
      byte b0 = 7;
      tessellator.addVertexWithUV((double) (0 - b0), (double) (128 + b0), 0.0D, 0.0D, 1.0D);
      tessellator.addVertexWithUV((double) (128 + b0), (double) (128 + b0), 0.0D, 1.0D, 1.0D);
      tessellator.addVertexWithUV((double) (128 + b0), (double) (0 - b0), 0.0D, 1.0D, 0.0D);
      tessellator.addVertexWithUV((double) (0 - b0), (double) (0 - b0), 0.0D, 0.0D, 0.0D);
      tessellator.draw();

      IItemRenderer custom = MinecraftForgeClient.getItemRenderer(itemstack, FIRST_PERSON_MAP);
      MapData mapdata = ((ItemMap) itemstack.getItem()).getMapData(itemstack, this.mc.theWorld);

      if (custom == null) {
        if (mapdata != null) {
          this.mapItemRenderer.renderMap(this.mc.thePlayer, this.mc.renderEngine, mapdata);
        }
      } else {
        custom.renderItem(FIRST_PERSON_MAP, itemstack, mc.thePlayer, mc.renderEngine, mapdata);
      }

      GL11.glPopMatrix();
    } else if (itemstack != null) {
      GL11.glPushMatrix();
      f4 = 0.8F;

      if (entityclientplayermp.getItemInUseCount() > 0) {
        EnumAction enumaction = itemstack.getItemUseAction();

        if (enumaction == EnumAction.eat || enumaction == EnumAction.drink) {
          f6 = (float) entityclientplayermp.getItemInUseCount() - par1 + 1.0F;
          f5 = 1.0F - f6 / (float) itemstack.getMaxItemUseDuration();
          f8 = 1.0F - f5;
          f8 = f8 * f8 * f8;
          f8 = f8 * f8 * f8;
          f8 = f8 * f8 * f8;
          f9 = 1.0F - f8;
          GL11.glTranslatef(
              0.0F,
              MathHelper.abs(MathHelper.cos(f6 / 4.0F * (float) Math.PI) * 0.1F)
                  * (float) ((double) f5 > 0.2D ? 1 : 0),
              0.0F);
          GL11.glTranslatef(f9 * 0.6F, -f9 * 0.5F, 0.0F);
          GL11.glRotatef(f9 * 90.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(f9 * 10.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(f9 * 30.0F, 0.0F, 0.0F, 1.0F);
        }
      } else {
        f7 = entityclientplayermp.getSwingProgress(par1);
        f6 = MathHelper.sin(f7 * (float) Math.PI);
        f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
        GL11.glTranslatef(
            -f5 * 0.4F,
            MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI * 2.0F) * 0.2F,
            -f6 * 0.2F);
      }

      GL11.glTranslatef(0.7F * f4, -0.65F * f4 - (1.0F - f1) * 0.6F, -0.9F * f4);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glRotatef(-f6 * 20.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f5 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(-f5 * 80.0F, 1.0F, 0.0F, 0.0F);
      f8 = 0.4F;
      GL11.glScalef(f8, f8, f8);
      float f11;
      float f12;

      if (entityclientplayermp.getItemInUseCount() > 0) {
        EnumAction enumaction1 = itemstack.getItemUseAction();

        if (enumaction1 == EnumAction.block) {
          GL11.glTranslatef(-0.5F, 0.2F, 0.0F);
          GL11.glRotatef(30.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-80.0F, 1.0F, 0.0F, 0.0F);
          GL11.glRotatef(60.0F, 0.0F, 1.0F, 0.0F);
        } else if (enumaction1 == EnumAction.bow) {
          GL11.glRotatef(-18.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-12.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(-8.0F, 1.0F, 0.0F, 0.0F);
          GL11.glTranslatef(-0.9F, 0.2F, 0.0F);
          f10 =
              (float) itemstack.getMaxItemUseDuration()
                  - ((float) entityclientplayermp.getItemInUseCount() - par1 + 1.0F);
          f11 = f10 / 20.0F;
          f11 = (f11 * f11 + f11 * 2.0F) / 3.0F;

          if (f11 > 1.0F) {
            f11 = 1.0F;
          }

          if (f11 > 0.1F) {
            GL11.glTranslatef(
                0.0F, MathHelper.sin((f10 - 0.1F) * 1.3F) * 0.01F * (f11 - 0.1F), 0.0F);
          }

          GL11.glTranslatef(0.0F, 0.0F, f11 * 0.1F);
          GL11.glRotatef(-335.0F, 0.0F, 0.0F, 1.0F);
          GL11.glRotatef(-50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glTranslatef(0.0F, 0.5F, 0.0F);
          f12 = 1.0F + f11 * 0.2F;
          GL11.glScalef(1.0F, 1.0F, f12);
          GL11.glTranslatef(0.0F, -0.5F, 0.0F);
          GL11.glRotatef(50.0F, 0.0F, 1.0F, 0.0F);
          GL11.glRotatef(335.0F, 0.0F, 0.0F, 1.0F);
        }
      }

      if (itemstack.getItem().shouldRotateAroundWhenRendering()) {
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
      }

      if (itemstack.getItem().requiresMultipleRenderPasses()) {
        this.renderItem(entityclientplayermp, itemstack, 0);
        for (int x = 1; x < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); x++) {
          int i1 = Item.itemsList[itemstack.itemID].getColorFromItemStack(itemstack, x);
          f10 = (float) (i1 >> 16 & 255) / 255.0F;
          f11 = (float) (i1 >> 8 & 255) / 255.0F;
          f12 = (float) (i1 & 255) / 255.0F;
          GL11.glColor4f(f3 * f10, f3 * f11, f3 * f12, 1.0F);
          this.renderItem(entityclientplayermp, itemstack, x);
        }
      } else {
        this.renderItem(entityclientplayermp, itemstack, 0);
      }

      GL11.glPopMatrix();
    } else if (!entityclientplayermp.getHasActivePotion()) {
      GL11.glPushMatrix();
      f4 = 0.8F;
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glTranslatef(
          -f5 * 0.3F,
          MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI * 2.0F) * 0.4F,
          -f6 * 0.4F);
      GL11.glTranslatef(0.8F * f4, -0.75F * f4 - (1.0F - f1) * 0.6F, -0.9F * f4);
      GL11.glRotatef(45.0F, 0.0F, 1.0F, 0.0F);
      GL11.glEnable(GL12.GL_RESCALE_NORMAL);
      f7 = entityclientplayermp.getSwingProgress(par1);
      f6 = MathHelper.sin(f7 * f7 * (float) Math.PI);
      f5 = MathHelper.sin(MathHelper.sqrt_float(f7) * (float) Math.PI);
      GL11.glRotatef(f5 * 70.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(-f6 * 20.0F, 0.0F, 0.0F, 1.0F);
      GL11.glBindTexture(
          GL11.GL_TEXTURE_2D,
          this.mc.renderEngine.getTextureForDownloadableImage(
              this.mc.thePlayer.skinUrl, this.mc.thePlayer.getTexture()));
      this.mc.renderEngine.resetBoundTexture();
      GL11.glTranslatef(-1.0F, 3.6F, 3.5F);
      GL11.glRotatef(120.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(200.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
      GL11.glScalef(1.0F, 1.0F, 1.0F);
      GL11.glTranslatef(5.6F, 0.0F, 0.0F);
      render = RenderManager.instance.getEntityRenderObject(this.mc.thePlayer);
      renderplayer = (RenderPlayer) render;
      f10 = 1.0F;
      GL11.glScalef(f10, f10, f10);
      renderplayer.renderFirstPersonArm(this.mc.thePlayer);
      GL11.glPopMatrix();
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    RenderHelper.disableStandardItemLighting();
  }