Advertisement
Guest User

Untitled

a guest
Sep 12th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.76 KB | None | 0 0
  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 EntityMagicMissile extends EntitySpell
  19. {
  20.     public EntityMagicMissile(World world)
  21.     {
  22.         super(world);
  23.     }
  24.    
  25.    
  26.     public EntityMagicMissile(World world, EntityLivingBase entity)
  27.     {
  28.         super(world, entity);
  29.         caster = entity;
  30.         System.out.println("MAGICMISSILE!");
  31.     }
  32.  
  33.     public EntityMagicMissile(World world, double x, double y, double z)
  34.     {
  35.         super(world, x, y, z);
  36.     }
  37.    
  38.     @Override
  39.     protected void onImpact(RayTraceResult result)
  40.     {
  41.         if(result.typeOfHit == Type.BLOCK)
  42.         {
  43.             setDead();
  44.         }
  45.         else if(result.entityHit != null)
  46.         {
  47.             if(result.entityHit != caster)
  48.             {
  49.                 result.entityHit.attackEntityFrom(DamageSource.magic, 5);
  50.                 setDead();
  51.             }
  52.         }
  53.     }
  54.    
  55.     @Override
  56.     public void onUpdate()
  57.     {
  58.         super.onUpdate();
  59.         particles();
  60.     }
  61.    
  62.     void particles()
  63.     {
  64.         this.worldObj.spawnParticle(EnumParticleTypes.CRIT_MAGIC, true, this.posX, this.posY, this.posZ, this.motionX, this.motionY, this.motionZ, new int[0]);    
  65.         this.worldObj.spawnParticle(EnumParticleTypes.CRIT_MAGIC, true, this.posX, this.posY, this.posZ, 0, 0, 0, new int[0]);
  66.         System.out.println("magicspam");
  67.     }
  68. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement