2016-01-08 19:56:36 +00:00
|
|
|
package WayofTime.bloodmagic.item.soul;
|
|
|
|
|
2016-03-17 20:00:44 +00:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
2016-03-16 08:10:33 +00:00
|
|
|
import WayofTime.bloodmagic.client.IVariantProvider;
|
2016-03-17 20:00:44 +00:00
|
|
|
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
|
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
2016-01-08 19:56:36 +00:00
|
|
|
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;
|
2016-03-16 08:10:33 +00:00
|
|
|
import org.apache.commons.lang3.tuple.ImmutablePair;
|
|
|
|
import org.apache.commons.lang3.tuple.Pair;
|
2016-01-08 19:56:36 +00:00
|
|
|
|
2016-03-17 20:00:44 +00:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
2016-03-16 08:10:33 +00:00
|
|
|
public class ItemSoulSnare extends Item implements IVariantProvider
|
2016-01-08 19:56:36 +00:00
|
|
|
{
|
|
|
|
public static String[] names = { "base" };
|
|
|
|
|
|
|
|
public ItemSoulSnare()
|
|
|
|
{
|
|
|
|
super();
|
|
|
|
|
|
|
|
setUnlocalizedName(Constants.Mod.MODID + ".soulSnare.");
|
2016-01-19 06:34:12 +00:00
|
|
|
setRegistryName(Constants.BloodMagicItem.SOUL_SNARE.getRegName());
|
2016-01-08 19:56:36 +00:00
|
|
|
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)
|
|
|
|
{
|
2016-01-10 22:37:47 +00:00
|
|
|
tooltip.addAll(Arrays.asList(TextHelper.cutLongString(TextHelper.localizeEffect("tooltip.BloodMagic.soulSnare.desc"))));
|
2016-01-08 19:56:36 +00:00
|
|
|
|
|
|
|
super.addInformation(stack, player, tooltip, advanced);
|
|
|
|
}
|
2016-03-16 08:10:33 +00:00
|
|
|
|
|
|
|
@Override
|
2016-03-16 22:41:06 +00:00
|
|
|
public List<Pair<Integer, String>> getVariants()
|
|
|
|
{
|
2016-03-16 08:10:33 +00:00
|
|
|
List<Pair<Integer, String>> ret = new ArrayList<Pair<Integer, String>>();
|
|
|
|
ret.add(new ImmutablePair<Integer, String>(0, "type=soulsnare"));
|
|
|
|
return ret;
|
|
|
|
}
|
2016-01-08 19:56:36 +00:00
|
|
|
}
|