diff --git a/README.md b/README.md index 62573bc..490f52d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +### 1.13+ notice + +The launcher now supports modern Forge distributions (1.13+), plus Fabric! + SKCraft Launcher ================ @@ -23,7 +27,7 @@ Creating modpacks with this launcher is super easy: :one: only drag & drop of co The launcher has all standard features that you'd expect like :one: resume of incomplete downloads, :two: incremental updates, and :three: file deduplication (saves disk space when you have files duplicated between updates or modpacks). -LiteLoader, Forge, and .jar mods are supported. You can put resource packs in, or really even random mod files that don't go in the configs or mods folder. +LiteLoader, Forge, Fabric, and custom .jar mods are supported. You can put resource packs in, or really even random mod files that don't go in the configs or mods folder. You do need some sort of website, but it does **not** need anything complicated like PHP. @@ -54,7 +58,7 @@ Making a modpack is just drag and drop into a folder like this: * src/**resourcepacks**/ * loaders/ -You'd put LiteLoader and Forge into the *loaders* folder. :ok_hand: +LiteLoader and Forge installers, or Fabric Loader, go into the *loaders* folder. :ok_hand: ### More Pictures diff --git a/launcher/src/main/java/com/skcraft/launcher/Launcher.java b/launcher/src/main/java/com/skcraft/launcher/Launcher.java index 39b6e93..58a25d9 100644 --- a/launcher/src/main/java/com/skcraft/launcher/Launcher.java +++ b/launcher/src/main/java/com/skcraft/launcher/Launcher.java @@ -68,6 +68,7 @@ public final class Launcher { @Getter private final LaunchSupervisor launchSupervisor = new LaunchSupervisor(this); @Getter private final UpdateManager updateManager = new UpdateManager(this); @Getter private final InstanceTasks instanceTasks = new InstanceTasks(this); + private final Environment env = Environment.getInstance(); /** * Create a new launcher instance with the given base directory. @@ -281,7 +282,6 @@ public final class Launcher { * @return File pointing to the library on disk. */ public File getLibraryFile(Library library) { - Environment env = Environment.getInstance(); return new File(getLibrariesDir(), library.getPath(env)); } diff --git a/launcher/src/main/java/com/skcraft/launcher/model/loader/InstallProcessor.java b/launcher/src/main/java/com/skcraft/launcher/model/loader/InstallProcessor.java index c23ed16..505a67b 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/loader/InstallProcessor.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/loader/InstallProcessor.java @@ -1,7 +1,6 @@ package com.skcraft.launcher.model.loader; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.google.common.base.Function; import com.google.common.collect.Lists; import lombok.Data; @@ -18,13 +17,8 @@ public class InstallProcessor { private List args; private Map outputs; - public List resolveArgs(final LoaderSubResolver resolver) { - return Lists.transform(getArgs(), new Function() { - @Override - public String apply(String input) { - return resolver.transform(input); - } - }); + public List resolveArgs(LoaderSubResolver resolver) { + return Lists.transform(getArgs(), resolver); } public Map resolveOutputs(final LoaderSubResolver resolver) { @@ -33,7 +27,7 @@ public class InstallProcessor { HashMap result = new HashMap(); for (Map.Entry entry : getOutputs().entrySet()) { - result.put(resolver.transform(entry.getKey()), resolver.transform(entry.getValue())); + result.put(resolver.apply(entry.getKey()), resolver.apply(entry.getValue())); } return result; diff --git a/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderSubResolver.java b/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderSubResolver.java index e3ab1ca..299aea7 100644 --- a/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderSubResolver.java +++ b/launcher/src/main/java/com/skcraft/launcher/model/loader/LoaderSubResolver.java @@ -1,5 +1,6 @@ package com.skcraft.launcher.model.loader; +import com.google.common.base.Function; import com.skcraft.launcher.model.minecraft.Library; import com.skcraft.launcher.model.minecraft.Side; import com.skcraft.launcher.model.modpack.DownloadableFile; @@ -11,7 +12,7 @@ import java.io.File; import java.util.HashMap; @RequiredArgsConstructor -public class LoaderSubResolver { +public class LoaderSubResolver implements Function { private final Manifest manifest; private final LoaderManifest loader; private final Environment env; @@ -28,7 +29,10 @@ public class LoaderSubResolver { return file.getAbsolutePath(); } - public String transform(String arg) { + @Override + public String apply(String arg) { + if (arg == null) return null; + while (true) { char start = arg.charAt(0); int bound = arg.length() - 1;