1616import net .minecraftforge .mcmaven .impl .util .Util ;
1717import net .minecraftforge .util .file .FileUtils ;
1818import net .minecraftforge .util .hash .HashStore ;
19- import org .jetbrains .annotations .Nullable ;
2019
2120import javax .xml .parsers .ParserConfigurationException ;
2221import javax .xml .transform .TransformerException ;
@@ -86,12 +85,8 @@ public MinecraftTasks getMCTasks(String version) {
8685 return this .mcTasks .computeIfAbsent (version , k -> new MinecraftTasks (this .cache .root (), version ));
8786 }
8887
89- public List <PendingArtifact > process (Artifact artifact ) {
90- return this .process (artifact , null );
91- }
92-
9388 @ Override
94- public List <PendingArtifact > process (Artifact artifact , @ Nullable Mappings mappings ) {
89+ public List <PendingArtifact > process (Artifact artifact , Mappings mappings ) {
9590 var module = artifact .getGroup () + ':' + artifact .getName ();
9691 var version = artifact .getVersion ();
9792 if (!module .startsWith ("net.minecraft:" ))
@@ -105,31 +100,31 @@ public List<PendingArtifact> process(Artifact artifact, @Nullable Mappings mappi
105100 var build = mcpSide .getBuildFolder ();
106101 var name = Artifact .from ("net.minecraft" , side , version );
107102
108- var notchObf = pending ("Notch-obf Classes" , mcpTasks .getRawJar (), name .withClassifier ("raw" ), classVariant ("obf-notch" , new Mappings ("notch" , null )));
109- var srgObf = pending ("SRG-obf Classes" , mcpTasks .getSrgJar (), name .withClassifier ("srg" ), classVariant ("obf-searge" , new Mappings ("searge" , null )));
110- var pending = new ArrayList <>(List .of (
111- notchObf , srgObf
112- ));
113-
114- if (mappings != null ) {
115- var sourcesTask = new RenameTask (build , name , mcpSide , mcpSide .getSources (), mappings );
116- var recompile = new RecompileTask (build , name , mcpSide .getMCP (), mcpSide ::getClasspath , sourcesTask .get (), mappings );
117- var classesTask = mergeExtra (build , side , recompile .get (), mcpSide .getTasks ().getExtra (), mappings );
118-
119- var sources = pending ("Sources" , sourcesTask .get (), name .withClassifier ("sources" ), sourceVariant (mappings ));
120- var classes = pending ("Classes" , classesTask , name , () -> classVariants (mappings , mcpSide ));
121- var metadata = pending ("Metadata" , metadata (build , mcpSide ), name .withClassifier ("metadata" ).withExtension ("zip" ));
122- pending .addAll (List .of (
123- sources , classes , metadata
124- ));
125-
126- if (mappings .isPrimary ()) {
127- var pom = pending ("Maven POM" , pom (build , side , mcpSide , version ), name .withExtension ("pom" ));
128- pending .add (pom );
129- }
130- }
103+ return switch (mappings .channel ()) {
104+ case "notch" -> List .of (pending ("Classes" , mcpTasks .getRawJar (), name .withClassifier ("raw" ), simpleVariant ("obf-notch" , new Mappings ("notch" , null ))));
105+ case "srg" , "searge" -> List .of (pending ("Classes" , mcpTasks .getSrgJar (), name .withClassifier ("srg" ), simpleVariant ("obf-searge" , new Mappings ("searge" , null ))));
106+ default -> {
107+ var pending = new ArrayList <PendingArtifact >();
108+
109+ var sourcesTask = new RenameTask (build , name , mcpSide , mcpSide .getSources (), mappings );
110+ var recompile = new RecompileTask (build , name , mcpSide .getMCP (), mcpSide ::getClasspath , sourcesTask .get (), mappings );
111+ var classesTask = mergeExtra (build , side , recompile .get (), mcpSide .getTasks ().getExtra (), mappings );
112+
113+ var sources = pending ("Sources" , sourcesTask .get (), name .withClassifier ("sources" ), sourceVariant (mappings ));
114+ var classes = pending ("Classes" , classesTask , name , () -> classVariants (mappings , mcpSide ));
115+ var metadata = pending ("Metadata" , metadata (build , mcpSide ), name .withClassifier ("metadata" ).withExtension ("zip" ));
116+ pending .addAll (List .of (
117+ sources , classes , metadata
118+ ));
119+
120+ if (mappings .isPrimary ()) {
121+ var pom = pending ("Maven POM" , pom (build , side , mcpSide , version ), name .withExtension ("pom" ));
122+ pending .add (pom );
123+ }
131124
132- return pending ;
125+ yield pending ;
126+ }
127+ };
133128 }
134129
135130 public List <PendingArtifact > processExtra (String module , String version ) {
0 commit comments