Advertisement
Guest User

Untitled

a guest
May 27th, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.19 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.     @SideOnly(Side.CLIENT)
  42.     public EnumRarity getRarity(ItemStack stack){
  43.         return EnumRarity.UNCOMMON;
  44.     }
  45.  
  46.     @Override
  47.     public boolean hasEffect(ItemStack stack){
  48.         return true;
  49.     }
  50.  
  51.     @Override
  52.     @SideOnly(Side.CLIENT)
  53.     public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced)
  54.     {
  55.         tooltip.add("");
  56.         tooltip.add("\u00A76" + "You fall into my arms.");
  57.         tooltip.add("\u00A76" + "You are the good gift of destruction's path.");
  58.         tooltip.add("\u00A76" + "When life sickens more than disease.");
  59.         tooltip.add("\u00A76" + "And boldness is the root of beauty...");
  60.         tooltip.add("");
  61.         tooltip.add("\u00A7n" + "Calls down a storm of lightning on surrounding enemies.");
  62.     }
  63.  
  64.     public EnumAction getItemUseAction(ItemStack itemstack)
  65.     {
  66.         return EnumAction.BOW;
  67.     }
  68.  
  69.     /*@Override
  70.     public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
  71.             EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
  72.         // TODO Auto-generated method stub
  73.         //return super.onItemUse(stack, playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
  74.     }*/
  75.  
  76.  
  77.     @Override
  78.     public void onPlayerStoppedUsing(ItemStack itemstack, World worldIn, EntityLivingBase entityLiving, int timeLeft)
  79.     {
  80.         int chargeTime = 0;
  81.         ArrowLooseEvent event = new ArrowLooseEvent((EntityPlayer) entityLiving, itemstack, worldIn, chargeTime, false);
  82.         MinecraftForge.EVENT_BUS.post(event);
  83.         if (event.isCanceled())
  84.         {
  85.             return;
  86.         }
  87.         //int j = this.getMaxItemUseDuration(itemstack) - timeLeft;
  88.         int j = event.getCharge();
  89.         List<EntityLivingBase> targetList = entityLiving.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, entityLiving.getEntityBoundingBox().expand(8.0F + j, 8.0F + j, 8.0F + j)); 
  90.         for (EntityLivingBase targets : targetList)
  91.         {
  92.             if ( targets != null)
  93.             {
  94.                 if ( targets != (EntityPlayer)entityLiving)
  95.                 {
  96.                     ((EntityPlayer)entityLiving).worldObj.spawnEntityInWorld(new EntityLightningBolt(worldIn, targets.posX, targets.posY, targets.posZ, false) );
  97.                     targets.clearActivePotions();
  98.                     worldIn.createExplosion(targets, targets.posX, targets.posY, targets.posZ, 3.2F + (j / 2), true);
  99.                     targets.setHealth(targets.getHealth() - j);
  100.                     //worldIn.playSoundAtEntity(targets, RefStrings.MODID + ":leo_gift_execute", 1.4F, 1.0F);
  101.                 }
  102.             }
  103.         }
  104.     }
  105. }
  106.  
  107.  
  108. /*
  109. @Override
  110. public void addInformation(ItemStack istack, EntityPlayer player, List info, boolean par4) {
  111.  
  112.     NBTTagCompound tag = istack.stackTagCompound;
  113.  
  114.     if (tag == null)
  115.     {
  116.         tag = new NBTTagCompound();
  117.         tag.setTag("display", new NBTTagCompound());
  118.         istack.stackTagCompound = tag;
  119.     }
  120.  
  121.     tag.getTag("display");
  122.     tag.setTag("display", new NBTTagCompound());
  123.     NBTTagCompound taglore = tag.getCompoundTag("display");
  124.     NBTTagList lore = new NBTTagList();
  125.  
  126.     lore.appendTag(new NBTTagString("§r"+"This is a special item, for adding"));
  127.     lore.appendTag(new NBTTagString("§r"+"guests"));
  128.     lore.appendTag(new NBTTagString("§r"+"into your home."));
  129.  
  130.     taglore.setTag("Lore", lore);
  131. }*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement