-
Notifications
You must be signed in to change notification settings - Fork 41
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
Support for FG2-era Forge #70
base: dev/0.10.0
Are you sure you want to change the base?
Conversation
Way easier to read than the previous array-copy implementation and trivial to extend when more file are optional (see next commit).
This jar used to always be included in the cache file list even though it is only used/generated with official mappings. Therefore it would always be missing from the cache when not using official mappings, unnecessarily re-running the patching code.
A fallback SrgProvider is instantiated and initialized here but never added to the provider list, resulting in a NPE right below in `getRawSrgFile`.
} | ||
} | ||
|
||
private static class FabricSideStripper extends ClassVisitor { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be an issue for the Forge 1.13+ setups as well (Noticed it in some classes), I will just keep a comment here so I can go back here in the future
src/main/java/net/fabricmc/loom/configuration/providers/mappings/MappingsProviderImpl.java
Show resolved
Hide resolved
@@ -57,6 +57,13 @@ jar { | |||
} | |||
} | |||
|
|||
loom { | |||
forge { | |||
// FIXME should eventually be handled by architectury-pack200 gradle plugin? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keeping a comment here, yes, this will be handled there once a PR is merged.
We never use the v1 file, so there isn't really any reason to keep it around.
Cause modern versions of Forge do not need them.
src/main/java/net/fabricmc/loom/configuration/providers/forge/ForgeUserdevProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/net/fabricmc/loom/configuration/providers/forge/MinecraftPatchedProvider.java
Show resolved
Hide resolved
loom { | ||
forge { | ||
// FIXME should eventually be handled by architectury-pack200 gradle plugin? | ||
pack200Provider = new dev.architectury.pack200.java.Pack200Adapter() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This stuff should be in its own test since pack200 isn't used in the Forge code for current MC versions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only temporary. It'll be moved into the pack200 plugin once this PR is merged (so the pack200 plugin can compile against it).
src/main/java/net/fabricmc/loom/configuration/providers/forge/ForgeUserdevProvider.java
Show resolved
Hide resolved
src/main/java/net/fabricmc/loom/configuration/providers/forge/ForgeUserdevProvider.java
Outdated
Show resolved
Hide resolved
src/main/java/net/fabricmc/loom/configuration/providers/forge/SrgProvider.java
Outdated
Show resolved
Hide resolved
build.gradle
Outdated
@@ -119,13 +119,17 @@ dependencies { | |||
implementation ('de.oceanlabs.mcp:mcinjector:3.8.0') | |||
implementation ('com.opencsv:opencsv:5.4') | |||
|
|||
// Legacy Forge access transformers | |||
implementation ('net.md-5:SpecialSource:1.10.0') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does the current AT tool not work for old MC versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would require remapping the entire minecraft jar (and presumably also forge? I guess ATs can apply to it as well?) from official to srg and back, only to run the AT tool. Much slower than this implementation which basically just converts the names as it looks them up.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I see. You could also remap the AT since we have tools (CadixDev's library) for that.
Usages are more related to the modern Forge than to ModLauncher specifically.
I do not quite remember why I added this in the first place but it seems fine without, so let's not mess with it.
addDependency(Constants.Dependencies.DEV_LAUNCH_INJECTOR + Constants.Dependencies.Versions.DEV_LAUNCH_INJECTOR, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES); | ||
addDependency(Constants.Dependencies.TERMINAL_CONSOLE_APPENDER + Constants.Dependencies.Versions.TERMINAL_CONSOLE_APPENDER, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES); | ||
addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME); | ||
|
||
if (getExtension().isForge()) { | ||
if (getExtension().isForge() && !getExtension().isLegacyForge()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (getExtension().isForge() && !getExtension().isLegacyForge()) { | |
if (getExtension().isModernForge()) { |
We've assumed that Forge adds its annotation everywhere via its patches but it actually only adds them if a given file needs to have a patch applied for reasons other than just the SideOnly annotation. This would leave some classes/fields/methods without annotation which resulted in an exception when deserializing horses on 1.12.2 (because it references a class which in turn has methods referencing the dedicated server class which is server-only). Instead, we now convert all Fabric annotations (added during merging) to the Forge ones and remove duplicates (where patches also added them).
This should probably be updated to target |
Forge has not published regular source artifacts for old versions, instead the sources zip is bundled within the userdev jar. Co-authored-by: DJtheRedstoner <[email protected]>
exactly the reason I split fg3+ and fg2 classes in mine, makes it so changes to one don't cascade into the other |
Adds support for Forge versions which previously required ForgeGradle 2.
Should be fully functional for building production-ready jars as well as running in a development environment (I only tested IntelliJ but there's no IDE-specific code).
This was developed mostly late November completely independently from #63. Afaict notable differences are:
I had originally bundled pack200 directly into loom but later switched that out for the external plugin as in #63. I was unable to figure out a nice way to get it into the integration test though (classloader shenanigans where the plugin couldn't see our interface; and just adding it to the test classpath doesn't add it to the nested gradle jvm). The best I could come up with is adding a "runtimeOnly" dependency to the main project but is not ideal if the goal was to not have a dependency on that pack200 implementation (though the java classpath exception applies to it, so this shouldn't be an issue license-wise).
There's two extra commits before the main one, each of which fixes a bug I ran into (see their commit messages for details).
Somewhat complex example project: https://github.com/Sk1erLLC/Patcher/tree/tmp/archloom
(needs archloom published to mavenLocal; features a coremod, tweakers, mixins, 1.8.9 and 1.12.2)