2013-05-07 01:02:25 +00:00
|
|
|
package biomesoplenty.items;
|
|
|
|
|
|
|
|
import net.minecraft.client.renderer.texture.IconRegister;
|
2013-05-08 12:13:51 +00:00
|
|
|
import net.minecraft.enchantment.Enchantment;
|
|
|
|
import net.minecraft.enchantment.EnchantmentHelper;
|
2013-05-07 01:02:25 +00:00
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-05-08 12:13:51 +00:00
|
|
|
import net.minecraft.entity.projectile.EntityArrow;
|
2013-05-07 01:02:25 +00:00
|
|
|
import net.minecraft.item.Item;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.world.World;
|
|
|
|
import biomesoplenty.BiomesOPlenty;
|
2013-05-08 12:13:51 +00:00
|
|
|
import biomesoplenty.api.Items;
|
2013-05-07 01:02:25 +00:00
|
|
|
import biomesoplenty.items.projectiles.EntityDart;
|
2013-05-12 03:37:49 +00:00
|
|
|
import biomesoplenty.items.projectiles.EntityPoisonDart;
|
2013-05-07 01:02:25 +00:00
|
|
|
|
|
|
|
public class ItemDartBlower extends Item
|
|
|
|
{
|
|
|
|
public ItemDartBlower(int par1)
|
|
|
|
{
|
|
|
|
super(par1);
|
|
|
|
this.maxStackSize = 1;
|
2013-05-08 12:39:12 +00:00
|
|
|
this.setMaxDamage(63);
|
2013-05-07 01:02:25 +00:00
|
|
|
setCreativeTab(BiomesOPlenty.tabBiomesOPlenty);
|
|
|
|
setUnlocalizedName("dartblower");
|
|
|
|
}
|
|
|
|
|
|
|
|
public void registerIcons(IconRegister iconRegister)
|
|
|
|
{
|
|
|
|
itemIcon = iconRegister.registerIcon("BiomesOPlenty:dartblower");
|
|
|
|
}
|
|
|
|
|
|
|
|
public ItemStack onItemRightClick(ItemStack itemStack, World par2World, EntityPlayer par3EntityPlayer)
|
|
|
|
{
|
2013-05-08 12:13:51 +00:00
|
|
|
boolean flag = par3EntityPlayer.capabilities.isCreativeMode;
|
2013-05-07 01:02:25 +00:00
|
|
|
|
2013-05-12 03:37:49 +00:00
|
|
|
if (par3EntityPlayer.inventory.hasItem(Items.dart.get().itemID))
|
2013-05-08 12:13:51 +00:00
|
|
|
{
|
2013-05-11 12:51:16 +00:00
|
|
|
//EntityArrow entitydart = new EntityArrow(par2World, par3EntityPlayer, 2.0F);
|
2013-05-08 12:13:51 +00:00
|
|
|
|
|
|
|
itemStack.damageItem(1, par3EntityPlayer);
|
|
|
|
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 1.0F, 2.0F / (1.0F * 0.4F + 1.2F) + 1.0F * 0.5F);
|
2013-05-07 01:02:25 +00:00
|
|
|
|
2013-05-08 12:13:51 +00:00
|
|
|
if (!flag)
|
|
|
|
par3EntityPlayer.inventory.consumeInventoryItem(Items.dart.get().itemID);
|
2013-05-07 01:02:25 +00:00
|
|
|
|
2013-05-08 12:13:51 +00:00
|
|
|
if (!par2World.isRemote)
|
2013-05-12 03:37:49 +00:00
|
|
|
if (par3EntityPlayer.inventory.hasItemStack(new ItemStack(Items.dart.get().itemID, 1, 0)))
|
2013-05-13 19:51:26 +00:00
|
|
|
par2World.spawnEntityInWorld(new EntityDart(par2World, par3EntityPlayer, 1.0F));
|
2013-05-12 03:37:49 +00:00
|
|
|
else
|
2013-05-13 19:51:26 +00:00
|
|
|
par2World.spawnEntityInWorld(new EntityPoisonDart(par2World, par3EntityPlayer, 1.0F));
|
2013-05-08 12:13:51 +00:00
|
|
|
}
|
|
|
|
|
2013-05-07 01:02:25 +00:00
|
|
|
return itemStack;
|
|
|
|
}
|
|
|
|
}
|