Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.31 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 func_189662_a(DataFixer p_189662_0_) {
  34.         EntityThrowable.func_189661_a(p_189662_0_, "knife");
  35.     }
  36.  
  37.     @Override
  38.     protected void onImpact(RayTraceResult result) {
  39.         if (result.entityHit != null) {
  40.             result.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 41.0F);
  41.         }
  42.         if (!this.worldObj.isRemote && this.rand.nextInt(4) == 0) {
  43.             int i = 1;
  44.  
  45.             if (this.rand.nextInt(32) == 0) {
  46.                 i = 4;
  47.             }
  48.  
  49.             double d0 = 0.08D;
  50.  
  51.             for (int k = 0; k < 8; ++k) {
  52.                 this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, this.posX, this.posY, this.posZ,
  53.                         ((double) this.rand.nextFloat() - 0.5D) * 0.08D,
  54.                         ((double) this.rand.nextFloat() - 0.5D) * 0.08D,
  55.                         ((double) this.rand.nextFloat() - 0.5D) * 0.08D, new int[] { Item.getIdFromItem(Items.EGG) });
  56.                 {
  57.                     {
  58.                         super.onUpdate();
  59.                         int i1 = MathHelper.floor_double(this.getEntityBoundingBox().minX + 0.001D);
  60.                         int j = MathHelper.floor_double(this.getEntityBoundingBox().minY + 0.001D);
  61.                         int k1 = MathHelper.floor_double(this.getEntityBoundingBox().minZ + 0.001D);
  62.                         World world = this.worldObj;
  63.                         Entity entity = (Entity) this;
  64.  
  65.                         if (true) {
  66.                             world.setBlockState(new BlockPos(i, j, k), Blocks.FLOWING_LAVA.getDefaultState(), 3);
  67.                         }
  68.  
  69.                         this.kill();
  70.                     }
  71.  
  72.                     if (!this.worldObj.isRemote) {
  73.                         this.setDead();
  74.                     }
  75.                 }
  76.             }
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement