28
28
import net .minecraft .util .Formatting ;
29
29
import net .minecraft .util .Identifier ;
30
30
import org .apache .commons .lang3 .mutable .MutableBoolean ;
31
- import org .apache .commons .lang3 .mutable .MutableInt ;
32
31
import org .jetbrains .annotations .Nullable ;
33
32
import org .lwjgl .glfw .GLFW ;
34
33
@@ -55,8 +54,6 @@ public class ConfigScreen extends BaseUIModelScreen<FlowLayout> {
55
54
56
55
public static final Identifier DEFAULT_MODEL_ID = Identifier .of ("owo" , "config" );
57
56
58
- private static final Map <String , Function <Screen , ? extends ConfigScreen >> CONFIG_SCREEN_PROVIDERS = new HashMap <>();
59
-
60
57
private static final Map <Predicate <Option <?>>, OptionComponentFactory <?>> DEFAULT_FACTORIES = new HashMap <>();
61
58
/**
62
59
* A set of extra option factories - add to this if you want to override
@@ -104,35 +101,27 @@ public static ConfigScreen createWithCustomModel(Identifier modelId, ConfigWrapp
104
101
}
105
102
106
103
/**
107
- * Register the given config screen provider. This is primarily
108
- * used for making your config available in ModMenu and to the
109
- * {@code /owo-config} command, although other places my use it as well
110
- *
111
- * @param modId The mod id for which to supply a config screen
112
- * @param supplier The supplier to register - this gets the parent screen
113
- * as argument
114
- * @throws IllegalArgumentException If a config screen provider is
115
- * already registered for the given mod id
104
+ * @deprecated Use {@link ConfigScreenProviders#register(String, Function)} instead
116
105
*/
106
+ @ Deprecated (forRemoval = true )
117
107
public static <S extends ConfigScreen > void registerProvider (String modId , Function <Screen , S > supplier ) {
118
- if (CONFIG_SCREEN_PROVIDERS .put (modId , supplier ) != null ) {
119
- throw new IllegalArgumentException ("Tried to register config screen provider for mod id " + modId + " twice" );
120
- }
108
+ ConfigScreenProviders .registerOwoConfigScreen (modId , supplier );
121
109
}
122
110
123
111
/**
124
- * Get the config screen provider associated with
125
- * the given mod id
126
- *
127
- * @return The associated config screen provider, or {@code null} if
128
- * none is registered
112
+ * @deprecated Use {@link ConfigScreenProviders#get(String)} instead
129
113
*/
114
+ @ Deprecated (forRemoval = true )
130
115
public static @ Nullable Function <Screen , ? extends ConfigScreen > getProvider (String modId ) {
131
- return CONFIG_SCREEN_PROVIDERS . get (modId );
116
+ return ConfigScreenProviders . getOwoProvider (modId );
132
117
}
133
118
119
+ /**
120
+ * @deprecated Use {@link ConfigScreenProviders#forEach(BiConsumer)} instead
121
+ */
122
+ @ Deprecated (forRemoval = true )
134
123
public static void forEachProvider (BiConsumer <String , Function <Screen , ? extends ConfigScreen >> action ) {
135
- CONFIG_SCREEN_PROVIDERS . forEach (action );
124
+ ConfigScreenProviders . forEachOwoProvider (action );
136
125
}
137
126
138
127
@ Override
@@ -462,7 +451,7 @@ public void removed() {
462
451
UIParsing .registerFactory ("config-text-box" , element -> new ConfigTextBox ());
463
452
}
464
453
465
- private record SearchMatches (String query , List <SearchAnchorComponent > matches ) {}
454
+ protected record SearchMatches (String query , List <SearchAnchorComponent > matches ) {}
466
455
467
456
public static class SearchHighlighterComponent extends BaseComponent {
468
457
0 commit comments