Take the 2-minute tour ×
Arqade is a question and answer site for passionate videogamers on all platforms. It's 100% free, no registration required.

Does the number of farmland blocks around Melon or Pumpkin plants increase the rate of growth?

Is 1 Farmland beside the Melon or Pumpkin seed less effective in growing the crop? 1 Farmland

Or is 4 Farmland beside the Melon or Pumpkin seed more effective?

4 Farmland

share|improve this question

1 Answer 1

up vote 6 down vote accepted

I'm going to borrow the code for Melon/Pumpkin growing from John's answer to a related question:

int i1 = random.nextInt(4);
int j1 = i;  // Assuming j1 and k1 are the horizontal axes...
int k1 = k;
if(i1 == 0)  // North
{
    j1--;
}
if(i1 == 1) // South
{
    j1++;
}
if(i1 == 2) // East
{
    k1--;
}
if(i1 == 3) // West
{
    k1++; // or somthing like that, anyway.
}
if(world.getBlockId(j1, j, k1) == 0 && world.getBlockId(j1, j - 1, k1) == Block.tilledField.blockID)  // Make sure the targeted block is empty and below it is farmland...
{
    world.setBlockWithNotify(j1, j, k1, field_35297_a.blockID); // Place a melon.
}

This code works by first picking a direction, then checking if it is farmland, and then placing a melon/pumpkin if it is. Therefore you will get higher yield if there are more farmland blocks around the vine, as if you only have 1 there is only a 1/4 chance of this function creating a melon/pumpkin when it is triggered.

share|improve this answer
2  
Protip: plant your melons/pumpkins in diagonal rows! –  fredley Oct 7 '11 at 12:37
    
You didn't just borrow the code. Me and Raven came to this same conclusion in the comments to that answer. :) –  John the Green Oct 7 '11 at 12:50
    
My apologies, I merely remember seeing the code a few days ago and searched for the question to acquire it. Didn't realise you'd answered the question too! –  fredley Oct 7 '11 at 12:53
    
That's ok. I figured you were probably anxious to post an answer and may have not read all the comments. –  John the Green Oct 7 '11 at 13:01

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.