@Override
  public void onUsingFocusTick(
      ItemStack paramItemStack, EntityPlayer paramEntityPlayer, int paramInt) {
    if (paramEntityPlayer.worldObj.isRemote) return;

    ItemWandCasting wand = (ItemWandCasting) paramItemStack.getItem();
    AspectList aspects = wand.getAllVis(paramItemStack);

    Aspect aspectToAdd = null;
    int takes = 0;

    while (aspectToAdd == null) {
      lastGiven = lastGiven == 5 ? 0 : lastGiven + 1;

      Aspect aspect = Aspect.getPrimalAspects().get(lastGiven);

      if (aspects.getAmount(aspect) < wand.getMaxVis(paramItemStack)) aspectToAdd = aspect;

      ++takes;
      if (takes == 7) return;
    }

    int xpUse = getXpUse(paramItemStack);
    if (paramEntityPlayer.experienceTotal >= xpUse) {
      ExperienceHelper.drainPlayerXP(paramEntityPlayer, xpUse);
      wand.storeVis(paramItemStack, aspectToAdd, wand.getVis(paramItemStack, aspectToAdd) + 500);
    }
  }
  @SubscribeEvent
  public void drawDislocationFocusHUD(RenderGameOverlayEvent.Post event) {
    if (event.type == ElementType.HOTBAR && ClientHelper.minecraft().currentScreen == null) {
      boolean up = !Config.dialBottom;
      int xpos = 4;
      int ypos = up ? 50 : event.resolution.getScaledHeight() - 70;

      ItemStack item = ClientHelper.clientPlayer().getCurrentEquippedItem();
      if (item != null && item.getItem() instanceof ItemWandCasting) {
        ItemWandCasting wand = (ItemWandCasting) item.getItem();
        wand.getFocusItem(item);
        ItemFocusBasic focus = wand.getFocus(item);

        if (focus != null && focus instanceof ItemFocusDislocation) {
          ItemStack pickedBlock = ((ItemFocusDislocation) focus).getPickedBlock(item);
          if (pickedBlock != null) {
            Gui.drawRect(xpos - 1, ypos - 1, xpos + 18, ypos + 18, 0x66000000);

            FontRenderer font = ClientHelper.fontRenderer();
            boolean unicode = font.getUnicodeFlag();
            font.setUnicodeFlag(true);
            String name = StatCollector.translateToLocal("ttmisc.focusDislocation.tooltip");
            int strLength = font.getStringWidth(name);

            Gui.drawRect(xpos + 18, ypos, xpos + 18 + strLength + 4, ypos + 9, 0x66000000);
            font.drawStringWithShadow(name, xpos + 20, ypos, 0xFFAA00);

            NBTTagCompound cmp = ((ItemFocusDislocation) focus).getStackTileEntity(item);
            if (cmp != null && !cmp.hasNoTags()) {
              String content =
                  StatCollector.translateToLocal("ttmisc.focusDislocation.tooltipExtra");
              font.getStringWidth(content);

              Gui.drawRect(xpos + 18, ypos + 9, xpos + 18 + strLength + 4, ypos + 18, 0x66000000);
              font.drawStringWithShadow(content, xpos + 20, ypos + 9, 0xFFAA00);
            }

            if (new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a).getItem() != null)
              renderItem.renderItemIntoGUI(
                  font,
                  ClientHelper.minecraft().renderEngine,
                  new ItemStack(((ItemBlock) pickedBlock.getItem()).field_150939_a),
                  xpos,
                  ypos);
            else {
              if (((ItemBlock) pickedBlock.getItem()).field_150939_a == Blocks.reeds)
                renderItem.renderItemIntoGUI(
                    font,
                    ClientHelper.minecraft().renderEngine,
                    new ItemStack(Items.reeds),
                    xpos,
                    ypos);
            }
            font.setUnicodeFlag(unicode);
          }
        }
      }
    }
  }
  @Override
  public ItemStack onFocusRightClick(
      ItemStack itemstack, World world, EntityPlayer p, MovingObjectPosition movingobjectposition) {
    ItemWandCasting wand = (ItemWandCasting) itemstack.getItem();
    if (!ConfigHandler.enableFlight) {
      return itemstack;
    }
    if (wand.consumeAllVis(itemstack, p, getVisCost(), true, false)) {
      Vec3 vec = p.getLookVec();
      double force =
          1
              / 1.5
              * (1
                  + EnchantmentHelper.getEnchantmentLevel(
                          Config.enchPotency.effectId, wand.getFocusItem(itemstack))
                      * 0.2);
      p.motionX = vec.xCoord * force;
      p.motionY = vec.yCoord * force;
      p.motionZ = vec.zCoord * force;
      p.fallDistance = 0F;
      if (p instanceof EntityPlayerMP) {
        ((EntityPlayerMP) p).playerNetServerHandler.floatingTickCount = 0;
      }
      for (int i = 0; i < 5; i++)
        ThaumicTinkerer.tcProxy.smokeSpiral(
            world,
            p.posX,
            p.posY - p.motionY,
            p.posZ,
            2F,
            (int) (Math.random() * 360),
            (int) p.posY);
      world.playSoundAtEntity(p, "thaumcraft:wind", 0.4F, 1F);
    }

    if (world.isRemote) p.swingItem();

    return itemstack;
  }