*/
public static void setRails(org.bukkit.block.Block rails, BlockFace direction) {
Material type = rails.getType();
if (type == Material.RAILS) {
int olddata = getRawData(rails);
Rails r = (Rails) MaterialUtil.getData(type, olddata);
r.setDirection(FaceUtil.toRailsDirection(direction), r.isOnSlope());
// If changed, update the data
if (MaterialUtil.getRawData(r) != olddata) {
setData(rails, r);
}
}