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

Basic mapping migration #57

Merged
merged 18 commits into from
Jun 1, 2024
Merged

Conversation

makamys
Copy link
Collaborator

@makamys makamys commented Feb 11, 2024

This PR adds the beginnings of a migrateMappings task inspired by Loom's one. It can remap regular Java source code as well as mixin targets. Currently only paths to local CSV files are supported as target mappings.

Note: The added dependencies seem to greatly slow down the shadow task (2->7 minutes) (actually it's "just" 2->3 minutes), so it might be wise to hold off on merging this until that gets addressed.

Addressed in #59

Testing

I tested it with Hodgepodge in the following way:

  1. Run ./gradlew migrateMappings --mcpDir "~/.gradle/caches/minecraft/de/oceanlabs/mcp/mcp_stable/12"
  2. Add minecraft.useForgeEmbeddedMappings = false to the buildscript (causing the default of stable_12 to be used) and reimport
  3. Fix any issues that pop up
  4. Run runClient

I got the game to run with only some minor adjustments.

Hodgepodge details
  1. JDT gets confused by the mrtjpcore mixin targets, causing it to change @Mixin(PlacementLib$.class) to @Mixin(.class). I simply reverted this, but it could also be worked around by changing them to string constants.
  2. The rayTraceBlocks target in MixinWorld_FixXray is ambiguous with the new mappings, so it needed to be made explicit (rayTraceBlocks(Lnet/minecraft/util/Vec3;Lnet/minecraft/util/Vec3;ZZZ)Lnet/minecraft/util/MovingObjectPosition;).
  3. I needed to disable NEI because its transformer caused an ASM error. This is going to be the hardest issue to properly fix, as it will require introducing a system to safely remap string constants in mods.

@eigenraven eigenraven self-requested a review February 11, 2024 19:54
@eigenraven eigenraven self-assigned this Feb 11, 2024
Doesn't migrate yet, it just creates a diff between the current mappings and the
target (hardcoded for now) and writes it to a file.

I had to add the Paper and Sonatype repos for each subproject so they wouldn't
complain about not being able to find Mercury. I don't know if there's a better
to solve this.
Fixes Lorenz's service files not getting relocated
- Fix wrong dependency names
- Fix absolute paths not working
Automatically wires up stuff like error messages and path resolution
@makamys makamys marked this pull request as draft February 21, 2024 05:59
@makamys
Copy link
Collaborator Author

makamys commented Feb 21, 2024

Found some things I want to change:

  • Use MappingIO for processing mappings. This will simplify the code and we will want to use it for layering mappings later on anyway.
  • There is a bug with caching I found where if the inputs of taskGenerateForgeSrgMappings change without the inputs of migrateMappings changing, the task doesn't rerun.

@makamys makamys marked this pull request as ready for review February 21, 2024 21:33
cp.from(project.files(project.getTasks().named("packagePatchedMc", Jar.class)));
cp.from(
project.getExtensions().getByType(JavaPluginExtension.class).getSourceSets()
.getByName("injectedTags").getOutput());
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not entirely sure if I'm supposed to use .named here, when I tried using it it gave me an inscrutable compiler error so I went with getting it directly.

Copy link
Contributor

Choose a reason for hiding this comment

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

ConfigurableFileCollection#from evaluates whatever is passed as-if they're passed to Project#files already, no need to also call Project#files here.

@eigenraven eigenraven merged commit ef75049 into GTNewHorizons:master Jun 1, 2024
1 check passed
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