Advertisement
Guest User

Untitled

a guest
May 27th, 2016
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.13 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.Item;
  18. import net.minecraft.item.ItemStack;
  19. import net.minecraft.nbt.NBTTagCompound;
  20. import net.minecraft.util.EnumActionResult;
  21. import net.minecraft.util.EnumFacing;
  22. import net.minecraft.util.EnumHand;
  23. import net.minecraft.util.math.BlockPos;
  24. import net.minecraft.world.World;
  25.  
  26. public class eAngelusCards extends Item
  27. {
  28.     public static Class<? extends Item>[] itemCardsClasses = new Class[]
  29.             {
  30.                     O_card_Fire.class,
  31.                     O_card_Wind.class,
  32.                     O_card_Wither.class,
  33.                     O_card_Strength.class,
  34.                     O_card_Lightning.class
  35.             };
  36.  
  37.     //Offense Card Names
  38.     public static final String[] O_cardNames = new String[] {"cIgnis", "cFortitudo", "cVentus", "cArescet", "cLightning"};
  39.  
  40.  
  41.     public eAngelusCards(String unlocalizedName)
  42.     {
  43.         this.setUnlocalizedName(unlocalizedName);
  44.         this.setCreativeTab(Reference.eaCreativeTab);
  45.         this.setHasSubtypes(true);
  46.     }
  47.  
  48.     @Override
  49.     public void getSubItems(Item item, CreativeTabs tab, List<ItemStack> items)
  50.     {
  51.         for (int i = 0; i < O_cardNames.length; ++i)
  52.         {
  53.             items.add(new ItemStack(item, 1, i));
  54.         }
  55.     }
  56.  
  57.     @Override
  58.     public String getUnlocalizedName(ItemStack stack)
  59.     {
  60.         for (int i = 0; i < O_cardNames .length; ++i)
  61.             if(stack.getItemDamage() == i)
  62.             {
  63.                 return this.getUnlocalizedName() + "." + O_cardNames[i];
  64.             }
  65.         return "Invalid";
  66.     }
  67.  
  68.     @Override
  69.     public EnumActionResult onItemUse(ItemStack itemstack, EntityPlayer playerIn, World world, BlockPos pos,
  70.             EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)  
  71.     {
  72.         if (!world.isRemote)
  73.         {
  74.             try
  75.             {
  76.                 Item card = itemCardsClasses[itemstack.getItemDamage()].getConstructor(World.class).newInstance(world);
  77.                
  78.                 //int sF = CardCostFormula[itemstack.getItemDamage()];
  79.                 //int sB = CardCostBase[itemstack.getItemDamage()];
  80.                 //int sC = CardUsageCost = (int)(Math.ceil((player.experienceLevel) / sF));
  81.                 //return EnumActionResult.SUCCESS;
  82.             }
  83.             catch (InstantiationException card) {
  84.                 card.printStackTrace();
  85.             }
  86.             catch (IllegalAccessException card) {
  87.                 card.printStackTrace();
  88.             }
  89.             catch (IllegalArgumentException card) {
  90.                 card.printStackTrace();
  91.             }
  92.             catch (InvocationTargetException card) {
  93.                 card.printStackTrace();
  94.             }
  95.             catch (NoSuchMethodException card) {
  96.                 card.printStackTrace();
  97.             }
  98.             catch (SecurityException card) {
  99.                 card.printStackTrace();
  100.             }
  101.         }
  102.         else if (itemstack.getItemDamage() > O_cardNames.length){};
  103.         return EnumActionResult.FAIL;
  104.     }
  105.  
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement