This repository was archived by the owner on Aug 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
This repository was archived by the owner on Aug 28, 2024. It is now read-only.
[RFC] Extension API #47
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Overview
Extensions API is a way to extend Rosepad Loader by adding support for other mod loaders to make porting mods to Rosepad easier.
Extensions API should be able to:
- Patch
minecraft.jarbefore launch - Register mods as they were native Rosepad mods
Motivation
As we've seen with modern Minecraft modding, having multiple mod loaders is a hassle. We have mods that only support Fabric, or Forge, or using one of a quadrillion Fabric-Forge compatibility libraries like Architectery. Extensions API aims to remove the need for such compatibility libraries by allowing developers to add support for custom mod loader formats.
Registering a mod
A mod can be marked as an extension by adding main.loader entry to mod.toml
[main]
loader = "net.group.artifact.Extension"Extension class must extend LoaderExtension class
class Extension extends LoaderExtension {
// Custom entry point
public class CustomModEntry implements EntryPoint {
private JarLoader loader;
public CustomModEntry(JarLoader loader) {
this.loader = loader;
}
public void pre(Environment env) {
// do stuff
}
public void init(Environment env) {
// do other stuff
}
}
@Override
public void main(ExtensionContext context) {
for (ModCandidate candidate : context.candidates()) {
// ...do something with mods...
candidate.register(
new RosepadModEntry("modid", "1.0.0")
.setName("Modname")
.addEntryPoint(new CustomModEntry(candidate.getLoader()))
);
// Once a mod has been registered, that candidate will
// not appear for any other mod loader
}
Path[] locations = context.patchMinecraftJar(); // Get source and destination
// paths for minecraft.jar
Files.copy(locations[0], locations[1]);
}
}Vladg24YT
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request