Do Melons prefer to grow in certain directions?
Solution 1:
I think I found the code that chooses where the melon grows. (All comments added by me.)
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.
}
It appears to depend on how random random.nextInt(4)
is.