@@ -20,11 +20,15 @@ public class ScriptAddArgumentScreen extends CScreen {
2020 private final ScriptAction action ;
2121
2222 public ScriptAddArgumentScreen (Script script , ScriptAction action , int index ) {
23+ this (script ,action ,index ,null );
24+ }
25+ public ScriptAddArgumentScreen (Script script , ScriptAction action , int index , String overwrite ) {
2326 super (100 , 50 );
2427 this .script = script ;
2528 this .action = action ;
2629
2730 CTextField input = new CTextField ("Input" , 2 , 2 , 96 , 35 , true );
31+ if (overwrite != null ) input .setText (overwrite );
2832
2933 ItemStack textIcon = new ItemStack (Items .BOOK );
3034 textIcon .setCustomName (Text .literal ("Text" )
@@ -56,13 +60,15 @@ public ScriptAddArgumentScreen(Script script, ScriptAction action, int index) {
5660 input .setChangedListener (() -> input .textColor = 0xFFFFFF );
5761
5862 addText .setClickListener ((btn ) -> {
63+ if (overwrite != null ) action .getArguments ().remove (index );
5964 action .getArguments ().add (index , new ScriptTextArgument (input .getText ()));
6065 DFScript .MC .setScreen (new ScriptEditActionScreen (action , script ));
6166 });
6267
6368 addNumber .setClickListener ((btn ) -> {
6469 try {
6570 double number = Double .parseDouble (input .getText ());
71+ if (overwrite != null ) action .getArguments ().remove (index );
6672 action .getArguments ().add (index , new ScriptNumberArgument (number ));
6773 DFScript .MC .setScreen (new ScriptEditActionScreen (action , script ));
6874 } catch (Exception err ) {
@@ -71,16 +77,17 @@ public ScriptAddArgumentScreen(Script script, ScriptAction action, int index) {
7177 });
7278
7379 addVariable .setClickListener ((btn ) -> {
80+ if (overwrite != null ) action .getArguments ().remove (index );
7481 action .getArguments ().add (index , new ScriptVariableArgument (input .getText ()));
7582 DFScript .MC .setScreen (new ScriptEditActionScreen (action , script ));
7683 });
7784
7885 addClientValue .setClickListener ((btn ) -> {
79- DFScript .MC .setScreen (new ScriptAddClientValueScreen (action , script , index ));
86+ DFScript .MC .setScreen (new ScriptAddClientValueScreen (action , script , index , overwrite ));
8087 });
8188
8289 addConfigValue .setClickListener ((btn ) -> {
83- DFScript .MC .setScreen (new ScriptAddConfigValueScreen (action , script , index ));
90+ DFScript .MC .setScreen (new ScriptAddConfigValueScreen (action , script , index , overwrite ));
8491 });
8592
8693 widgets .add (input );
0 commit comments