You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.0 KiB
Java
37 lines
1.0 KiB
Java
package net.minecraft.item;
|
|
|
|
import net.minecraft.creativetab.CreativeTabs;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.entity.projectile.EntityEgg;
|
|
import net.minecraft.world.World;
|
|
|
|
public class ItemEgg extends Item
|
|
{
|
|
private static final String __OBFID = "CL_00000023";
|
|
|
|
public ItemEgg()
|
|
{
|
|
this.maxStackSize = 16;
|
|
this.setCreativeTab(CreativeTabs.tabMaterials);
|
|
}
|
|
|
|
/**
|
|
* Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer
|
|
*/
|
|
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer player)
|
|
{
|
|
if (!player.capabilities.isCreativeMode)
|
|
{
|
|
--itemStackIn.stackSize;
|
|
}
|
|
|
|
worldIn.playSoundAtEntity(player, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
|
|
|
if (!worldIn.isRemote)
|
|
{
|
|
worldIn.spawnEntityInWorld(new EntityEgg(worldIn, player));
|
|
}
|
|
|
|
return itemStackIn;
|
|
}
|
|
} |