Assuming you mean that you want the block to rotate just when you first place it down, add this code to your block's class:
public void onBlockAdded(World par1World, int par2, int par3, int par4) {
super.onBlockAdded(par1World, par2, par3, par4);
this.setDefaultDirection(par1World, par2, par3, par4);
}
private void setDefaultDirection(World par1World, int par2, int par3, int par4) {
if (!par1World.isRemote) {
Block l = par1World.getBlock(par2, par3, par4 - 1);
Block i1 = par1World.getBlock(par2, par3, par4 + 1);
Block j1 = par1World.getBlock(par2 - 1, par3, par4);
Block k1 = par1World.getBlock(par2 + 1, par3, par4);
byte b0 = 3;
if (l.func_149730_j() && !i1.func_149730_j())
b0 = 3;
if (i1.func_149730_j() && !l.func_149730_j())
b0 = 2;
if (j1.func_149730_j() && !k1.func_149730_j())
b0 = 5;
if (k1.func_149730_j() && !j1.func_149730_j())
b0 = 4;
par1World.setBlockMetadataWithNotify(par2, par3, par4, b0, 2);
}
}
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
return (side == world.getBlockMetadata(x, y, z)) ? this.frontIcon : this.blockIcon;
}