36 lines
965 B
Java
36 lines
965 B
Java
![]() |
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, 0.4F / (itemRand.floatv() * 0.4F + 0.8F));
|
||
|
|
||
|
if (!worldIn.client)
|
||
|
{
|
||
|
worldIn.spawnEntityInWorld(new EntityEgg(worldIn, playerIn));
|
||
|
}
|
||
|
|
||
|
// playerIn.triggerAchievement(StatRegistry.objectUseStats[ItemRegistry.getIdFromItem(this)]);
|
||
|
return itemStackIn;
|
||
|
}
|
||
|
}
|