Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.21 KB | None | 0 0
  1. package top.mod.item;
  2.  
  3. import net.minecraft.entity.EntityLivingBase;
  4. import net.minecraft.entity.effect.EntityLightningBolt;
  5. import net.minecraft.entity.monster.EntityBlaze;
  6. import net.minecraft.entity.projectile.EntityThrowable;
  7. import net.minecraft.init.Blocks;
  8. import net.minecraft.util.DamageSource;
  9. import net.minecraft.util.EnumParticleTypes;
  10. import net.minecraft.util.datafix.DataFixer;
  11. import net.minecraft.util.math.BlockPos;
  12. import net.minecraft.util.math.RayTraceResult;
  13. import net.minecraft.world.World;
  14. import net.minecraftforge.fml.relauncher.Side;
  15. import net.minecraftforge.fml.relauncher.SideOnly;
  16.  
  17. public class EntityLightningstaff extends EntityThrowable
  18. {
  19.     public EntityLightningstaff(World worldIn)
  20.     {
  21.         super(worldIn);
  22.     }
  23.  
  24.     public EntityLightningstaff(World worldIn, EntityLivingBase throwerIn)
  25.     {
  26.         super(worldIn, throwerIn);
  27.     }
  28.  
  29.     public EntityLightningstaff(World worldIn, double x, double y, double z)
  30.     {
  31.         super(worldIn, x, y, z);
  32.     }
  33.  
  34.     public static void registerFixesSnowball(DataFixer fixer)
  35.     {
  36.         EntityThrowable.registerFixesThrowable(fixer, "lightningentity");
  37.     }
  38.  
  39.     @SideOnly(Side.CLIENT)
  40.     public void handleStatusUpdate(byte id)
  41.     {
  42.         if (id == 3)
  43.         {
  44.             for (int i = 0; i < 8; ++i)
  45.             {
  46.                 this.world.spawnParticle(EnumParticleTypes.FLAME, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, new int[0]);
  47.             }
  48.         }
  49.     }
  50.  
  51.     /**
  52.      * Called when this EntityThrowable hits a block or entity.
  53.      */
  54.     protected void onImpact(RayTraceResult result)
  55.     {
  56.         if (result.entityHit != null)
  57.         {
  58.             int i = 0;
  59.  
  60.             if (result.entityHit instanceof EntityBlaze)
  61.             {
  62.                 i = 3;
  63.             }
  64.  
  65.             result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 41.0F);
  66.            
  67.         }
  68.  
  69.         if (!this.world.isRemote)
  70.         {
  71.             this.world.setEntityState(this, (byte)3);
  72.             world.spawnEntity(new EntityLightningBolt(world, this.posX, this.posY, this.posZ, false));
  73.             this.setDead();
  74.         }
  75.     }
  76. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement