File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
common/src/main/java/io/github/notenoughupdates/moulconfig/gui/editors Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -37,17 +37,27 @@ public class GuiOptionEditorDropdown extends ComponentEditor {
3737 private Enum <?>[] constants ;
3838 private String valuesForSearch ;
3939
40+ public GuiOptionEditorDropdown (ProcessedOption option , String [] values ) {
41+ this (option , values , false );
42+ }
43+
4044 public GuiOptionEditorDropdown (
4145 ProcessedOption option ,
42- String [] values
46+ String [] values ,
47+ boolean forceGivenValues
4348 ) {
4449 super (option );
4550 Class <?> clazz = (Class <?>) option .getType ();
4651 if (Enum .class .isAssignableFrom (clazz )) {
4752 constants = (Enum <?>[]) (clazz ).getEnumConstants ();
48- this .values = new String [constants .length ];
49- for (int i = 0 ; i < constants .length ; i ++) {
50- this .values [i ] = constants [i ].toString ();
53+ if (forceGivenValues ) {
54+ assert values .length == constants .length ;
55+ this .values = values ;
56+ } else {
57+ this .values = new String [constants .length ];
58+ for (int i = 0 ; i < constants .length ; i ++) {
59+ this .values [i ] = constants [i ].toString ();;
60+ }
5161 }
5262 } else {
5363 this .values = values ;
You can’t perform that action at this time.
0 commit comments