package net.glowstone.generator.objects;

import java.util.Random;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.material.LongGrass;

public class TallGrass implements TerrainObject {

    private final LongGrass grassType;

    public TallGrass(LongGrass grassType) {
        this.grassType = grassType;
    }

    public boolean generate(World world, Random random, int sourceX, int sourceY, int sourceZ) {
        while ((world.getBlockAt(sourceX, sourceY, sourceZ).isEmpty() ||
            world.getBlockAt(sourceX, sourceY, sourceZ).getType() == Material.LEAVES) &&
            sourceY > 0) {
            sourceY--;
        }
        boolean succeeded = false;
        for (int i = 0; i < 128; i++) {
            int x = sourceX + random.nextInt(8) - random.nextInt(8);
            int z = sourceZ + random.nextInt(8) - random.nextInt(8);
            int y = sourceY + random.nextInt(4) - random.nextInt(4);

            Block block = world.getBlockAt(x, y, z);
            if (y < 255 && block.getType() == Material.AIR && (
                block.getRelative(BlockFace.DOWN).getType() == Material.GRASS ||
                    block.getRelative(BlockFace.DOWN).getType() == Material.DIRT)) {
                BlockState state = block.getState();
                state.setType(Material.LONG_GRASS);
                state.setData(grassType);
                state.update(true);
                succeeded = true;
            }
        }
        return succeeded;
    }
}

@@ -432,16 +432,30 @@
 %0A    %7D%0A%0A
+    @Override%0A
     publ
@@ -555,128 +555,180 @@
     
-while ((world.getBlockAt(sourceX, sourceY, sourceZ).isEmpty() %7C%7C%0A            world.getBlockAt(sourceX, sourceY, sourceZ)
+Block thisBlock;%0A        do %7B%0A            thisBlock = world.getBlockAt(sourceX, sourceY, sourceZ);%0A            sourceY--;%0A        %7D while ((thisBlock.isEmpty() %7C%7C thisBlock
 .get
@@ -756,28 +756,16 @@
 AVES) &&
-%0A           
  sourceY
@@ -769,28 +769,26 @@
 ceY %3E 0)
- %7B%0A 
+;%0A
         
    sourc
@@ -779,39 +779,26 @@
         
-   
 sourceY
---;%0A        %7D
+++;
 %0A       
@@ -1142,109 +1142,111 @@
     
-if (y %3C 255 && block.getType() == Material.AIR && (%0A                block.getRelative(BlockFace.DOWN)
+Material blockTypeBelow = block.getRelative(BlockFace.DOWN).getType();%0A            if (y %3C 255 && block
 .get
@@ -1268,16 +1268,16 @@
 ial.
-GRASS %7C%7C
+AIR && (
 %0A   
@@ -1302,46 +1302,53 @@
 lock
-.getRelative(BlockFace.DOWN).getType()
+TypeBelow == Material.GRASS %7C%7C blockTypeBelow
  == 

Fix CheckStyle issues in generator/objects/TallGrass.java (#750)