public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   if (player.isSneaking()) {
     ItemStack newStack = new ItemStack(ModObjects.heartWand, 1, stack.getItemDamage() + 1);
     if (newStack.getItemDamage() >= 3) {
       newStack.setItemDamage(0);
     }
     return newStack;
   } else {
     ItemStack container;
     switch (stack.getItemDamage()) {
       case 0:
         container = LifeSystem.findFilledLifeContainer(player.inventory.mainInventory);
         if (container != null && player.getHealth() < player.getMaxHealth()) {
           if (((ILifeContainer) container.getItem()).takeLife(container, 1) > 0) {
             player.heal(1f);
             player.addStat(ModAchievements.useLP, 1);
           }
         }
         break;
       case 1:
         break;
       case 2:
         container = LifeSystem.findEmptyLifeContainer(player.inventory.mainInventory);
         if (container != null && player.attackEntityFrom(ModObjects.sacrifice, 1f)) {
           if (((ILifeContainer) container.getItem()).addLife(container, 1) > 0) {
             player.addStat(ModAchievements.useHeartWand, 1);
           }
         }
         break;
     }
   }
   return stack;
 }
 @Override
 public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
   if (item != null && item.getItemName().equals("item.Necronomicon")) {
     player.addStat(AchievementNecromancy.NecronomiconAchieve, 1);
   }
   if (item != null && item.getItemName().equals("tile.Sewing Machine")) {
     player.addStat(AchievementNecromancy.SewingAchieve, 1);
   }
   if (item != null && item.itemID == new ItemStack(ItemNecromancy.bucketBlood).itemID) {
     player.inventory.addItemStackToInventory(
         new ItemStack(net.minecraft.item.Item.glassBottle, 8));
   }
   if (item != null
       && item.itemID == ItemGeneric.getItemStackFromName("Jar of Blood").itemID
       && item.getItemDamage()
           == ItemGeneric.getItemStackFromName("Jar of Blood").getItemDamage()) {
     player.inventory.addItemStackToInventory(new ItemStack(net.minecraft.item.Item.bucketEmpty));
   }
   if (item != null && item.getItemName().equals("tile.skullWall")) {
     Necromancy.loggerNecromancy.info(
         craftMatrix.getStackInSlot(0) + " is in " + craftMatrix.getStackInSlot(0).getItemName());
     item.stackTagCompound.setString("Base", craftMatrix.getStackInSlot(1).getItemName());
     item.stackTagCompound.setString(
         "Skull1", ItemNecroSkull.skullTypes[craftMatrix.getStackInSlot(1).getItemDamage()]);
     item.stackTagCompound.setString(
         "Skull2", ItemNecroSkull.skullTypes[craftMatrix.getStackInSlot(4).getItemDamage()]);
     item.stackTagCompound.setString(
         "Skull3", ItemNecroSkull.skullTypes[craftMatrix.getStackInSlot(5).getItemDamage()]);
   }
 }
 // This is how you check if a player has crafted something that returns the block/item you want
 // them to gain an achievement for
 @Override
 public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
   if (item.itemID == Items.forgottenFlowerStrands.itemID) {
     player.addStat(Achievements.craftStrand, 1);
   } else if (item.itemID == Items.forgottenFlowerMesh.itemID) {
     player.addStat(Achievements.craftMesh, 1);
   } else if (item.itemID == Items.forgottenPortalPlacer.itemID) {
     player.addStat(Achievements.craftPortalPlacer, 1);
   } else if (item.itemID == Blocks.brick1.blockID
       || item.itemID == Blocks.brick2.blockID
       || item.itemID == Blocks.brick3.blockID) {
     player.addStat(Achievements.craftBricks, 1);
   }
 }
 @Override
 public boolean itemInteractionForEntity(
     ItemStack itemStack, EntityPlayer player, EntityLivingBase entity) {
   if (entity.worldObj.isRemote) {
     return false;
   } else {
     ItemStack container;
     switch (itemStack.getItemDamage()) {
       case 0:
         break;
       case 1:
         container = LifeSystem.findFilledLifeContainer(player.inventory.mainInventory);
         if (container != null && entity.getHealth() < entity.getMaxHealth()) {
           if (((ILifeContainer) container.getItem()).takeLife(container, 1) > 0) {
             entity.heal(1f);
             player.addStat(ModAchievements.useLP, 1);
             return true;
           }
         }
         break;
       case 2:
         break;
     }
   }
   return false;
 }
  /** Damages the item in the ItemStack */
  public void damageItem(int par1, EntityLivingBase par2EntityLivingBase) {
    if (!(par2EntityLivingBase instanceof EntityPlayer)
        || !((EntityPlayer) par2EntityLivingBase).capabilities.isCreativeMode) {
      if (this.isItemStackDamageable()) {
        if (this.attemptDamageItem(par1, par2EntityLivingBase.getRNG())) {
          par2EntityLivingBase.renderBrokenItemStack(this);
          --this.stackSize;

          if (par2EntityLivingBase instanceof EntityPlayer) {
            EntityPlayer entityplayer = (EntityPlayer) par2EntityLivingBase;
            entityplayer.addStat(
                StatList.objectBreakStats[Item.getIdFromItem(this.field_151002_e)], 1);

            if (this.stackSize == 0 && this.getItem() instanceof ItemBow) {
              entityplayer.destroyCurrentEquippedItem();
            }
          }

          if (this.stackSize < 0) {
            this.stackSize = 0;
          }

          this.itemDamage = 0;
        }
      }
    }
  }
    @Override
    public void onPickupFromSlot(EntityPlayer player, ItemStack stack) {
      if (stack.getItem() instanceof ItemPotion && stack.getItemDamage() > 0)
        player.addStat(AchievementList.potion, 1);

      super.onPickupFromSlot(player, stack);
    }
  public ActionResult<ItemStack> onItemRightClick(
      ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
    if (playerIn.fishEntity != null) {
      int i = playerIn.fishEntity.handleHookRetraction();
      itemStackIn.damageItem(i, playerIn);
      playerIn.swingArm(hand);
    } else {
      worldIn.playSound(
          (EntityPlayer) null,
          playerIn.posX,
          playerIn.posY,
          playerIn.posZ,
          SoundEvents.ENTITY_BOBBER_THROW,
          SoundCategory.NEUTRAL,
          0.5F,
          0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

      if (!worldIn.isRemote) {
        worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
      }

      playerIn.swingArm(hand);
      playerIn.addStat(StatList.getObjectUseStats(this));
    }

    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
  }
  @Override
  public ActionResult<ItemStack> onItemRightClick(
      ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand) {
    if (!playerIn.capabilities.isCreativeMode) {
      --itemStackIn.stackSize;
    }

    worldIn.playSound(
        null,
        playerIn.posX,
        playerIn.posY,
        playerIn.posZ,
        SoundEvents.ENTITY_SNOWBALL_THROW,
        SoundCategory.NEUTRAL,
        0.5F,
        0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!worldIn.isRemote) {
      ThrowballType type =
          ThrowballType.values()[itemStackIn.getMetadata() % ThrowballType.values().length];
      launchThrowball(worldIn, playerIn, type, hand);
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
  }
  /** Calls the corresponding fct in di */
  public void hitEntity(EntityLivingBase par1EntityLivingBase, EntityPlayer par2EntityPlayer) {
    boolean flag = this.field_151002_e.hitEntity(this, par1EntityLivingBase, par2EntityPlayer);

    if (flag) {
      par2EntityPlayer.addStat(StatList.objectUseStats[Item.getIdFromItem(this.field_151002_e)], 1);
    }
  }
Exemple #10
0
  /**
   * Called when the player destroys a block with an item that can harvest it. (i, j, k) are the
   * coordinates of the block and l is the block's subtype/damage.
   */
  public void harvestBlock(World var1, EntityPlayer var2, int var3, int var4, int var5, int var6) {
    var2.addStat(StatList.mineBlockStatArray[this.blockID], 1);

    if (var6 >= 1) {
      ItemStack var7 = new ItemStack(AetherItems.WhiteApple.itemID, 1, 0);
      this.dropBlockAsItem_do(var1, var3, var4, var5, var7);
    }
  }
  @Override
  public void onCreated(ItemStack stack, World world, EntityPlayer player) {
    super.onCreated(stack, world, player);

    if (!world.isRemote) {
      player.addStat(AchievementHandler.PORTABLE_TRANSMUTATION, 1);
    }
  }
Exemple #12
0
 @Override
 public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
   player.addStat(TAchievements.achievements.get("tconstruct.beginner"), 1);
   player.openGui(TConstruct.instance, mantle.client.MProxyClient.manualGuiID, world, 0, 0, 0);
   /*Side side = FMLCommonHandler.instance().getEffectiveSide();
   if (side.isClient())
   	FMLClientHandler.instance().displayGuiScreen(player, new GuiManual(player.getCurrentEquippedItem(), getManualFromStack(stack)));*/
   return stack;
 }
 @Override
 public void onCrafting(EntityPlayer player, ItemStack item, IInventory craftMatrix) {
   if (item.itemID == Item.pickaxeIron.itemID) {
     player.addStat(Achievements.ironPickAch, 1);
   }
   if (item.itemID == Tools.adamantiumPick.itemID) {
     player.addStat(Achievements.adamantiumPickAch, 1);
   }
   if (item.itemID == Tools.onyxPick.itemID) {
     player.addStat(Achievements.onyxPickAch, 1);
   }
   if (item.itemID == Tools.mythrilBow.itemID) {
     player.addStat(Achievements.mythrilBowAch, 1);
   }
   if (item.itemID == Tools.onyxBow.itemID) {
     player.addStat(Achievements.onyxBowAch, 1);
   }
 }
  public void fall(float distance, float damageMultiplier) {
    super.fall(distance, damageMultiplier);

    if (distance > 5.0F) {
      for (EntityPlayer entityplayer : this.getRecursivePassengersByType(EntityPlayer.class)) {
        entityplayer.addStat(AchievementList.FLY_PIG);
      }
    }
  }
Exemple #15
0
 public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) {
   if (!world.isRemote
       && entityplayer.getCurrentEquippedItem() != null
       && entityplayer.getCurrentEquippedItem().itemID == Item.shears.itemID) {
     entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
     dropBlockAsItem_do(world, i, j, k, new ItemStack(Block.leaves.blockID, 1, l & 3));
   } else {
     super.harvestBlock(world, entityplayer, i, j, k, l);
   }
 }
 @Override
 public void putStack(ItemStack par1ItemStack) {
   super.putStack(par1ItemStack);
   if (par1ItemStack != null
       && par1ItemStack.getItem() != null
       && par1ItemStack.getItem() instanceof ItemFood
       && par1ItemStack.hasTagCompound()) {
     NBTTagCompound stackTagCompound = par1ItemStack.getTagCompound();
     if (stackTagCompound == null || !stackTagCompound.getBoolean("frypanKill")) {
       return;
     }
     player.addStat(TAchievements.achievements.get("tconstruct.dualConvenience"), 1);
   }
 }
  public void func_150999_a(
      World p_150999_1_,
      Block p_150999_2_,
      int p_150999_3_,
      int p_150999_4_,
      int p_150999_5_,
      EntityPlayer p_150999_6_) {
    boolean flag =
        this.field_151002_e.onBlockDestroyed(
            this, p_150999_1_, p_150999_2_, p_150999_3_, p_150999_4_, p_150999_5_, p_150999_6_);

    if (flag) {
      p_150999_6_.addStat(StatList.objectUseStats[Item.getIdFromItem(this.field_151002_e)], 1);
    }
  }
  private boolean func_149886_b(World world, int x, int z, int y, int i, EntityPlayer p_149886_6_) {
    int i1 = func_149890_d(i);

    if (i1 != 3 && i1 != 2) {
      return false;
    } else {
      p_149886_6_.addStat(StatList.mineBlockStatArray[Block.getIdFromBlock(this)], 1);
      byte b0 = 1;

      if (i1 == 3) {
        b0 = 2;
      }

      this.dropBlockAsItem(world, x, z, y, new ItemStack(Blocks.tallgrass, 2, b0));
      return true;
    }
  }
  public boolean tryPlaceItemIntoWorld(
      EntityPlayer par1EntityPlayer,
      World par2World,
      int par3,
      int par4,
      int par5,
      int par6,
      float par7,
      float par8,
      float par9) {
    boolean flag =
        this.getItem()
            .onItemUse(this, par1EntityPlayer, par2World, par3, par4, par5, par6, par7, par8, par9);

    if (flag) {
      par1EntityPlayer.addStat(StatList.objectUseStats[Item.getIdFromItem(this.field_151002_e)], 1);
    }

    return flag;
  }
 @Override
 public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) {
   if (!entity.worldObj.isRemote && entity instanceof EntityPlayer) {
     EntityPlayer victim = (EntityPlayer) entity;
     if (victim.capabilities.isCreativeMode
         && !victim.isDead
         && victim.getHealth() > 0
         && !LudicrousItems.isInfinite(victim)) {
       victim
           .func_110142_aN()
           .func_94547_a(
               new DamageSourceInfinitySword(player), victim.getHealth(), victim.getHealth());
       victim.setHealth(0);
       victim.onDeath(new EntityDamageSource("infinity", player));
       player.addStat(Achievements.creative_kill, 1);
       return true;
     }
   }
   return false;
 }
 /** Checks if the player harvesting the block has Fortune enchant. */
 @Override
 public void onBlockHarvested(World world, int x, int y, int z, int meta, EntityPlayer player) {
   // Reset the fortune and silk touch parameters.
   fortune = 0;
   // Check if the player has something in their hand.
   if (player.getCurrentEquippedItem() != null) {
     // Prepare a list of all enchants.
     NBTTagList list = player.getCurrentEquippedItem().getEnchantmentTagList();
     // If the list is not empty...
     if (list != null)
       // Go through all entries.
       for (int i = 0; i < list.tagCount(); i++)
         // If Fortune (id 35) is found, set the level value.
         if (list.getCompoundTagAt(i).getByte("id") == 35)
           fortune = list.getCompoundTagAt(i).getByte("lvl");
   }
   // Grant player the achievement.
   if (HexConfig.cfgGeneralUseAchievements
       && !player.capabilities.isCreativeMode
       && this.canHarvestBlock(player, meta)) player.addStat(HexAchievements.achMineHexOre, 1);
 }
  @Override
  public boolean onBlockActivated(
      World worldIn,
      BlockPos pos,
      IBlockState state,
      EntityPlayer playerIn,
      EnumFacing side,
      float hitX,
      float hitY,
      float hitZ) {
    if (worldIn.isRemote) return true;

    playerIn.openGui(
        Minestrappolation.instance,
        MGuiHandler.GUIID_MELTER,
        worldIn,
        pos.getX(),
        pos.getY(),
        pos.getZ());
    playerIn.addStat(MAchievements.melter, 1);
    return true;
  }
  @Override
  public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
    if (player.worldObj.isRemote) {
      return false;
    }
    Block id = player.worldObj.getBlock(x, y, z);
    if (id instanceof IScollectable) {
      IScollectable target = (IScollectable) id;
      if (target.isCollectable(itemstack, player.worldObj, x, y, z)) {
        ArrayList<ItemStack> drops =
            target.onCollected(
                itemstack,
                player.worldObj,
                x,
                y,
                z,
                EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, itemstack));
        Random rand = new Random();

        for (ItemStack stack : drops) {
          float f = 0.7F;
          double d = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          double d1 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          double d2 = (double) (rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
          EntityItem entityitem =
              new EntityItem(
                  player.worldObj, (double) x + d, (double) y + d1, (double) z + d2, stack);
          entityitem.delayBeforeCanPickup = 10;
          player.worldObj.spawnEntityInWorld(entityitem);
        }

        itemstack.damageItem(1, player);
        player.addStat(StatList.mineBlockStatArray[id.getIdFromBlock(id)], 1);
      }
    }
    return false;
  }
Exemple #24
0
  @Override
  public void harvestBlock(World world, EntityPlayer entityplayer, int i, int j, int k, int l) {
    // super.harvestBlock(world, entityplayer, i, j, k, l);
    if (entityplayer != null) {
      entityplayer.addStat(StatList.mineBlockStatArray[blockID], 1);
      entityplayer.addExhaustion(0.075F);
    }
    Random R = new Random();
    if (R.nextInt(TFCOptions.initialCollapseRatio) == 0) {
      for (int x1 = -1; x1 < 2; x1++) {
        for (int z1 = -1; z1 < 2; z1++) {
          if (Block.blocksList[world.getBlockId(i + x1, j, k + z1)] instanceof BlockCollapsable
              && ((BlockCollapsable) Block.blocksList[world.getBlockId(i + x1, j, k + z1)])
                  .tryToFall(world, i + x1, j, k + z1, world.getBlockMetadata(i + x1, j, k + z1))) {
            int height = 4;
            int range = 5 + R.nextInt(30);
            for (int y = -4; y <= 1; y++) {
              for (int x = -range; x <= range; x++) {
                for (int z = -range; z <= range; z++) {
                  double distance =
                      Math.sqrt(
                          Math.pow(i - (i + x), 2)
                              + Math.pow(j - (j + y), 2)
                              + Math.pow(k - (k + z), 2));

                  if (R.nextInt(100) < TFCOptions.propogateCollapseChance && distance < 35) {
                    if (Block.blocksList[world.getBlockId(i + x, j + y, k + z)]
                            instanceof BlockCollapsable
                        && ((BlockCollapsable)
                                Block.blocksList[world.getBlockId(i + x, j + y, k + z)])
                            .tryToFall(
                                world,
                                i + x,
                                j + y,
                                k + z,
                                world.getBlockMetadata(i + x, j + y, k + z))) {
                      int done = 0;
                      while (done < height) {
                        done++;
                        if (Block.blocksList[world.getBlockId(i + x, j + y + done, k + z)]
                                instanceof BlockCollapsable
                            && R.nextInt(100) < TFCOptions.propogateCollapseChance) {
                          ((BlockCollapsable)
                                  Block.blocksList[world.getBlockId(i + x, j + y + done, k + z)])
                              .tryToFall(
                                  world,
                                  i + x,
                                  j + y + done,
                                  k + z,
                                  world.getBlockMetadata(i + x, j + y + done, k + z));
                        } else {
                          done = height;
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
 /** Detects when the player picks up a certain item or block, and then triggers an achievement. */
 public void notifyPickup(EntityItem item, EntityPlayer player) {
   if (item.getEntityItem().itemID == Blocks.fyriteOre.blockID) {
     player.addStat(Achievements.netherRocksAch, 1);
   }
 }
Exemple #26
0
 @Override
 public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
   dropBlockAsItem(world, x, y, z, meta, 0);
   player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
 }
  @SubscribeEvent
  public void onAttackEntity(AttackEntityEvent event) {
    if (event.entityLiving.worldObj.isRemote) return;

    EntityLivingBase attacker = event.entityLiving;
    EntityPlayer player = event.entityPlayer;
    Entity target = event.target;
    ItemStack stack = attacker.getEquipmentInSlot(0);
    if (stack != null && stack.getItem().onLeftClickEntity(stack, player, target)) return;

    if (target.canAttackWithItem()) {
      if (!target.hitByEntity(target)) {
        float damageAmount = TFC_MobData.STEVE_DAMAGE;
        if (stack != null) {
          damageAmount =
              (float)
                  player
                      .getEntityAttribute(SharedMonsterAttributes.attackDamage)
                      .getAttributeValue();
          // player.addChatMessage("Damage: " + i);
          if (damageAmount == 1.0f) {
            damageAmount = TFC_MobData.STEVE_DAMAGE;
            // i = player.inventory.getCurrentItem().getItem().getDamageVsEntity(target,
            // player.inventory.getCurrentItem());
          }
        }

        if (player.isPotionActive(Potion.damageBoost))
          damageAmount += 3 << player.getActivePotionEffect(Potion.damageBoost).getAmplifier();

        if (player.isPotionActive(Potion.weakness))
          damageAmount -= 2 << player.getActivePotionEffect(Potion.weakness).getAmplifier();

        int knockback = 0;
        float enchantmentDamage = 0;

        if (target instanceof EntityLiving) {
          enchantmentDamage =
              EnchantmentHelper.getEnchantmentModifierLiving(player, (EntityLiving) target);
          knockback += EnchantmentHelper.getKnockbackModifier(player, (EntityLiving) target);
        }

        if (player.isSprinting()) ++knockback;

        if (damageAmount > 0 || enchantmentDamage > 0) {
          boolean criticalHit =
              player.fallDistance > 0.0F
                  && !player.onGround
                  && !player.isOnLadder()
                  && !player.isInWater()
                  && !player.isPotionActive(Potion.blindness)
                  && player.ridingEntity == null
                  && target instanceof EntityLiving;

          if (criticalHit && damageAmount > 0)
            damageAmount += event.entity.worldObj.rand.nextInt((int) (damageAmount / 2 + 2));

          damageAmount += enchantmentDamage;
          boolean onFire = false;
          int fireAspect = EnchantmentHelper.getFireAspectModifier(player);

          if (target instanceof EntityLiving && fireAspect > 0 && !target.isBurning()) {
            onFire = true;
            target.setFire(1);
          }

          boolean entityAttacked =
              target.attackEntityFrom(DamageSource.causePlayerDamage(player), damageAmount);

          if (entityAttacked) {
            if (knockback > 0) {
              target.addVelocity(
                  -MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * knockback * 0.5F,
                  0.1D,
                  MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * knockback * 0.5F);
              player.motionX *= 0.6D;
              player.motionZ *= 0.6D;
              player.setSprinting(false);
            }

            if (criticalHit) player.onCriticalHit(target);

            if (enchantmentDamage > 0) player.onEnchantmentCritical(target);

            if (damageAmount >= 18) player.triggerAchievement(AchievementList.overkill);

            player.setLastAttacker(target);

            if (target instanceof EntityLiving)
              target.attackEntityFrom(DamageSource.causeThornsDamage(attacker), damageAmount);
          }

          ItemStack itemstack = player.getCurrentEquippedItem();
          Object object = target;

          if (target instanceof EntityDragonPart) {
            IEntityMultiPart ientitymultipart = ((EntityDragonPart) target).entityDragonObj;
            if (ientitymultipart instanceof EntityLiving) object = ientitymultipart;
          }

          if (itemstack != null && object instanceof EntityLiving) {
            itemstack.hitEntity((EntityLiving) object, player);
            if (itemstack.stackSize <= 0) player.destroyCurrentEquippedItem();
          }

          if (target instanceof EntityLivingBase) {
            player.addStat(StatList.damageDealtStat, Math.round(damageAmount * 10.0f));
            if (fireAspect > 0 && entityAttacked) target.setFire(fireAspect * 4);
            else if (onFire) target.extinguish();
          }

          player.addExhaustion(0.3F);
        }
      }
    }
    event.setCanceled(true);
  }
  public void onCrafting(EntityPlayer player, ItemStack stack) {
    stack.onCrafting(player.worldObj, player, stack.stackSize);

    if (stack.getItem() == Item.getItemFromBlock(Blocks.crafting_table)) {
      player.addStat(AchievementList.buildWorkBench, 1);
    }

    if (stack.getItem() instanceof ItemPickaxe) {
      player.addStat(AchievementList.buildPickaxe, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.furnace)) {
      player.addStat(AchievementList.buildFurnace, 1);
    }

    if (stack.getItem() instanceof ItemHoe) {
      player.addStat(AchievementList.buildHoe, 1);
    }

    if (stack.getItem() == Items.bread) {
      player.addStat(AchievementList.makeBread, 1);
    }

    if (stack.getItem() == Items.cake) {
      player.addStat(AchievementList.bakeCake, 1);
    }

    if (stack.getItem() instanceof ItemPickaxe
        && ((ItemPickaxe) stack.getItem()).func_150913_i() != Item.ToolMaterial.WOOD) {
      player.addStat(AchievementList.buildBetterPickaxe, 1);
    }

    if (stack.getItem() instanceof ItemSword) {
      player.addStat(AchievementList.buildSword, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.enchanting_table)) {
      player.addStat(AchievementList.enchantments, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(Blocks.bookshelf)) {
      player.addStat(AchievementList.bookcase, 1);
    }

    if (stack.getItem() == Item.getItemFromBlock(CraftingPillars.blockCraftingPillar)) {
      player.addStat(CraftingPillars.achievementRecursion, 1);
      System.out.println("achivement recursion");
    }
  }
 public void onCrafting(World par1World, EntityPlayer par2EntityPlayer, int par3) {
   par2EntityPlayer.addStat(
       StatList.objectCraftStats[Item.getIdFromItem(this.field_151002_e)], par3);
   this.field_151002_e.onCreated(this, par1World, par2EntityPlayer);
 }
  /**
   * Called when the player stops using an Item (stops holding the right mouse button).
   *
   * @param timeLeft The amount of ticks left before the using would have been complete
   */
  @Override
  public void onPlayerStoppedUsing(
      ItemStack stack, World worldIn, EntityLivingBase playerIn, int timeLeft) {
    if (playerIn instanceof EntityPlayer) {
      EntityPlayer player = (EntityPlayer) playerIn;

      int itemUseDuration = this.getMaxItemUseDuration(stack) - timeLeft;
      itemUseDuration =
          net.minecraftforge.event.ForgeEventFactory.onArrowLoose(
              stack,
              worldIn,
              player,
              itemUseDuration,
              isUsableByPlayer(stack, (EntityPlayer) playerIn));

      if (isUsableByPlayer(stack, player)) {
        float arrowDamage = getArrowDamage(itemUseDuration);
        // I don't understand why this is done, but ItemBow does it, so we'll do it
        if ((double) arrowDamage < 0.1D) {
          return;
        }

        //            MEMLogger.info("ItemCustomBow onPlayerStoppedUsing(): f = " + arrowDamage + ";
        // j = " + itemUseDuration + "; timeLeft = " + timeLeft);

        EntityArrow entityarrow = getNewEntityArrow(worldIn, player, itemUseDuration);
        //	            FFQLogger.info("Created a(n) " + entityarrow.getName() + " [damage: " +
        // entityarrow.getDamage() + "]");

        entityarrow.setIsCritical(shotIsCritical(itemUseDuration, arrowDamage));
        //            if (entityarrow.getIsCritical()) {
        //                MEMLogger.info("ItemCustomBow onPlayerStoppedUsing(): PEW! PEW!");
        //            }

        applyEnchantments(entityarrow, stack);
        initializeArrowVelocity(entityarrow, player, arrowDamage);

        takeDamage(1, stack, player);

        worldIn.playSound(
            player.posX,
            player.posY,
            player.posZ,
            SoundEvents.ENTITY_ARROW_SHOOT,
            SoundCategory.HOSTILE,
            1.0F,
            (1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + arrowDamage * 0.5F),
            true);

        if (hasInfiniteArrows(stack, player)) {
          entityarrow.pickupStatus = EntityArrow.PickupStatus.CREATIVE_ONLY;
        } else {
          this.consumeAmmo(stack, worldIn, player);
        }

        player.addStat(StatList.getObjectUseStats(this));

        if (!worldIn.isRemote) {
          worldIn.spawnEntityInWorld(entityarrow);
        }
      }
    }
  }