public void renderKatanaDash(
      RenderGameOverlayEvent.Pre event, int width, int height, EntityPlayer player) {
    if (player.getHeldItem() != null
        && player.getHeldItem().getItem() == TFItems.purgesKatana
        && !TFPlayerData.isInVehicleMode(player)
        && TFHelper.isPlayerPurge(player)) {
      int j =
          TFItems.purgesKatana.getMaxItemUseDuration(player.getHeldItem())
              - player.getItemInUseCount();
      double d = (double) j / 10;

      if (d > 2.0D) {
        d = 2.0D;
      }

      GL11.glDisable(GL11.GL_TEXTURE_2D);
      GL11.glEnable(GL11.GL_BLEND);
      GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
      GL11.glColor4f(0F, 0F, 0F, 0.15F);
      drawTexturedModalRect(width / 2 - 26, height / 2 + 9, 0, 0, 52, 12);
      GL11.glColor4f(1F, 0F, 0F, 0.25F);
      drawTexturedModalRect(width / 2 - 25, height / 2 + 10, 0, 0, (int) (d * 25), 10);
      GL11.glEnable(GL11.GL_TEXTURE_2D);
    }
  }
  @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;
  }
 @SubscribeEvent
 public void onPlayerTick(TickEvent.PlayerTickEvent event) {
   if (event.side.isClient()
       && event.phase == TickEvent.Phase.START
       && event.player != null
       && event.player == ClientUtils.mc().renderViewEntity) {
     skyhookGrabableConnections.clear();
     EntityPlayer player = event.player;
     ItemStack stack = player.getCurrentEquippedItem();
     if (stack != null && stack.getItem() instanceof ItemSkyhook) {
       TileEntity connector = null;
       double lastDist = 0;
       Connection line = null;
       double py = player.posY + player.getEyeHeight();
       for (int xx = -2; xx <= 2; xx++)
         for (int zz = -2; zz <= 2; zz++)
           for (int yy = 0; yy <= 3; yy++) {
             TileEntity tile =
                 player.worldObj.getTileEntity(
                     (int) player.posX + xx, (int) py + yy, (int) player.posZ + zz);
             if (tile != null) {
               Connection con =
                   SkylineHelper.getTargetConnection(
                       player.worldObj, tile.xCoord, tile.yCoord, tile.zCoord, player, null);
               if (con != null) {
                 double d = tile.getDistanceFrom(player.posX, py, player.posZ);
                 if (connector == null || d < lastDist) {
                   connector = tile;
                   lastDist = d;
                   line = con;
                 }
               }
             }
           }
       if (line != null && connector != null) skyhookGrabableConnections.add(line);
     }
   }
   if (event.side.isClient() && event.phase == TickEvent.Phase.END && event.player != null) {
     EntityPlayer player = event.player;
     ItemStack stack = player.getCurrentEquippedItem();
     if (stack != null
         && stack.getItem() instanceof ItemDrill
         && (player != ClientUtils.mc().renderViewEntity
             || ClientUtils.mc().gameSettings.thirdPersonView != 0)) {
       if (player.getItemInUseCount() <= 0) {
         player.clearItemInUse();
         player.setItemInUse(stack, 2147483647);
       }
     }
   }
 }
  /**
   * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a
   * player hand and update it's contents.
   */
  public void onUpdate(
      ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) {
    // ■爪痕設置キーを押しただの押してないだの
    boolean isPress = false;
    // ■押した回数を覚えてるので発散させる
    while (Hizume.proxy.getKeySOW().isPressed()) {
      isPress = true;
    }
    // ■爪痕設置キーを押しながら緋爪を取ると爪痕が出来るけど、1個だし大丈夫大丈夫
    isPress = isPress && Hizume.proxy.getKeySOW().isKeyDown();

    // ■カレントアイテムでないなら処理をかえす
    if (!isSelected) {
      return;
    }
    if (!(entityIn instanceof EntityPlayer)) {
      return;
    }
    EntityPlayer player = (EntityPlayer) entityIn;

    // ■アイテム使ってるなら空間に傷はつけられない
    if (player.getItemInUseCount() != 0) {
      return;
    }

    // ■クライアント側での処理
    if (worldIn.isRemote && isPress) {
      // ■腕を振る
      player.swingItem();

      // ■空間へ爪痕をつける
      EntitySOW[] magic = createSOW(stack, worldIn, player);
      if (magic != null) {
        for (EntitySOW base : magic) {
          worldIn.addWeatherEffect(base);
          // PacketHandler.INSTANCE.sendToAll(new MessageSOW(base));
          PacketHandler.INSTANCE.sendToServer(new MessageSOW(base));
        }
      }
    }
  }
 /**
  * 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;
       }
     }
   }
 }