|
17 | 17 | import java.nio.file.Path; |
18 | 18 | import java.nio.file.Paths; |
19 | 19 | import java.time.Duration; |
| 20 | +import java.util.ArrayList; |
20 | 21 | import java.util.Arrays; |
21 | 22 | import java.util.Collection; |
22 | 23 | import java.util.Collections; |
@@ -145,6 +146,9 @@ public class CurseForgeInstaller { |
145 | 146 | @Getter @Setter |
146 | 147 | private String customModLoaderVersion; |
147 | 148 |
|
| 149 | + @Getter @Setter |
| 150 | + private boolean excludeAllMods; |
| 151 | + |
148 | 152 | /** |
149 | 153 | */ |
150 | 154 | public void installFromModpackZip(Path modpackZip, String slug) { |
@@ -546,20 +550,11 @@ private void trimLevelsContent(CurseForgeManifest manifest) { |
546 | 550 | }); |
547 | 551 | } |
548 | 552 |
|
549 | | - private ModPackResults processModpack(InstallContext context, |
550 | | - MinecraftModpackManifest modpackManifest, OverridesApplier overridesApplier |
551 | | - ) throws IOException { |
552 | | - if (modpackManifest.getManifestType() != ManifestType.minecraftModpack) { |
553 | | - throw new InvalidParameterException("The zip file provided does not seem to be a Minecraft modpack"); |
| 553 | + private List<PathWithInfo> getModFiles(InstallContext context, MinecraftModpackManifest modpackManifest, OutputSubdirResolver outputSubdirResolver) { |
| 554 | + if (excludeAllMods) { |
| 555 | + return new ArrayList<>(); |
554 | 556 | } |
555 | 557 |
|
556 | | - final ModLoader modLoader = modpackManifest.getMinecraft().getModLoaders().stream() |
557 | | - .filter(ModLoader::isPrimary) |
558 | | - .findFirst() |
559 | | - .orElseThrow(() -> new GenericException("Unable to find primary mod loader in modpack")); |
560 | | - |
561 | | - final OutputSubdirResolver outputSubdirResolver = new OutputSubdirResolver(outputDir, context.categoryInfo); |
562 | | - |
563 | 558 | final ExcludeIncludeIds excludeIncludeIds = resolveExcludeIncludes(context); |
564 | 559 | log.debug("Using {}", excludeIncludeIds); |
565 | 560 |
|
@@ -602,6 +597,25 @@ private ModPackResults processModpack(InstallContext context, |
602 | 597 | .collectList() |
603 | 598 | .block(); |
604 | 599 |
|
| 600 | + return modFiles; |
| 601 | + } |
| 602 | + |
| 603 | + private ModPackResults processModpack(InstallContext context, |
| 604 | + MinecraftModpackManifest modpackManifest, OverridesApplier overridesApplier |
| 605 | + ) throws IOException { |
| 606 | + if (modpackManifest.getManifestType() != ManifestType.minecraftModpack) { |
| 607 | + throw new InvalidParameterException("The zip file provided does not seem to be a Minecraft modpack"); |
| 608 | + } |
| 609 | + |
| 610 | + final ModLoader modLoader = modpackManifest.getMinecraft().getModLoaders().stream() |
| 611 | + .filter(ModLoader::isPrimary) |
| 612 | + .findFirst() |
| 613 | + .orElseThrow(() -> new GenericException("Unable to find primary mod loader in modpack")); |
| 614 | + |
| 615 | + final OutputSubdirResolver outputSubdirResolver = new OutputSubdirResolver(outputDir, context.categoryInfo); |
| 616 | + |
| 617 | + final List<PathWithInfo> modFiles = getModFiles(context, modpackManifest, outputSubdirResolver); |
| 618 | + |
605 | 619 | final Result overridesResult = overridesApplier.apply(); |
606 | 620 |
|
607 | 621 | prepareModLoader(modLoader.getId(), modpackManifest.getMinecraft().getVersion()); |
|
0 commit comments