66
77import net .minecraftforge .gradle .MinecraftMappings ;
88import net .minecraftforge .gradleutils .shared .EnhancedProblems ;
9+ import org .gradle .api .Action ;
910import org .gradle .api .artifacts .Dependency ;
1011import org .gradle .api .artifacts .ExternalModuleDependency ;
12+ import org .gradle .api .problems .ProblemSpec ;
1113import org .gradle .api .problems .Problems ;
1214import org .gradle .api .problems .Severity ;
1315import org .gradle .api .provider .ProviderFactory ;
@@ -127,10 +129,12 @@ RuntimeException changingMinecraftDependency(Dependency dependency) {
127129 //endregion
128130
129131 //region Minecraft Maven
130- RuntimeException mavenizerOutOfDateCompile (Object dependency ) {
131- return this .throwing (new IllegalStateException (), "mavenizer-out-of-date-for-compile" , "Minecraft Mavenizer is out-of-date" , spec -> spec
132+ void mavenizerOutOfDate (boolean throwIt , Object dependency ) {
133+ String name = "mavenizer-out-of-date" ;
134+ String displayName = "Minecraft Mavenizer is out-of-date" ;
135+ Action <? super ProblemSpec > problemSpec = spec -> spec
132136 .details ("""
133- Gradle cannot compile your sources because the Minecraft Mavenizer is out-of-date.
137+ Gradle cannot compile your sources or run the game because the Minecraft Mavenizer is out-of-date.
134138 The Mavenizer must be re-run in order for the changes made to the Minecraft dependency to take effect.
135139 Affected dependency: '%s'"""
136140 .formatted (dependency ))
@@ -139,22 +143,12 @@ RuntimeException mavenizerOutOfDateCompile(Object dependency) {
139143 .solution ("Run `gradlew` with no arguments, as this will automatically synchronize the Mavenizer." )
140144 .solution ("Manually run the `syncMavenizer` task, located in the 'Build Setup' group." )
141145 .solution ("Temporary revert any edits to the Minecraft dependency until the Mavenizer is re-run." )
142- .solution (HELP_MESSAGE ));
143- }
146+ .solution (HELP_MESSAGE );
144147
145- RuntimeException mavenizerOutOfDateRunTask (Object dependency ) {
146- return this .throwing (new IllegalStateException (), "mavenizer-out-of-date-for-run" , "Minecraft Mavenizer is out-of-date" , spec -> spec
147- .details ("""
148- Gradle cannot run the game with Slime Launcher because the Minecraft Mavenizer is out-of-date.
149- The Mavenizer must be re-run in order for the changes made to the Minecraft dependency to take effect.
150- Affected dependency: '%s'"""
151- .formatted (dependency ))
152- .severity (Severity .ERROR )
153- .solution ("Re-import your project in your IDE, as this will automatically synchronize the Mavenizer." )
154- .solution ("Run `gradlew` with no arguments, as this will automatically synchronize the Mavenizer." )
155- .solution ("Manually run the `syncMavenizer` task, located in the 'Build Setup' group." )
156- .solution ("Temporary revert any edits to the Minecraft dependency until the Mavenizer is re-run." )
157- .solution (HELP_MESSAGE ));
148+ if (throwIt )
149+ throw this .throwing (new IllegalStateException (displayName ), name , displayName , problemSpec );
150+ else
151+ this .report (name , displayName , problemSpec );
158152 }
159153
160154 void reportMcMavenNotDeclared () {
0 commit comments