If you get the block as PistonBaseMaterial, it has a method to change facing direction. You can then set it to BlockFace.NORTH; This code is not tested, and might need to be tweaked a little. Example: Code:java public void setFacingDirection() { PistonBaseMaterial piston = (PistonBaseMaterial) new Location(Bukkit.getWorld("world"), 0, 0, 0).getBlock(); piston.setFacingDirection(BlockFace.NORTH); }
SyTeck sugested one solution, The other way is to use data values on the ItemStack (new ItemStack(Material.PISTON, ammount,(byte)data)) different datas will produce different rotations i think (not tested)