Advertisement
Guest User

pellets

a guest
Feb 3rd, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.77 KB | None | 0 0
  1. @Override
  2.     protected void onImpact(RayTraceResult result)
  3.     {
  4.         if(result.typeOfHit == Type.BLOCK)
  5.         {
  6.             if(!world.isRemote&&world.getBlockState(result.getBlockPos()).getBlockHardness(world, result.getBlockPos())>1)
  7.             {
  8.                 System.out.println("ping!");
  9.                 this.world.spawnParticle(EnumParticleTypes.LAVA, this.posX, this.posY, this.posZ, 0, 0, 0, new int[0]);
  10.                 this.world.playSound(posX, posY, posZ, SoundEvents.BLOCK_ANVIL_FALL, SoundCategory.HOSTILE, 1, 1, false);
  11.             }
  12.             if(world.getBlockState(result.getBlockPos()).getCollisionBoundingBox(world, result.getBlockPos()) != null)setDead();
  13.         }
  14.         else if(result.entityHit != null)
  15.         {
  16.            
  17.             result.entityHit.attackEntityFrom(DamageSource.GENERIC, 3);
  18.             result.entityHit.hurtResistantTime = 0;
  19.             setDead();
  20.         }
  21.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement