FlowUpdater
Health Gecti
- License — License: GPL-3.0
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Community trust — 102 GitHub stars
Code Gecti
- Code scan — Scanned 5 files during light audit, no dangerous patterns found
Permissions Gecti
- Permissions — No dangerous permissions requested
Bu listing icin henuz AI raporu yok.
The free and open source solution to update Minecraft.
FlowUpdater
Welcome on FlowUpdater's repository. FlowUpdater is a free and open source solution to update Minecraft in Java.
It is mainly designed for launcher's purposes but can be used for other usages as well. FlowUpdater focuses on customization and reliability.
The best documentation is the JavaDoc included in FlowUpdater's source code. The rest of the documentation (for instance this readme or the wiki tab on GitHub) may not be up to date.
Legal and fork notices :warning:
The CurseForge integration works with an API Key which is mine at the moment. You CAN'T use this key for other purposes outside FlowUpdater.
If you wish to fork this project, you HAVE TO use your own API Key.
Alternatives
If you are a developer or know a developer who has made a similar library in another programming language,
feel free to ask to appear in this list:
- LightyLauncherLib (Rust, recommended)
- Rust Launcher Lib (Rust)
Usage
Vanilla (needed even if you want to use a mod loader)
First, create a new VanillaVersion, and build the version:
VanillaVersion version = new VanillaVersion.VanillaVersionBuilder().withName("1.20.4").build();
VanillaVersion accepts some arguments to add more libraries, assets or to reach snapshots or custom versions of the game.
All accepted arguments are available in the VanillaVersionBuilder subclass.
Add the version to a new FlowUpdater instance and build it:
FlowUpdater updater = new FlowUpdater.FlowUpdaterBuilder()
.withVanillaVersion(version)
.build();
Similarly, FlowUpdater accepts many other arguments that you can use as needed. The most important ones are: the logger, the progress callback (for a progreses bar for instance) and the mod loader version.
The full list is available in the FlowUpdaterBuilder subclass.
Finally, call the update function:
updater.update(Paths.get("your/path/"));
This update method will start the whole check-and-download pipeline and will return when all the work is done.
You usually need to put this method in a new Thread / ExecutorService because apart from some specific download cases, all actions are run on the same thread.
Forge
(You need to setup a vanilla version like above!)
Next, make a List of Mod objects (except if you don't need some).
List<Mod> mods = new ArrayList<>();
mods.add(new Mod("OneMod.jar", "sha1ofmod", 85120, "https://link.com/of/mod.jar"));
mods.add(new Mod("AnotherMod.jar", "sha1ofanothermod", 86120, "https://link.com/of/another/mod.jar"));
You can also get a list of mods by providing a json link: List<Mod> mods = Mod.getModsFromJson("https://url.com/launcher/mods.json");. A template is available in Mod class.
You can get mods from CurseForge too:
List<CurseFileInfo> modInfos = new ArrayList<>();
// project ID and file ID
modInfos.add(new CurseFileInfo(238222, 2988823));
You can also get a list of curse mods by providing a json link: List<CurseFileInfo> mods = CurseFileInfo.getFilesFromJson("https://url.com/launcher/cursemods.json");.
On the same pattern, you can get mods from Modrinth.
Then, build a forge version. For example, I will build a NewForgeVersion.
ForgeVersion forgeVersion = new ForgeVersionBuilder()
.withForgeVersion("1.20.6-50.1.12") // mandatory
.withCurseMods(modInfos) // optional
.withOptiFine(new OptiFineInfo("preview_OptiFine_1.20.6_HD_U_I9_pre1")) // installing OptiFine (optional)
.withFileDeleter(new ModFileDeleter(true, "jei.jar")) // (optional, but recommended) delete bad mods, don't remove the file jei.jar if it's present in mods directory. You can also provide A `Pattern` with a regex rule.
.build();
Finally, set the Forge version object to your FlowUpdaterBuilder:
.withModLoaderVersion(forgeVersion);
NeoForge
Works almost the same way as Forge, but you need to use NeoForgeVersion instead of ForgeVersion and NeoForgeVersionBuilder instead of ForgeVersionBuilder.
Be careful when passing the neoforge version, it must be in the forge format for 1.20.1 (1.20.1-47.1.5 for example) ; but you should only pass the neoforge version for versions >= 1.21 (21.8.31 for example).
Fabric
(You need to setup a vanilla updater!)
Next, make a List of Mod objects like for a ForgeVersion if you need some.
Then, build a Fabric version:
FabricVersion fabricVersion = new FabricVersionBuilder()
.withFabricVersion("0.10.8") // optional, if you don't set one, it will take the latest fabric loader version available.
.withCurseMods(modInfos) // optional
.withMods(mods) // optional
.withFileDeleter(new ModFileDeleter("sodium.jar")) // (optional but recommended) delete bad mods ; but it won't remove the file sodium.jar if it's present in the mods' dir.
.build();
Finally, set the Fabric version to your FlowUpdaterBuilder:
.withModLoaderVersion(fabricVersion);
MCP (not very recommended, but it can be useful for some specific cases)
(You need to setup a vanilla updater!)
There are two ways to setup an MCP version. You can either (1) provide an MCP object (for a simple client for example) or (2) a JSON link to a custom json version which can contains custom assets, custom libraries etc...
(1) set to vanilla version builder a MCP version:
.withMCP(new MCP("clientURL", "clientSha1", 25008229));
If you set an empty/null string in url and sha1 and 0 in size, the updater will use the default minecraft jar.
Example for a client-only mcp downloading:
.withMCP(new MCP("https://mighya.eu/resources/Client.jar", "f2c219e485831af2bae9464eebbe4765128c6ad6", 23005862));
You can get an MCP object instance by providing a json link too: .withMCP("https://url.com/launcher/mcp.json");.
(2)
Still in the vanilla version builder, set a json link to a custom MCP version:
.withCustomVersionJson(new URL("https://url.com/launcher/mcp.json"));
You can also provide some more additional libraries or assets with all methods in the VanillaVersionBuilder subclass
(withAnotherLibraries, withAnotherAssets, withCustomAssetIndex).
External Files
With FlowUpdater, you can download other files in your update dir! This system is mainly designed for configs, resource packs.
You can also configure a keep-policy for these files (should the updater download the file again if it is modified?).
In your FlowUpdaterBuilder, define an array list of ExternalFile (with ExternalFile#getExternalFilesFromJson for more convenience).
About json files...
Deprecated: All json files can be generated by the FlowUpdaterJsonCreator!
There are new tools made by the community that can help you generate some JSON files:
- FlowJsonCreator by Paulem79 (Java)
- FUJC by Zuygui (Rust)
Post executions
With FlowUpdater, you can execute some actions after the update, like patch a file, kill a process, launch a process, review a config etc...
In your FlowUpdaterBuilder, you have to set a list of Runnable.
It's not always relevant to use this feature, but it can be useful in some specific cases where you want to stay on the update thread.
Yorumlar (0)
Yorum birakmak icin giris yap.
Yorum birakSonuc bulunamadi