/RetroFuturaBootstrap

An open source, backwards compatible replacement for LegacyLauncher/LaunchWrapper

Primary LanguageJavaGNU Lesser General Public License v3.0LGPL-3.0

RetroFuturaBootstrap

An open source, backwards compatible replacement for LegacyLauncher/LaunchWrapper. Does not currently implement the applet wrappers for really old versions. Made by writing a specification of how LaunchWrapper operates, and then implementing that specification without referencing the original code, while ensuring old mods continue working.

Targets Java 8, but is compatible with latest Java releases (last tested: 21), because the main use is enabling lwjgl3ify-like mods. If there is a good use case, I'm open to lowering the Java requirement further.

Runtime options

Some RFB features can be controlled by setting java system properties, like with the -Dname=value JVM option.

  • -Drfb.dumpLoadedClasses=true - will dump post-transform classes as they load into RFB_CLASS_DUMP[_NUMBER] directories in your .minecraft directory.
  • -Drfb.dumpLoadedClassesPerTransformer=true - will dump classes like above, but save a separate file for each class transformer that runs and modifies the class.
  • -Drfb.dumpClassesAsynchronously=false - by default it's true, if changed to false dumping classes will happen on the thread that does the loading instead of in the background.

Plugins

RetroFuturaBootstrap supports early loading plugins to transform mod loader classes, or even other plugin classes, for the purpose of maintaining compatibility patches for code that is difficult to modify otherwise. For example, patching bugs or new Java version support into the Forge Mod Loader, redirecting graphics API usage to an emulation layer or bugfixes for Forge "coremods". You can add compatibility plugins into your jar by following these steps:

  • Implement the com.gtnewhorizons.retrofuturabootstrap.api.RfbPlugin interface on your plugin class
  • Define com.gtnewhorizons.retrofuturabootstrap.api.RfbClassTransformers and add metadata about the transformer order and exclusions to your plugin classes
  • Pick a unique plugin ID you're very unlikely to change, made up of lower-case letters, digits and dashes for consistency ([a-z0-9-]+).
  • Add a UTF-8 properties file declaring information about your plugin to META-INF/rfb-plugin/my-plugin-id.properties in your jar (or runtime classpath in a development environments):
# RetroFuturaBootstrap plugin property file
# All properties can be empty or missing, unless specified otherwise. Lists are semicolon-separated, and whitespace around each value is stripped, unless specified otherwise.
# Human-friendly name (required). Only used for logging, all logic uses the plugin ID (taken from the file name).
name=My RFB plugin
# A Maven-compatible version number, used for validating dependencies and detecting duplicates (required)
version=0.0.1-alpha.1
# Alternative plugin IDs and versions that this plugin provides, e.g. generic names like "mixin" or the ID of a previous version.
# If versions conflicting with other plugins are found, the newest version is used and the other plugins won't load with a warning. Use versionConstraints to mark any incompatibilities.
additionalVersions=mixin@0.8.5; my-old-id@0.0.10
# The class implementing com.gtnewhorizons.retrofuturabootstrap.api.RfbPlugin (required)
className=io.github.mymod.rfb.RfbPlugin
# Additional packages on top of the plugin's parent package to exclude from self-transformation by the plugin
transformerExclusions=io.github.mymod.util; io.github.mymod.common
# Version constraints on other plugins that would be loaded with this plugin. Failing these checks will provide an error to the user, with a config override to ignore conflicts.
# Use an impossible-to-satisfy version range to denote a conflict.
# Dependency constraint parsing mostly follows https://maven.apache.org/ref/3.9.6/maven-artifact/apidocs/org/apache/maven/artifact/versioning/VersionRange.html#createFromVersionSpec(java.lang.String)
# One change compared to Maven's docs is that semver-style build metadata after a plus sign is stripped before version processing (1.0.0-alpha+metadata becomes 1.0.0-alpha).
versionConstraints=rfb@[1.0.0,); some-plugin@[0.0.1,0.0.3],[0.2.0,); mixin@[0.8.2,)
# Plugin load order properties don't restrict the actual registered transformers from registering in different positions in the transformer chain!
# Plugin IDs that this plugin should load before (to e.g. register an early transformer to modify that plugin's code)
loadBefore=a-plugin-i-modify; lwjgl3ify
# Plugin IDs that this plugin should load after. Add '*' to default to load the plugin as late as possible instead of as early as possible.
loadAfter=mixin; *
# Plugin IDs that this plugin requires to be present to load
loadRequires=mixin
  • If you need to split up or ship multiple plugins in a JAR, just include multiple properties files in META-INF/rfb-plugin/.

Standard plugin IDs include:

  • rfb - metadata about RetroFuturaBootstrap itself
  • java - metadata about the Java version running
  • mixin - the Mixin library for convenient bytecode manipulation, includes the mixin:mixin transformer that represents mixin application.