Java Code Examples for net.minecraft.entity.player.EntityPlayer.onItemPickup()

The following are Jave code examples for showing how to use onItemPickup() of the net.minecraft.entity.player.EntityPlayer class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: DecompiledMinecraft   File: EntityArrow.java   View Source Code Vote up 6 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
    {
        boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityIn.capabilities.isCreativeMode;

        if (this.canBePickedUp == 1 && !entityIn.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1)))
        {
            flag = false;
        }

        if (flag)
        {
            this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            entityIn.onItemPickup(this, 1);
            this.setDead();
        }
    }
}
 
Example 2
Project: DecompiledMinecraft   File: EntityArrow.java   View Source Code Vote up 6 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
    {
        boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityIn.capabilities.isCreativeMode;

        if (this.canBePickedUp == 1 && !entityIn.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1)))
        {
            flag = false;
        }

        if (flag)
        {
            this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            entityIn.onItemPickup(this, 1);
            this.setDead();
        }
    }
}
 
Example 3
Project: Backmemed   File: EntityArrow.java   View Source Code Vote up 6 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.world.isRemote && this.inGround && this.arrowShake <= 0)
    {
        boolean flag = this.pickupStatus == EntityArrow.PickupStatus.ALLOWED || this.pickupStatus == EntityArrow.PickupStatus.CREATIVE_ONLY && entityIn.capabilities.isCreativeMode;

        if (this.pickupStatus == EntityArrow.PickupStatus.ALLOWED && !entityIn.inventory.addItemStackToInventory(this.getArrowStack()))
        {
            flag = false;
        }

        if (flag)
        {
            entityIn.onItemPickup(this, 1);
            this.setDead();
        }
    }
}
 
Example 4
Project: BaseClient   File: EntityArrow.java   View Source Code Vote up 6 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0)
    {
        boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2 && entityIn.capabilities.isCreativeMode;

        if (this.canBePickedUp == 1 && !entityIn.inventory.addItemStackToInventory(new ItemStack(Items.arrow, 1)))
        {
            flag = false;
        }

        if (flag)
        {
            this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            entityIn.onItemPickup(this, 1);
            this.setDead();
        }
    }
}
 
Example 5
Project: Solar   File: EntityStaticItem.java   View Source Code Vote up 6 votes
@Override
public void onCollideWithPlayer(EntityPlayer player) {
	if(!this.world.isRemote) {
		if(cannotPickup()) return;
		ItemStack itemstack = this.getItem();
		Item item = itemstack.getItem();
		int i = itemstack.getCount();

		int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, player);
		if(hook < 0) return;

		if(hook == 1 || i <= 0 || player.inventory.addItemStackToInventory(itemstack)) {
			net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(player, this);
			player.onItemPickup(this, i);

			if(itemstack.isEmpty()) {
				this.setDead();
				itemstack.setCount(i);
			}

			player.addStat(StatList.getObjectsPickedUpStats(item), i);
		}
	}
}
 
Example 6
Project: connor41-etfuturum2   File: EntityTippedArrow.java   View Source Code Vote up 6 votes
@Override
public void onCollideWithPlayer(EntityPlayer player) {
	boolean inGround = false;
	try {
		inGround = ReflectionHelper.getPrivateValue(EntityArrow.class, this, "inGround", "field_70254_i");
	} catch (Exception e) {
	}

	if (!worldObj.isRemote && inGround && arrowShake <= 0 && isEffectValid()) {
		boolean flag = canBePickedUp == 1 || canBePickedUp == 2 && player.capabilities.isCreativeMode;

		ItemStack stack = new ItemStack(ModItems.tipped_arrow);
		TippedArrow.setEffect(stack, Potion.potionTypes[effect.getPotionID()], effect.getDuration());

		if (canBePickedUp == 1 && !player.inventory.addItemStackToInventory(stack))
			flag = false;

		if (flag) {
			playSound("random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
			player.onItemPickup(this, 1);
			setDead();
		}
	}
}
 
Example 7
Project: TFCPrimitiveTech   File: EntityProjectileHardStone.java   View Source Code Vote up 6 votes
@Override
public void onCollideWithPlayer(EntityPlayer player)
{
	if (!this.worldObj.isRemote)
	{
		NBTTagCompound nbt = new NBTTagCompound();
		this.writeToNBT(nbt);

		boolean inground = nbt.hasKey("inGround") && nbt.getByte("inGround") == 1;
		if(inground)
		{
			boolean flag = this.canBePickedUp == 1 || (this.canBePickedUp == 2 && player.capabilities.isCreativeMode);

			EntityItem ei = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(this.pickupItem, 1, 0));

			if (this.canBePickedUp == 1)
			{
				EntityItemPickupEvent event = new EntityItemPickupEvent(player, ei);

				if (MinecraftForge.EVENT_BUS.post(event))
					return;
			}

			ItemStack itemstack = ei.getEntityItem();
			if (itemstack.stackSize <= 0)
				flag = true;
			else if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(itemstack))
				flag = false;

			if (flag)
			{
				this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
				player.onItemPickup(this, 1);
				this.setDead();
			}
		}
	}
}
 
Example 8
Project: WirelessRedstone   File: EntityWirelessTracker.java   View Source Code Vote up 5 votes
@Override
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
{
    if (!this.world.isRemote && item && par1EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ModItems.itemTracker, 1, freq)))
    {
        //TODO SoundCat for this.
        this.world.playSound(null, posX, posY, posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
        par1EntityPlayer.onItemPickup(this, 1);
        setDead();
    }
}
 
Example 9
Project: CustomWorldGen   File: EntityXPOrb.java   View Source Code Vote up 5 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0)
        {
            if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.player.PlayerPickupXpEvent(entityIn, this))) return;
            entityIn.xpCooldown = 2;
            this.worldObj.playSound((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.ENTITY_EXPERIENCE_ORB_TOUCH, SoundCategory.PLAYERS, 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
            entityIn.onItemPickup(this, 1);
            ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, entityIn);

            if (itemstack != null && itemstack.isItemDamaged())
            {
                int i = Math.min(this.xpToDurability(this.xpValue), itemstack.getItemDamage());
                this.xpValue -= this.durabilityToXp(i);
                itemstack.setItemDamage(itemstack.getItemDamage() - i);
            }

            if (this.xpValue > 0)
            {
                entityIn.addExperience(this.xpValue);
            }

            this.setDead();
        }
    }
}
 
Example 10
Project: BaseClient   File: EntityXPOrb.java   View Source Code Vote up 5 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0)
        {
            entityIn.xpCooldown = 2;
            this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
            entityIn.onItemPickup(this, 1);
            entityIn.addExperience(this.xpValue);
            this.setDead();
        }
    }
}
 
Example 11
Project: TFCPrimitiveTech   File: EntityProjectileSharpStone.java   View Source Code Vote up 5 votes
@Override
public void onCollideWithPlayer(EntityPlayer player)
{
	if (!this.worldObj.isRemote)
	{
		NBTTagCompound nbt = new NBTTagCompound();
		this.writeToNBT(nbt);

		boolean inground = nbt.hasKey("inGround") && nbt.getByte("inGround") == 1;
		if(inground)
		{
			boolean flag = this.canBePickedUp == 1 || (this.canBePickedUp == 2 && player.capabilities.isCreativeMode);

			EntityItem ei = new EntityItem(this.worldObj, this.posX, this.posY, this.posZ, new ItemStack(this.pickupItem, 1, 0));

			if (this.canBePickedUp == 1)
			{
				EntityItemPickupEvent event = new EntityItemPickupEvent(player, ei);

				if (MinecraftForge.EVENT_BUS.post(event))
					return;
			}

			ItemStack itemstack = ei.getEntityItem();
			if (itemstack.stackSize <= 0)
				flag = true;
			else if (this.canBePickedUp == 1 && !player.inventory.addItemStackToInventory(itemstack))
				flag = false;

			if (flag)
			{
				this.playSound("random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
				player.onItemPickup(this, 1);
				this.setDead();
			}
		}
	}
}
 
Example 12
Project: BaseClient   File: EntityXPOrb.java   View Source Code Vote up 5 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0)
        {
            entityIn.xpCooldown = 2;
            this.worldObj.playSoundAtEntity(entityIn, "random.orb", 0.1F, 0.5F * ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.8F));
            entityIn.onItemPickup(this, 1);
            entityIn.addExperience(this.xpValue);
            this.setDead();
        }
    }
}
 
Example 13
Project: Anima-Mundi   File: EntityNodeItem.java   View Source Code Vote up 5 votes
@Override
public void onCollideWithPlayer(EntityPlayer entityIn)
{
	if(!this.world.isRemote && AnimaConfig.allowPlayerPickup)
	{
		if(age < 10)
			return;
		ItemStack itemstack = this.getItem();
		Item item = itemstack.getItem();
		int i = itemstack.getCount();

		int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn);
		if(hook < 0)
			return;

		if(entityIn.inventory.addItemStackToInventory(itemstack))
		{
			net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this);
			entityIn.onItemPickup(this, i);

			if(itemstack.isEmpty())
			{
				this.setDead();
				itemstack.setCount(i);
			}

			entityIn.addStat(StatList.getObjectsPickedUpStats(item), i);
		}
	}
}
 
Example 14
Project: Halloween   File: EntityCurseOrb.java   View Source Code Vote up 5 votes
@Override
public void onCollideWithPlayer(EntityPlayer player)
{
	if (!this.world.isRemote && this.thrower == player && this.inGround && this.throwableShake <= 0)
	{
		this.playSound(SoundEvents.ENTITY_ITEM_PICKUP, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
		player.onItemPickup(this, 1);
		this.setDead();
	}
}
 
Example 15
Project: Backmemed   File: EntityXPOrb.java   View Source Code Vote up 5 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.world.isRemote)
    {
        if (this.delayBeforeCanPickup == 0 && entityIn.xpCooldown == 0)
        {
            entityIn.xpCooldown = 2;
            entityIn.onItemPickup(this, 1);
            ItemStack itemstack = EnchantmentHelper.getEnchantedItem(Enchantments.MENDING, entityIn);

            if (!itemstack.func_190926_b() && itemstack.isItemDamaged())
            {
                int i = Math.min(this.xpToDurability(this.xpValue), itemstack.getItemDamage());
                this.xpValue -= this.durabilityToXp(i);
                itemstack.setItemDamage(itemstack.getItemDamage() - i);
            }

            if (this.xpValue > 0)
            {
                entityIn.addExperience(this.xpValue);
            }

            this.setDead();
        }
    }
}
 
Example 16
Project: DecompiledMinecraft   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 17
Project: DecompiledMinecraft   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 18
Project: CustomWorldGen   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        if (this.delayBeforeCanPickup > 0) return;
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        int hook = net.minecraftforge.event.ForgeEventFactory.onItemPickup(this, entityIn, itemstack);
        if (hook < 0) return;

        if (this.delayBeforeCanPickup <= 0 && (this.owner == null || lifespan - this.age <= 200 || this.owner.equals(entityIn.getName())) && (hook == 1 || i <= 0 || entityIn.inventory.addItemStackToInventory(itemstack)))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.LOG))
            {
                entityIn.addStat(AchievementList.MINE_WOOD);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.LOG2))
            {
                entityIn.addStat(AchievementList.MINE_WOOD);
            }

            if (itemstack.getItem() == Items.LEATHER)
            {
                entityIn.addStat(AchievementList.KILL_COW);
            }

            if (itemstack.getItem() == Items.DIAMOND)
            {
                entityIn.addStat(AchievementList.DIAMONDS);
            }

            if (itemstack.getItem() == Items.BLAZE_ROD)
            {
                entityIn.addStat(AchievementList.BLAZE_ROD);
            }

            if (itemstack.getItem() == Items.DIAMOND && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.addStat(AchievementList.DIAMONDS_TO_YOU);
                }
            }

            net.minecraftforge.fml.common.FMLCommonHandler.instance().firePlayerItemPickupEvent(entityIn, this);
            if (!this.isSilent())
            {
                this.worldObj.playSound((EntityPlayer)null, entityIn.posX, entityIn.posY, entityIn.posZ, SoundEvents.ENTITY_ITEM_PICKUP, SoundCategory.PLAYERS, 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

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

            entityIn.addStat(StatList.getObjectsPickedUpStats(itemstack.getItem()), i);
        }
    }
}
 
Example 19
Project: BaseClient   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.worldObj.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        int i = itemstack.stackSize;

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Item.getItemFromBlock(Blocks.log2))
            {
                entityIn.triggerAchievement(AchievementList.mineWood);
            }

            if (itemstack.getItem() == Items.leather)
            {
                entityIn.triggerAchievement(AchievementList.killCow);
            }

            if (itemstack.getItem() == Items.diamond)
            {
                entityIn.triggerAchievement(AchievementList.diamonds);
            }

            if (itemstack.getItem() == Items.blaze_rod)
            {
                entityIn.triggerAchievement(AchievementList.blazeRod);
            }

            if (itemstack.getItem() == Items.diamond && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.worldObj.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.triggerAchievement(AchievementList.diamondsToYou);
                }
            }

            if (!this.isSilent())
            {
                this.worldObj.playSoundAtEntity(entityIn, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.stackSize <= 0)
            {
                this.setDead();
            }
        }
    }
}
 
Example 20
Project: Backmemed   File: EntityItem.java   View Source Code Vote up 4 votes
/**
 * Called by a player entity when they collide with an entity
 */
public void onCollideWithPlayer(EntityPlayer entityIn)
{
    if (!this.world.isRemote)
    {
        ItemStack itemstack = this.getEntityItem();
        Item item = itemstack.getItem();
        int i = itemstack.func_190916_E();

        if (this.delayBeforeCanPickup == 0 && (this.owner == null || 6000 - this.age <= 200 || this.owner.equals(entityIn.getName())) && entityIn.inventory.addItemStackToInventory(itemstack))
        {
            if (item == Item.getItemFromBlock(Blocks.LOG))
            {
                entityIn.addStat(AchievementList.MINE_WOOD);
            }

            if (item == Item.getItemFromBlock(Blocks.LOG2))
            {
                entityIn.addStat(AchievementList.MINE_WOOD);
            }

            if (item == Items.LEATHER)
            {
                entityIn.addStat(AchievementList.KILL_COW);
            }

            if (item == Items.DIAMOND)
            {
                entityIn.addStat(AchievementList.DIAMONDS);
            }

            if (item == Items.BLAZE_ROD)
            {
                entityIn.addStat(AchievementList.BLAZE_ROD);
            }

            if (item == Items.DIAMOND && this.getThrower() != null)
            {
                EntityPlayer entityplayer = this.world.getPlayerEntityByName(this.getThrower());

                if (entityplayer != null && entityplayer != entityIn)
                {
                    entityplayer.addStat(AchievementList.DIAMONDS_TO_YOU);
                }
            }

            entityIn.onItemPickup(this, i);

            if (itemstack.func_190926_b())
            {
                this.setDead();
                itemstack.func_190920_e(i);
            }

            entityIn.addStat(StatList.getObjectsPickedUpStats(item), i);
        }
    }
}