SHARE
TWEET

Untitled

a guest Sep 12th, 2016 58 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //Copyright (C) 2016 Andrew Morin
  2. //Licensed under GNU GPL v3; see license.txt for complete license terms + conditions etc.
  3.  
  4. package theishiopian.dungeonmagic.entity.spells;
  5.  
  6. import net.minecraft.entity.EntityLivingBase;
  7. import net.minecraft.init.Blocks;
  8. import net.minecraft.init.SoundEvents;
  9. import net.minecraft.util.DamageSource;
  10. import net.minecraft.util.EnumParticleTypes;
  11. import net.minecraft.util.SoundCategory;
  12. import net.minecraft.util.math.BlockPos;
  13. import net.minecraft.util.math.RayTraceResult;
  14. import net.minecraft.util.math.RayTraceResult.Type;
  15. import net.minecraft.world.World;
  16. import theishiopian.dungeonmagic.entity.EntitySpell;
  17.  
  18. public class EntityFirebolt extends EntitySpell
  19. {
  20.     public EntityFirebolt(World world)
  21.     {
  22.         super(world);
  23.     }
  24.    
  25.     public EntityFirebolt(World world, EntityLivingBase entity)
  26.     {
  27.         super(world, entity);
  28.         caster = entity;
  29.         System.out.println("FIREBOLT!");
  30.     }
  31.  
  32.     public EntityFirebolt(World world, double x, double y, double z)
  33.     {
  34.         super(world, x, y, z);
  35.     }
  36.    
  37.     @Override
  38.     protected void onImpact(RayTraceResult result)
  39.     {
  40.         if(result.typeOfHit == Type.BLOCK)
  41.         {
  42.             setDead();
  43.         }
  44.         else if(result.entityHit != null)
  45.         {
  46.             if(result.entityHit != caster)
  47.             {
  48.                 result.entityHit.attackEntityFrom(DamageSource.inFire, 5);
  49.                 setDead();
  50.             }
  51.         }
  52.     }
  53.    
  54.     @Override
  55.     public void onUpdate()
  56.     {
  57.         super.onUpdate();
  58.         flame();
  59.     }
  60.    
  61.     void flame()
  62.     {
  63.         this.worldObj.spawnParticle(EnumParticleTypes.FLAME, true, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, new int[0]);     
  64.         this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, true, this.posX, this.posY, this.posZ, 0, 0, 0, new int[0]);
  65.         System.out.println("firespam");
  66.     }
  67. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top