This commit is contained in:
Anuken
2020-03-09 09:41:39 -04:00
parent 7aa71f38c3
commit d7f9090c0b
4 changed files with 23 additions and 5 deletions

View File

@@ -90,6 +90,13 @@ public class SchematicsDialog extends FloatingDialog{
buttons.addImageButton(Icon.pencil, style, () -> {
ui.showTextInput("$schematic.rename", "$name", s.name(), res -> {
Schematic replacement = schematics.all().find(other -> other.name().equals(res) && other != s);
if(replacement != null){
//renaming to an existing schematic is not allowed, as it is not clear how the tags would be merged, and which one should be removed
ui.showErrorMessage("$schematic.exists");
return;
}
s.tags.put("name", res);
s.save();
rebuildPane[0].run();