Guest User

Untitled

a guest
May 29th, 2016
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.33 KB | None | 0 0
  1. package halestormxv.eAngelus.items;
  2.  
  3. import java.lang.reflect.InvocationTargetException;
  4. import java.util.List;
  5. import java.util.Random;
  6.  
  7. import halestormxv.eAngelus.items.cards.O_card_Fire;
  8. import halestormxv.eAngelus.items.cards.O_card_Lightning;
  9. import halestormxv.eAngelus.items.cards.O_card_Strength;
  10. import halestormxv.eAngelus.items.cards.O_card_Wind;
  11. import halestormxv.eAngelus.items.cards.O_card_Wither;
  12. import halestormxv.eAngelus.main.Reference;
  13. import net.minecraft.creativetab.CreativeTabs;
  14. import net.minecraft.entity.Entity;
  15. import net.minecraft.entity.passive.EntityTameable;
  16. import net.minecraft.entity.player.EntityPlayer;
  17. import net.minecraft.item.EnumAction;
  18. import net.minecraft.item.EnumRarity;
  19. import net.minecraft.item.Item;
  20. import net.minecraft.item.ItemStack;
  21. import net.minecraft.nbt.NBTTagCompound;
  22. import net.minecraft.util.ActionResult;
  23. import net.minecraft.util.EnumActionResult;
  24. import net.minecraft.util.EnumFacing;
  25. import net.minecraft.util.EnumHand;
  26. import net.minecraft.util.math.BlockPos;
  27. import net.minecraft.world.World;
  28. import net.minecraftforge.fml.relauncher.Side;
  29. import net.minecraftforge.fml.relauncher.SideOnly;
  30.  
  31. public class eAngelusCards extends Item
  32. {
  33.     public static Class<? extends Item>[] itemCardsClasses = new Class[]
  34.             {
  35.                     O_card_Fire.class,
  36.                     O_card_Wind.class,
  37.                     O_card_Wither.class,
  38.                     O_card_Strength.class,
  39.                     O_card_Lightning.class
  40.             };
  41.  
  42.     //Offense Card Names
  43.     public static final String[] O_cardNames = new String[] {"cIgnis", "cFortitudo", "cVentus", "cArescet", "cLightning"};
  44.  
  45.  
  46.     public eAngelusCards(String unlocalizedName)
  47.     {
  48.         this.setUnlocalizedName(unlocalizedName);
  49.         this.setCreativeTab(Reference.eaCreativeTab);
  50.         this.setHasSubtypes(true);
  51.     }
  52.  
  53.     @Override
  54.     public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> items)
  55.     {
  56.         for (int i = 0; i < O_cardNames.length; ++i)
  57.         {
  58.             items.add(new ItemStack(item, 1, i));
  59.         }
  60.     }
  61.    
  62.     public int getMaxItemUseDuration(ItemStack stack)
  63.     {
  64.         return 72000;
  65.     }
  66.  
  67.     public EnumAction getItemUseAction(ItemStack stack)
  68.     {
  69.         return EnumAction.BOW;
  70.     }
  71.  
  72.     @Override
  73.     public String getUnlocalizedName(ItemStack stack)
  74.     {
  75.         for (int i = 0; i < O_cardNames .length; ++i)
  76.             if(stack.getItemDamage() == i)
  77.             {
  78.                 return this.getUnlocalizedName() + "." + O_cardNames[i];
  79.             }
  80.         return "Invalid";
  81.     }
  82.  
  83.     @Override
  84.     public EnumActionResult onItemUse(ItemStack itemstack, EntityPlayer playerIn, World world, BlockPos pos,
  85.             EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)  
  86.     {
  87.         if (!world.isRemote)
  88.         {
  89.             try
  90.             {
  91.                 Item card = itemCardsClasses[itemstack.getItemDamage()].getConstructor(World.class).newInstance(world);
  92.  
  93.                 //int sF = CardCostFormula[itemstack.getItemDamage()];
  94.                 //int sB = CardCostBase[itemstack.getItemDamage()];
  95.                 //int sC = CardUsageCost = (int)(Math.ceil((player.experienceLevel) / sF));
  96.                 //return EnumActionResult.SUCCESS;
  97.             }
  98.             catch (InstantiationException card) {
  99.                 card.printStackTrace();
  100.             }
  101.             catch (IllegalAccessException card) {
  102.                 card.printStackTrace();
  103.             }
  104.             catch (IllegalArgumentException card) {
  105.                 card.printStackTrace();
  106.             }
  107.             catch (InvocationTargetException card) {
  108.                 card.printStackTrace();
  109.             }
  110.             catch (NoSuchMethodException card) {
  111.                 card.printStackTrace();
  112.             }
  113.             catch (SecurityException card) {
  114.                 card.printStackTrace();
  115.             }
  116.         }
  117.         else if (itemstack.getItemDamage() > O_cardNames.length){};
  118.         return EnumActionResult.FAIL;
  119.     }
  120.  
  121.     @Override
  122.     @SideOnly(Side.CLIENT)
  123.     public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
  124.     {
  125.         if (stack.getItemDamage() == 0)
  126.         {
  127.             tooltip.add("");
  128.             tooltip.add("\u00A76" + "You fall into my arms.");
  129.             tooltip.add("\u00A76" + "You are the good gift of destruction's path.");
  130.             tooltip.add("\u00A76" + "When life sickens more than disease.");
  131.             tooltip.add("\u00A76" + "And boldness is the root of beauty...");
  132.             tooltip.add("");
  133.             tooltip.add("\u00A7n" + "Calls down a storm of lightning on surrounding enemies.");
  134.         }
  135.     }
  136.  
  137.     @Override
  138.     @SideOnly(Side.CLIENT)
  139.     public EnumRarity getRarity(ItemStack stack)
  140.     {
  141.         if (stack.getItemDamage() == 0)
  142.         {
  143.             return EnumRarity.UNCOMMON;
  144.         }else{
  145.             return EnumRarity.COMMON;
  146.         }
  147.     }
  148.  
  149. }
Advertisement
Add Comment
Please, Sign In to add comment