Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package halestormxv.eAngelus.items.cards;
- import java.util.List;
- import halestormxv.eAngelus.items.ModItemBowBase;
- import halestormxv.eAngelus.items.eAngelusCards;
- import halestormxv.eAngelus.main.Reference;
- import net.minecraft.enchantment.EnchantmentHelper;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.effect.EntityLightningBolt;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.entity.projectile.EntityArrow;
- import net.minecraft.init.Enchantments;
- import net.minecraft.init.SoundEvents;
- import net.minecraft.item.EnumAction;
- import net.minecraft.item.Item;
- import net.minecraft.item.ItemStack;
- import net.minecraft.stats.StatList;
- import net.minecraft.util.ActionResult;
- import net.minecraft.util.EnumActionResult;
- import net.minecraft.util.EnumHand;
- import net.minecraft.util.SoundCategory;
- import net.minecraft.world.World;
- import net.minecraftforge.common.MinecraftForge;
- import net.minecraftforge.event.entity.player.ArrowLooseEvent;
- public class O_card_Lightning extends eAngelusCards
- {
- public O_card_Lightning(String unlocalizedName)
- {
- super(unlocalizedName);
- }
- public boolean isDamageable()
- {
- return false;
- }
- @Override
- public boolean hasEffect(ItemStack par1ItemStack){
- return true;
- }
- public int getMaxItemUseDuration(ItemStack itemstack)
- {
- return 72000;
- }
- public EnumAction getItemUseAction(ItemStack itemstack)
- {
- return EnumAction.BLOCK;
- }
- public void onPlayerStoppedUsing(ItemStack itemstack, World world, EntityPlayer player, int chargedTime)
- {
- int j = this.getMaxItemUseDuration(itemstack) - chargedTime;
- ArrowLooseEvent event = new ArrowLooseEvent(player, itemstack, world, j, true);
- MinecraftForge.EVENT_BUS.post(event);
- if (event.isCanceled())
- {
- return;
- }
- j = event.getCharge();
- if (j > 400){ j = 400;}
- j = Math.round(j / 40);
- List<EntityLivingBase> targetList = player.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, player.getCollisionBoundingBox().expand(8.0F + j, 8.0F + j, 8.0F + j));
- for (EntityLivingBase targets : targetList)
- {
- if ( targets != null)
- {
- if ( targets != player )
- {
- player.worldObj.spawnEntityInWorld(new EntityLightningBolt(world, targets.posX, targets.posY, targets.posZ, true) );
- targets.clearActivePotions();
- world.createExplosion(targets, targets.posX, targets.posY, targets.posZ, 3.2F + (j / 2), true);
- targets.setHealth(targets.getHealth() - j);
- }
- }
- }
- }
- public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer player)
- {
- return itemstack;
- }
- }
Add Comment
Please, Sign In to add comment