Guest User

Untitled

a guest
May 29th, 2016
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 3.03 KB | None | 0 0
  1. package halestormxv.eAngelus.items.cards;
  2.  
  3. import java.util.List;
  4.  
  5. import net.minecraft.entity.EntityLivingBase;
  6. import net.minecraft.entity.effect.EntityLightningBolt;
  7. import net.minecraft.entity.player.EntityPlayer;
  8. import net.minecraft.item.EnumAction;
  9. import net.minecraft.item.EnumRarity;
  10. import net.minecraft.item.Item;
  11. import net.minecraft.item.ItemStack;
  12. import net.minecraft.nbt.NBTTagCompound;
  13. import net.minecraft.nbt.NBTTagList;
  14. import net.minecraft.nbt.NBTTagString;
  15. import net.minecraft.util.EnumActionResult;
  16. import net.minecraft.util.EnumFacing;
  17. import net.minecraft.util.EnumHand;
  18. import net.minecraft.util.math.BlockPos;
  19. import net.minecraft.world.World;
  20. import net.minecraftforge.common.MinecraftForge;
  21. import net.minecraftforge.event.entity.player.ArrowLooseEvent;
  22. import net.minecraftforge.fml.relauncher.Side;
  23. import net.minecraftforge.fml.relauncher.SideOnly;
  24.  
  25. public class O_card_Fire extends Item
  26. {
  27.     //public  double powerCost;
  28.  
  29.     public O_card_Fire()
  30.     {
  31.         this.setMaxStackSize(1);
  32.         this.setMaxDamage(-1);
  33.     }
  34.  
  35.     public boolean isDamageable()
  36.     {
  37.         return false;
  38.     }
  39.  
  40.     @Override
  41.     public void onPlayerStoppedUsing(ItemStack itemstack, World worldIn, EntityLivingBase entityLiving, int timeLeft)
  42.     {
  43.         int chargeTime = 0;
  44.         ArrowLooseEvent event = new ArrowLooseEvent((EntityPlayer) entityLiving, itemstack, worldIn, chargeTime, false);
  45.         MinecraftForge.EVENT_BUS.post(event);
  46.         if (event.isCanceled())
  47.         {
  48.             return;
  49.         }
  50.         //int j = this.getMaxItemUseDuration(itemstack) - timeLeft;
  51.         int j = event.getCharge();
  52.         List<EntityLivingBase> targetList = entityLiving.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, entityLiving.getEntityBoundingBox().expand(8.0F + j, 8.0F + j, 8.0F + j)); 
  53.         for (EntityLivingBase targets : targetList)
  54.         {
  55.             if ( targets != null)
  56.             {
  57.                 if ( targets != (EntityPlayer)entityLiving)
  58.                 {
  59.                     ((EntityPlayer)entityLiving).worldObj.spawnEntityInWorld(new EntityLightningBolt(worldIn, targets.posX, targets.posY, targets.posZ, false) );
  60.                     targets.clearActivePotions();
  61.                     worldIn.createExplosion(targets, targets.posX, targets.posY, targets.posZ, 3.2F + (j / 2), true);
  62.                     targets.setHealth(targets.getHealth() - j);
  63.                     //worldIn.playSoundAtEntity(targets, RefStrings.MODID + ":leo_gift_execute", 1.4F, 1.0F);
  64.                 }
  65.             }
  66.         }
  67.     }
  68. }
  69.  
  70.  
  71. /*
  72. @Override
  73. public void addInformation(ItemStack istack, EntityPlayer player, List info, boolean par4) {
  74.  
  75.     NBTTagCompound tag = istack.stackTagCompound;
  76.  
  77.     if (tag == null)
  78.     {
  79.         tag = new NBTTagCompound();
  80.         tag.setTag("display", new NBTTagCompound());
  81.         istack.stackTagCompound = tag;
  82.     }
  83.  
  84.     tag.getTag("display");
  85.     tag.setTag("display", new NBTTagCompound());
  86.     NBTTagCompound taglore = tag.getCompoundTag("display");
  87.     NBTTagList lore = new NBTTagList();
  88.  
  89.     lore.appendTag(new NBTTagString("§r"+"This is a special item, for adding"));
  90.     lore.appendTag(new NBTTagString("§r"+"guests"));
  91.     lore.appendTag(new NBTTagString("§r"+"into your home."));
  92.  
  93.     taglore.setTag("Lore", lore);
  94. }*/
Add Comment
Please, Sign In to add comment