73 lines
2.1 KiB
Java
73 lines
2.1 KiB
Java
![]() |
package WayofTime.bloodmagic.item.soul;
|
||
|
|
||
|
import java.util.List;
|
||
|
|
||
|
import net.minecraft.creativetab.CreativeTabs;
|
||
|
import net.minecraft.entity.player.EntityPlayer;
|
||
|
import net.minecraft.item.Item;
|
||
|
import net.minecraft.item.ItemStack;
|
||
|
import net.minecraft.world.World;
|
||
|
import net.minecraftforge.fml.relauncher.Side;
|
||
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
||
|
import WayofTime.bloodmagic.BloodMagic;
|
||
|
import WayofTime.bloodmagic.api.Constants;
|
||
|
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
|
||
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
||
|
|
||
|
public class ItemSoulSnare extends Item
|
||
|
{
|
||
|
public static String[] names = { "base" };
|
||
|
|
||
|
public ItemSoulSnare()
|
||
|
{
|
||
|
super();
|
||
|
|
||
|
setUnlocalizedName(Constants.Mod.MODID + ".soulSnare.");
|
||
|
setCreativeTab(BloodMagic.tabBloodMagic);
|
||
|
setHasSubtypes(true);
|
||
|
setMaxStackSize(16);
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn)
|
||
|
{
|
||
|
if (!playerIn.capabilities.isCreativeMode)
|
||
|
{
|
||
|
--itemStackIn.stackSize;
|
||
|
}
|
||
|
|
||
|
worldIn.playSoundAtEntity(playerIn, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
|
||
|
|
||
|
if (!worldIn.isRemote)
|
||
|
{
|
||
|
worldIn.spawnEntityInWorld(new EntitySoulSnare(worldIn, playerIn));
|
||
|
}
|
||
|
|
||
|
return itemStackIn;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public String getUnlocalizedName(ItemStack stack)
|
||
|
{
|
||
|
return super.getUnlocalizedName(stack) + names[stack.getItemDamage()];
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
@SideOnly(Side.CLIENT)
|
||
|
public void getSubItems(Item id, CreativeTabs creativeTab, List<ItemStack> list)
|
||
|
{
|
||
|
for (int i = 0; i < names.length; i++)
|
||
|
list.add(new ItemStack(id, 1, i));
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
@SideOnly(Side.CLIENT)
|
||
|
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
|
||
|
{
|
||
|
tooltip.add(TextHelper.localize("tooltip.BloodMagic.soulSnare.desc1"));
|
||
|
tooltip.add(TextHelper.localize("tooltip.BloodMagic.soulSnare.desc2"));
|
||
|
|
||
|
super.addInformation(stack, player, tooltip, advanced);
|
||
|
}
|
||
|
}
|