Дело в этих строчках
if (world.getblock(randomX, heightValue, randomZ).isReplaceable(world, randomX, heightValue, randomZ) && (
world.getBlock(randomX, heightValue - 1, randomZ).getMaterial() == Material.GRASS ||
world.getBlock(randomX, heightValue - 1...