@@ -240,9 +240,6 @@ public void apply(Project project) {
240240 * patches in /patches/
241241 */
242242 sourcesJar .configure (task -> {
243- task .setOnlyIf (t -> applyRangeConfig .flatMap (ApplyRangeMap ::getOutput ).map (rf -> rf .getAsFile ().exists ()).getOrElse (false ));
244- task .dependsOn (applyRangeConfig );
245- task .from (project .zipTree (applyRangeConfig .flatMap (ApplyRangeMap ::getOutput )));
246243 task .getArchiveClassifier ().set ("sources" );
247244 });
248245
@@ -310,6 +307,21 @@ public void apply(Project project) {
310307 //}); //TODO: Asset downloading, needs asset index from json.
311308 //javaConv.getSourceSets().stream().forEach(s -> extractRangeConfig.get().addSources(s.getJava().getSrcDirs()));
312309
310+ /*
311+ * All sources in SRG names.
312+ * patches in /patches/
313+ */
314+ if (Utils .isObfuscated (extension .getMcVersion ().get ())) {
315+ sourcesJar .configure (task -> {
316+ task .setOnlyIf (t -> applyRangeConfig .flatMap (ApplyRangeMap ::getOutput ).map (rf -> rf .getAsFile ().exists ()).getOrElse (false ));
317+ task .dependsOn (applyRangeConfig );
318+ task .from (project .zipTree (applyRangeConfig .flatMap (ApplyRangeMap ::getOutput )));
319+ });
320+ } else {
321+ sourcesJar .configure (task -> {
322+ task .from (applyRangeConfig .get ().getSources ());
323+ });
324+ }
313325
314326 // Automatically create the patches folder if it does not exist
315327 if (extension .getPatches ().isPresent ()) {
@@ -595,7 +607,8 @@ public void apply(Project project) {
595607 genServerBinPatches .configure (t -> t .getCleanJar ().convention (project .getLayout ().file (serverJar )));
596608 for (TaskProvider <GenerateBinPatches > binPatchesTask : Lists .newArrayList (genJoinedBinPatches , genClientBinPatches , genServerBinPatches )) {
597609 binPatchesTask .configure (task -> {
598- task .getSrg ().set (srg .flatMap (GenerateSRG ::getOutput ));
610+ if (Utils .isObfuscated (extension .getMcVersion ().get ()))
611+ task .getSrg ().set (srg .flatMap (GenerateSRG ::getOutput ));
599612 if (extension .getPatches ().isPresent ()) {
600613 task .mustRunAfter (genPatches );
601614 task .getPatchSets ().from (extension .getPatches ());
@@ -604,7 +617,8 @@ public void apply(Project project) {
604617 }
605618
606619 filterNew .configure (t -> {
607- t .getSrg ().set (srg .flatMap (GenerateSRG ::getOutput ));
620+ if (Utils .isObfuscated (extension .getMcVersion ().get ()))
621+ t .getSrg ().set (srg .flatMap (GenerateSRG ::getOutput ));
608622 t .getBlacklist ().from (joinedJar );
609623 });
610624 }
0 commit comments