package common.item;

import common.entity.npc.EntityNPC;
import common.entity.projectile.EntitySnowball;
import common.init.SoundEvent;
import common.world.World;

public class ItemSnowball extends Item
{
    public ItemSnowball()
    {
        this.setTab(CheatTab.tabTools);
    }

    /**
     * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
     */
    public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityNPC playerIn)
    {
//        if (!playerIn.creative)
//        {
        --itemStackIn.stackSize;
//        }

        worldIn.playSoundAtEntity(playerIn, SoundEvent.THROW, 0.5F);

        if (!worldIn.client)
        {
            worldIn.spawnEntityInWorld(new EntitySnowball(worldIn, playerIn));
        }

//        playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
        return itemStackIn;
    }
}
