tcr/java/src/game/item/ItemEgg.java

35 lines
923 B
Java
Executable file

package game.item;
import game.entity.npc.EntityNPC;
import game.entity.projectile.EntityEgg;
import game.init.SoundEvent;
import game.world.World;
public class ItemEgg extends Item
{
public ItemEgg()
{
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 EntityEgg(worldIn, playerIn));
}
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
return itemStackIn;
}
}