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;
|
2013-07-03 07:51:39 +00:00
|
|
|
import biomesoplenty.entities.projectiles.EntityMudball;
|
2013-05-03 13:00:44 +00:00
|
|
|
|
|
|
|
public class ItemBOPMudball extends Item
|
|
|
|
{
|
2013-05-31 10:34:02 +00:00
|
|
|
public ItemBOPMudball(int par1)
|
|
|
|
{
|
|
|
|
super(par1);
|
|
|
|
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
2013-07-03 06:01:28 +00:00
|
|
|
itemIcon = iconRegister.registerIcon("biomesoplenty:mudball");
|
2013-05-31 10:34:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
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));
|
|
|
|
|
2013-07-03 00:56:13 +00:00
|
|
|
if (!par2World.isRemote)
|
|
|
|
{
|
|
|
|
par2World.spawnEntityInWorld(new EntityMudball(par2World, par3EntityPlayer));
|
2013-05-31 10:34:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return itemStack;
|
|
|
|
}
|
2013-05-03 13:00:44 +00:00
|
|
|
}
|