Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add experimental support for using Mojmap as a runtime #469

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

EnnuiL
Copy link
Contributor

@EnnuiL EnnuiL commented Jan 25, 2025

This expands on @TheGlitch76's initial efforts on running Mojmap as runtime; It works! The log messages are all translated to Mojmap instead of Intermediary! And in theory? Mods that only have code without any use of Mixins and AWs can work!

The issue is: the remapper is wonky! It currently hates Mixins and AWs and some results may be partial! So my experiment is y'all's problem now :p

(PS: The removal of Tiny v1 support will require Quilt Meta to provide Intermediary v2, which I have tested and can confirm it'll be fine)

^ Outdated -- see #469 (comment) below
(glitchhhhhhhh I can't believe you have hijacked this PR into a successful thing!)

@EnnuiL EnnuiL marked this pull request as draft January 25, 2025 19:33
@TheGlitch76 TheGlitch76 changed the title Move towards Mojmap as runtime Add experimental support for using Mojmap as a runtime Jan 30, 2025
@TheGlitch76
Copy link
Contributor

This PR is ready for review now. It allows selecting Mojmap as the runtime namespace in prod, and it uses RuntimeModRemapper to remap all mods in intermediary to mojmap (It successfully loaded the Cobblemon modpack, but might not be fully reliable). Without the experimental system properties, Loader should behave exactly as before.

Some more work will be needed before a hypothetical switch of defaults could occur, at minimum:

  • Figuring out how Loader will actually find mojmaps (just download them itself?)
  • Figuring out how Mojmap will be named in mod metadata (I'm actually not a fan of the maven identifier, since we're using something that's explicitly not on maven)
  • Testing of loading mojmap-compiled mods in a prod mojmap environment

In the interest of getting this merged in a reasonable timeframe, the remaining work will be covered in a different PR.

@@ -285,7 +285,8 @@ private V1ModMetadataImpl readFields(JsonLoaderValue.ObjectImpl root) {
@Nullable
JsonLoaderValue intermediateMappingsValue = quiltLoader.get(QLKeys.INTERMEDIATE_MAPPINGS);

String[] supported_mappings = { "org.quiltmc:hashed", "net.fabricmc:intermediary" };
// TODO: "mojang" for mojmap breaks spec; it is just temporary for now because its experimental
String[] supported_mappings = { "org.quiltmc:hashed", "net.fabricmc:intermediary", "mojang" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"net.minecraft:mojang"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glitch says this is temporary, but well? I know how permanent placeholders can be like!
Anyway, net.minecraft:mojang makes sense for dev purposes, but Loom uses net.minecraft:mappings, which makes sense but is confusing! (what is Minecraft mappings? I've heard of Mojang!)

So, considering this and Mojang's official standards? Maybe we should go with com.mojang:mappings?

boolean requiresRemap = !location.onClasspath() && QuiltLoader.isDevelopmentEnvironment();
// a mod needs to be remapped if the mod did not come from the classpath and its mappings do not match
// the current runtime namespace
String mappings = meta.intermediateMappings();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Id use a switch here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is java 8

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can switch on strings

Copy link
Contributor Author

@EnnuiL EnnuiL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something I do genuinely wonder about is: what about the mods that uses the remapper thingy? I wouldn't mind breaking compat, but I know that can be tricky; maybe #458 can help?
Anyway, here's the drill:

@@ -309,6 +310,10 @@ private V1ModMetadataImpl readFields(JsonLoaderValue.ObjectImpl root) {
throw new ParseException("Oh no! This version of Quilt Loader doesn't support hashed mappings, please update Quilt Loader to use this mod.");
}

if (mappings.equals("mojang") && !QuiltLoader.getMappingResolver().getNamespaces().contains("mojang")) {
throw new ParseException("Oh no! This version of Quilt Loader doesn't support Mojang mappings, please update Quilt Loader to use this mod.");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This copy-pastey comment doesn't make sense here compared to the Hashed Mojmap one; how about:

Suggested change
throw new ParseException("Oh no! This version of Quilt Loader doesn't support Mojang mappings, please update Quilt Loader to use this mod.");
throw new ParseException("Oh no! This Quilt Loader installation isn't configured to support Mojang mappings.");

(potential remedies to this are to be determined once uhhhh, we figure out a good way to provide mojmap)

@@ -285,7 +285,8 @@ private V1ModMetadataImpl readFields(JsonLoaderValue.ObjectImpl root) {
@Nullable
JsonLoaderValue intermediateMappingsValue = quiltLoader.get(QLKeys.INTERMEDIATE_MAPPINGS);

String[] supported_mappings = { "org.quiltmc:hashed", "net.fabricmc:intermediary" };
// TODO: "mojang" for mojmap breaks spec; it is just temporary for now because its experimental
String[] supported_mappings = { "org.quiltmc:hashed", "net.fabricmc:intermediary", "mojang" };
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glitch says this is temporary, but well? I know how permanent placeholders can be like!
Anyway, net.minecraft:mojang makes sense for dev purposes, but Loom uses net.minecraft:mappings, which makes sense but is confusing! (what is Minecraft mappings? I've heard of Mojang!)

So, considering this and Mojang's official standards? Maybe we should go with com.mojang:mappings?

@EnnuiL EnnuiL marked this pull request as ready for review January 31, 2025 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants