public void tickBlock(BlockPos pos){
  List<BlockPos> validCoords=new ArrayList<>();
  for (int xOffset=-TICK_RANGE; xOffset <= TICK_RANGE; xOffset++) {
    for (int zOffset=-TICK_RANGE; zOffset <= TICK_RANGE; zOffset++) {
      if (xOffset == 0 && zOffset == 0)       continue;
      if (isValidSwapPosition(pos.add(xOffset,0,zOffset)))       validCoords.add(pos.add(xOffset,0,zOffset));
    }
  }
  if (!validCoords.isEmpty() && !world.isRemote) {
    BlockPos toSwap=validCoords.get(rand.nextInt(validCoords.size()));
    world.setBlockState(toSwap,stateToSet,1 | 2);
  }
}

public void tickBlock ( BlockPos pos ) { List < BlockPos > validCoords = new ArrayList < > ( ) ; for ( int xOffset = - TICK_RANGE ; xOffset <= TICK_RANGE ; xOffset ++ ) { for ( int zOffset = - TICK_RANGE ; zOffset <= TICK_RANGE ; zOffset ++ ) { if ( xOffset == 0 && zOffset == 0 ) continue ; if ( isValidSwapPosition ( pos . add ( xOffset , 0 , zOffset ) ) ) validCoords . add ( pos . add ( xOffset , 0 , zOffset ) ) ; } } if ( ! validCoords . isEmpty ( ) && ! world . isRemote ) { BlockPos toSwap = validCoords . get ( rand . nextInt ( validCoords . size ( ) ) ) ; world . setBlockState ( toSwap , stateToSet , 1 | 2 ) ; } }
tick a specific block position , finding the valid blocks immediately adjacent to it and then replacing one at random .
