This repository contains the source code for early loading of OneConfig.
This below documentation is not intended for end users or consuming developers of OneConfig, check out the Polyfrost Documentation instead.
- No hardcoding
- If a class entrypoint is needed, it should be specified in either the Jar's Manifest or a resource file (ex. [
loader.json
]).- This allows for easier versioning and compatibility, notably future API changes.
- If a class entrypoint is needed, it should be specified in either the Jar's Manifest or a resource file (ex. [
- Minimal platform-specific code
- Platform-relative code should be kept to a minimum, and should be isolated to the
stage0
bundle; everything else should be platform-agnostic.
- Platform-relative code should be kept to a minimum, and should be isolated to the
- No extra-downloading
- If a file is needed, it should belong in a local shared cache on the computer.
The Wrapper is the first entrypoint for OneConfig and is called depending on the platform as:
- an
ITweaker
for LaunchWrapper - an
ITransformationService
for ModLauncher- and another one for ModLauncher 9+
- a
LanguageAdapter
for Fabric Loader (and subsequently, Quilt Loader)
This direct first entrypoint encapsulates all the required metadata and methods and abstracts them into a platform-agnostic
Capabilities
interface, and delegates further loading to the
org.polyfrost.oneconfig.loader.stage0.Stage0Loader
class.
Important
This causes the Wrapper to also be a "standalone mod" for downloading OneConfig, however you should not use those artifacts, and should be using OneConfig Bootstrap for that purpose.
The Wrapper checks the loaded mod loader version and attempts to load the Loader corresponding to that
version, by first downloading it, trying cache, and then delegating loading to org.polyfrost.oneconfig.loader.stage1.Stage1Loader
.
The Loader is where the actual loading of OneConfig happens. It is a platform-agnostic jar that tries to download the OneConfig jar from the API, its dependencies to a cache, and hands off loading to it, also delegating capabilities obtained earlier in the chain, such as setting-up Transformers or mixing-in ClassLoading.
Note: For backwards-compatibility reasons, the Loader also contains the two legacy classes:
cc.polyfrost.oneconfigloader.OneConfigLoader
cc.polyfrost.oneconfig.loader.OneConfigLoader
Those classes are located in the [src/legacy/java
] source-set and are loaded by older versions of the stage 0 Wrapper.
Caution
These classes should never be used as they are prone to removal at any time.
The Polyfrost API regarding artifacts and metadata is currently a work-in-progress, and will be documented in the future.
If you wish to see the older version, please check out the main branch readme.
This project and its files (code, assets, etc.), except where stated otherwise, is licensed under the GNU Lesser General Public License v3.0, see the LICENSE file for more information.