While discussing and assisting people on the Support Launcher Discord server, a discord server for helping people to make customs Minecraft launchers, I realized that creating JSON files compatible with Flow Updater was time-consuming and tedious. This led me to the idea of developing a command-line tool to replace the existing desktop application.
Flow Updater
Flow updater is a Java library to install, update and launch Minecraft (retrieved from officials servers) and mods loaded through Forge or any other mods loader. To load the mod list and other configurations, it is possible to host a JSON file and pass it into the library, ... So a JSON compatible with FlowUpdater looks like :
Note: JSON (JavaScript Object Notation) is a data file format easy to read and write for humans and machines.
Writing this JSON is very tedious and time-consuming because you have to find the project id and the file id for each mod. So I decided to write a CLI tool to make this task easier.
Tech Stack
To build this software, I had to utilize several tools, including:
Rust, a compiled functional programming language developed by Mozilla (the company behind Firefox).
Request TTY, a Rust crate that facilitates the creation of command-line forms.
Eternal API, the new Curseforge API, which allows me to retrieve the necessary information from mods for JSON generation.
Serde JSON, an extension of the serde crate that enables the serialization and deserialization of Rust structs.
I've only mentioned the most significant elements present in the source code.
The goal
I wanna replace the Java application (GUI) by a CLI application in Rust. I also wanna make the application more fast and accessible. Finally, I wanna add new features to the application like locals mods support and archives exports.
Development Steps
I began by developing a wrapper for the CurseForge API, which turned out to be a lengthy and challenging process but constituted the bulk of the work. Next, I coded the CLI, which was relatively straightforward. Instead of using the clap crate, a Rust tool for generating CLIs, I opted for the following line of code:
This code snippet captures the input to the program: the main function defines an immutable variable called args, which is a vector (a list with indefinite length, for the sake of simplicity here) of type String. Thus, we obtain a list of all the arguments given when executing the binary file (including the application's name). I concluded the development of the first version with the JSON file generation.
What's Next?
Due to my heavy workload with school, I have less time to continue making progress on the project. This does not mean that I'm abandoning it; I'm simply moving forward at a slower pace. I sincerely thank Bricklou for helping me maintain the project. We are actively working on creating new features.
The refactoring
With Bricklou, we have decided to refactor all the code of the app for a better readability and a better maintainability. The first version of code are always available at the old branch. The new version of the code is available at the master branch. I've migrated all the backend code to the backend in a rust crate called fujc_api for a better integration to the (future) GUI app and CLI. Why have two backend when we can have one ?
For install the crate, you can use the following command :
cargo add fujc_api
or add the following line to your Cargo.toml file :
fujc_api="0.1.0"
The GUI
Bricklou suggested to implement a GUI app for a better accessibility. It's not already implemented but we are working on. We are using Qt for the GUI app, Qt XML, and the Qt binding for Rust. The source code isn't available yet but it will be available soon.
Credits
I wanna thank Bricklou for maintening the project with me. I also wanna thank FlowArg for creating the original project. Finally, I wanna thank Asthowen for helping me with Github CI.
Conclusion
Thank you for reading this article on my blog. I hope you enjoyed it. Please feel free to leave a comment and give the GitHub repository of this blog a star ⭐.