Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.11 KB | None | 0 0
  1. package top.mod.item;
  2.  
  3. import net.minecraft.entity.Entity;
  4. import net.minecraft.entity.EntityLivingBase;
  5. import net.minecraft.entity.projectile.EntityThrowable;
  6. import net.minecraft.init.Blocks;
  7. import net.minecraft.init.Items;
  8. import net.minecraft.item.Item;
  9. import net.minecraft.util.DamageSource;
  10. import net.minecraft.util.EnumParticleTypes;
  11. import net.minecraft.util.datafix.DataFixer;
  12. import net.minecraft.util.math.BlockPos;
  13. import net.minecraft.util.math.MathHelper;
  14. import net.minecraft.util.math.RayTraceResult;
  15. import net.minecraft.world.World;
  16.  
  17. public class EntityFirestaff extends EntityThrowable {
  18.     public EntityFirestaff(World worldIn) {
  19.         super(worldIn);
  20.  
  21.     }
  22.  
  23.     public EntityFirestaff(World worldIn, EntityLivingBase throwerIn) {
  24.         super(worldIn, throwerIn);
  25.  
  26.     }
  27.  
  28.     public EntityFirestaff(World worldIn, double x, double y, double z) {
  29.         super(worldIn, x, y, z);
  30.  
  31.     }
  32.  
  33.      public static void registerFixesSnowball(DataFixer fixer)
  34.         {
  35.             EntityThrowable.registerFixesThrowable(fixer, "platinum");
  36.         }
  37.  
  38.     @Override
  39.     protected void onImpact(RayTraceResult result) {
  40.         if (result.entityHit != null) {
  41.             result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 41.0F);
  42.         }
  43.         if (!this.world.isRemote && this.rand.nextInt(4) == 0) {
  44.             int i = 1;
  45.  
  46.             if (this.rand.nextInt(32) == 0) {
  47.                 i = 4;
  48.             }
  49.  
  50.             double d0 = 0.08D;
  51.  
  52.             for (int k = 0; k < 8; ++k) {
  53.                 this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ,
  54.                         ((double) this.rand.nextFloat() - 0.5D) * 0.08D,
  55.                         ((double) this.rand.nextFloat() - 0.5D) * 0.08D,
  56.                         ((double) this.rand.nextFloat() - 0.5D) * 0.08D, new int[] { Item.getIdFromItem(Items.EGG) });
  57.                 {
  58.                     {
  59.                         super.onUpdate();
  60.                        
  61.                         World world = this.world;
  62.                         Entity entity = (Entity) this;
  63.  
  64.                         if (true) {
  65.                             world.setBlockState(new BlockPos(this.posX, this.posY, this.posZ), Blocks.FLOWING_LAVA.getDefaultState(), 3);
  66.                            
  67.                         }
  68.  
  69.                         this.kill();
  70.                     }
  71.  
  72.                     if (!this.world.isRemote) {
  73.                         this.setDead();
  74.                     }
  75.                 }
  76.             }
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement