package net.glowstone.generator.decorators.overworld;

import java.util.Random;
import net.glowstone.generator.decorators.BlockDecorator;
import net.glowstone.generator.objects.SugarCane;
import org.bukkit.Chunk;
import org.bukkit.World;

public class SugarCaneDecorator extends BlockDecorator {

    @Override
    public void decorate(World world, Random random, Chunk source) {
        int sourceX = (source.getX() << 4) + random.nextInt(16);
        int sourceZ = (source.getZ() << 4) + random.nextInt(16);
        int maxY = world.getHighestBlockYAt(sourceX, sourceZ);
        if (maxY > 0) {
            int sourceY = random.nextInt(maxY << 1);
            for (int j = 0; j < 20; j++) {
                int x = sourceX + random.nextInt(4) - random.nextInt(4);
                int z = sourceZ + random.nextInt(4) - random.nextInt(4);
                new SugarCane().generate(world, random, x, sourceY, z);
            }
        }
    }
}

@@ -587,9 +587,10 @@
 axY 
-%3E
+%3C=
  0) 
@@ -587,32 +587,58 @@
 axY %3C= 0) %7B%0A    
+        return;%0A        %7D%0A
         int sour
@@ -678,20 +678,16 @@
         
- 
-   
 for (int
@@ -705,28 +705,24 @@
  20; j++) %7B%0A
-    
             
@@ -786,28 +786,24 @@
             
- 
-   
 int z = sour
@@ -839,36 +839,32 @@
 dom.nextInt(4);%0A
-    
             new 
@@ -919,22 +919,8 @@
 z);%0A
-            %7D%0A
     

Refactor for shallower nesting