Advertisement
HalestormXV

Untitled

Aug 19th, 2016
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.67 KB | None | 0 0
  1. package halestormxv.eAngelus.items.cards;
  2.  
  3. import java.util.List;
  4.  
  5. import halestormxv.eAngelus.items.ModItemBowBase;
  6. import halestormxv.eAngelus.items.eAngelusCards;
  7. import halestormxv.eAngelus.main.Reference;
  8. import net.minecraft.enchantment.EnchantmentHelper;
  9. import net.minecraft.entity.Entity;
  10. import net.minecraft.entity.EntityLivingBase;
  11. import net.minecraft.entity.effect.EntityLightningBolt;
  12. import net.minecraft.entity.player.EntityPlayer;
  13. import net.minecraft.entity.projectile.EntityArrow;
  14. import net.minecraft.init.Enchantments;
  15. import net.minecraft.init.SoundEvents;
  16. import net.minecraft.item.EnumAction;
  17. import net.minecraft.item.Item;
  18. import net.minecraft.item.ItemStack;
  19. import net.minecraft.stats.StatList;
  20. import net.minecraft.util.ActionResult;
  21. import net.minecraft.util.EnumActionResult;
  22. import net.minecraft.util.EnumHand;
  23. import net.minecraft.util.SoundCategory;
  24. import net.minecraft.world.World;
  25. import net.minecraftforge.common.MinecraftForge;
  26. import net.minecraftforge.event.entity.player.ArrowLooseEvent;
  27.  
  28. public class O_card_Lightning extends eAngelusCards
  29. {
  30.    
  31.     public O_card_Lightning(String unlocalizedName)
  32.     {
  33.         super(unlocalizedName);
  34.     }
  35.  
  36.     public boolean isDamageable()
  37.     {
  38.         return false;
  39.     }
  40.  
  41.     @Override
  42.     public boolean hasEffect(ItemStack par1ItemStack){
  43.         return true;
  44.     }
  45.  
  46.  
  47.     public int getMaxItemUseDuration(ItemStack itemstack)
  48.     {
  49.         return 72000;
  50.     }
  51.  
  52.     public EnumAction getItemUseAction(ItemStack itemstack)
  53.     {
  54.         return EnumAction.BLOCK;
  55.     }
  56.  
  57.     public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer player, int chargedTime)
  58.     {
  59.         int j = this.getMaxItemUseDuration(itemstack) - chargedTime;
  60.  
  61.         ArrowLooseEvent event = new ArrowLooseEvent(player, itemstack, world, j, true);
  62.         MinecraftForge.EVENT_BUS.post(event);
  63.         if (event.isCanceled())
  64.         {
  65.             return;
  66.         }
  67.         j = event.getCharge();
  68.  
  69.             if (j > 400){ j = 400;}
  70.             j = Math.round(j / 40);
  71.             List<EntityLivingBase> targetList = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, player.getCollisionBoundingBox().expand(8.0F + j, 8.0F + j, 8.0F + j));  
  72.             for (EntityLivingBase targets : targetList)
  73.             {
  74.                 if ( targets != null)
  75.                 {
  76.                     if ( targets != player )
  77.                     {
  78.                         player.worldObj.spawnEntityInWorld(new EntityLightningBolt(world, targets.posX, targets.posY, targets.posZ, true) );
  79.                         targets.clearActivePotions();
  80.                         world.createExplosion(targets, targets.posX, targets.posY, targets.posZ, 3.2F + (j / 2), true);
  81.                         targets.setHealth(targets.getHealth() - j);
  82.                     }
  83.                 }
  84.             }
  85.     }
  86.  
  87.     public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
  88.     {
  89.         return itemstack;
  90.     }
  91. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement