BiomesOPlenty/src/minecraft/biomesoplenty/items/ItemBOPMudball.java

39 lines
1.2 KiB
Java
Raw Normal View History

2013-05-03 13:00:44 +00:00
package biomesoplenty.items;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import biomesoplenty.BiomesOPlenty;
import biomesoplenty.items.projectiles.EntityMudball;
public class ItemBOPMudball extends Item
{
public ItemBOPMudball(int par1)
{
super(par1);
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
setUnlocalizedName("mudball");
}
public void registerIcons(IconRegister iconRegister)
{
itemIcon = iconRegister.registerIcon("BiomesOPlenty:mudball");
}
public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
--itemStack.stackSize;
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
par2World.spawnEntityInWorld(new EntityMudball(par2World, par3EntityPlayer));
return itemStack;
}
}