/**
  * Equivalent code to the creative pick block
  *
  * @param target The client target vector
  * @param player The player trying to pick
  * @return the stack expected for the creative pick button
  */
 private static ItemStack getItemFromPointedAt(MovingObjectPosition target, EntityPlayer player) {
   if (target != null) {
     if (target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
       BlockPos pos = target.getBlockPos();
       World world = player.getEntityWorld();
       Block block = world.getBlockState(pos).getBlock();
       if (block.isAir(world, pos)) {
         return null;
       }
       return block.getPickBlock(target, world, pos);
     } else {
       if (target.typeOfHit != MovingObjectPosition.MovingObjectType.ENTITY
           || target.entityHit == null
           || !player.capabilities.isCreativeMode) {
         return null;
       }
       return target.entityHit.getPickedResult(target);
     }
   }
   return null;
 }