Copy button for content patches

This commit is contained in:
Anuken
2025-10-22 08:56:41 -04:00
parent e7966fc6fd
commit ddaf9e24ca
2 changed files with 7 additions and 2 deletions

View File

@@ -78,6 +78,11 @@ public class MapPatchesDialog extends BaseDialog{
b.getLabel().setAlignment(Align.left, Align.left);
});
t.button(Icon.copy, Styles.graySquarei, Vars.iconMed, () -> {
Core.app.setClipboardText(patch.patch);
ui.showInfoFade("@copied");
}).size(h);
t.button(Icon.refresh, Styles.graySquarei, Vars.iconMed, () -> {
showImport(str -> addPatch(str, patches.indexOf(patch)));
}).size(h);

View File

@@ -23,7 +23,7 @@ public class ContentPatcher{
private Json json;
private boolean applied;
private ContentLoader contentLoader;
private ObjectSet<PatchRecord> usedpatches = new ObjectSet<>();
private ObjectSet<Object> usedpatches = new ObjectSet<>();
private Seq<Runnable> resetters = new Seq<>();
private Seq<Runnable> afterCallbacks = new Seq<>();
private @Nullable PatchSet currentlyApplying;
@@ -122,7 +122,7 @@ public class ContentPatcher{
field = path[path.length - 1];
}
if(object instanceof Content c){
if(object instanceof Content c && usedpatches.add(c)){
after(c::afterPatch);
}