Just wait around at night time for Zombie Villagers. Then cure them. You need to find two to get a breeding pair.
So you need
Once you find a zombie villager, you will want to trap him in a cage and put a roof over him, so he doesn't die before he is done being cured. Once he is trapped hit him with the weakness potion, wait, and make sure that you hit me by the potion effect animation. Then feed him the golden apple. Then wait.
Since you have to be out at night you need a nice open area where monsters can spawn. You will probably also need some equipment to kill the mobs you aren't interested in. With a little luck you can usually corral a couple in 2-3 night cycles.
The following is based on the source decompiled via 1.9 ModCoderPack.
The current growth stage of the stem is saved as its metadata value. You can view this value via the F3 menu. The image shows a stem partway into its growth, via the age
blockstate:
This value increments by random chance via random ticks rather than an internal timer. The following is the random chance condition, provided the light level above the stem is 9 or higher:
rand.nextInt((int)(25.0F / growthChance) + 1) == 0
If a random value generated from 25 divided by the "growth chance", and after being floored has 1 added, is equal to 0, then the crop has the ability to either grow taller or grow a melon/pumpkin, depending on its growth stage.
The value for growthChance
is obtained using the same function that all crops use, being the existence and hydration of surrounding farmland and nearby crops. The wiki details the long list of conditions here.
For example, provided the following arrangement:
The growthChance
will always be 4.0, which means a random value between 0 and 7 is chosen. If the random value is 0, then the crop is ready to grow.
If its growth stage (metadata value) is 6 or lower, it will increase by 1, visually increasing the height of the stem. Nothing else will happen and no other checks are made.
If the growth stage is 7, then one random location surrounding the stem will be chosen. If that location is air and the block below that is grass, farmland, or dirt, then a new melon/pumkin block will be placed. If those conditions fail, then nothing happens and it must receive another random tick to attempt placing another block.
If the growth stage is 7 while the blockstate facing
is not "up", and it's facing a respective melon/pumpkin block, then a new melon/pumpkin block cannot grow.
As such, the growth timer will not reset by placing a block where a melon/pumking can grow since there is technically not a timer at all. But a badly-timed placement of a block could prevent potential growth should the stem receive a random tick update at that same moment. There would be no way to detect it and no way to prevent it, short of making sure you remove any impeding blocks as soon as possible to reduce the chance of a clash.
From a technical perspective, it is very possible that a melon could successfully grow twice in quick succession (as quick as twice in 2 ticks), but it is not probable.
Best Answer
drop them in a water stream using droppers
or have a chest/hopper cart go around to collect them
this last option will also use iron for the tracks though