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

Replace compile-time package access fixing on Forge with Unprotect #84

Merged
merged 2 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@ public static void setupConfigurations(Project project) {

if (extension.isForge()) {
project.getDependencies().add(Constants.Configurations.FORGE_EXTRA, Constants.Dependencies.FORGE_RUNTIME + Constants.Dependencies.Versions.FORGE_RUNTIME);
project.getDependencies().add(Constants.Configurations.FORGE_EXTRA, Constants.Dependencies.UNPROTECT + Constants.Dependencies.Versions.UNPROTECT);
project.getDependencies().add(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, Constants.Dependencies.JAVAX_ANNOTATIONS + Constants.Dependencies.Versions.JAVAX_ANNOTATIONS);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@

public class MinecraftPatchedProvider extends MergedMinecraftProvider {
private static final String LOOM_PATCH_VERSION_KEY = "Loom-Patch-Version";
private static final String CURRENT_LOOM_PATCH_VERSION = "5";
private static final String CURRENT_LOOM_PATCH_VERSION = "6";
private static final String NAME_MAPPING_SERVICE_PATH = "/inject/META-INF/services/cpw.mods.modlauncher.api.INameMappingService";

// Step 1: Remap Minecraft to SRG
Expand Down Expand Up @@ -250,7 +250,6 @@ private TinyRemapper buildRemapper(Path input) throws IOException {
.withMappings(InnerClassRemapper.of(InnerClassRemapper.readClassNames(input), mappingsWithSrg, "srg", "official"))
.renameInvalidLocals(true)
.rebuildSourceFilenames(true)
.fixPackageAccess(true)
.build();

if (getProject().getGradle().getStartParameter().getLogLevel().compareTo(LogLevel.LIFECYCLE) < 0) {
Expand Down
2 changes: 2 additions & 0 deletions src/main/java/net/fabricmc/loom/util/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public static final class Dependencies {
public static final String JAVAX_ANNOTATIONS = "com.google.code.findbugs:jsr305:"; // I hate that I have to add these.
public static final String FORGE_RUNTIME = "dev.architectury:architectury-loom-runtime:";
public static final String ACCESS_TRANSFORMERS = "net.minecraftforge:accesstransformers:";
public static final String UNPROTECT = "io.github.juuxel:unprotect:";

private Dependencies() {
}
Expand All @@ -143,6 +144,7 @@ public static final class Versions {
public static final String FORGE_RUNTIME = "1.1.3";
public static final String ACCESS_TRANSFORMERS = "3.0.1";
public static final String ACCESS_TRANSFORMERS_NEW = "8.0.5";
public static final String UNPROTECT = "1.0.0";

private Versions() {
}
Expand Down
7 changes: 0 additions & 7 deletions src/main/java/net/fabricmc/loom/util/TinyRemapperHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,6 @@ public static Triple<TinyRemapper, Mutable<MemoryMappingTree>, List<TinyRemapper
.logger(project.getLogger()::lifecycle)
.rebuildSourceFilenames(true);

if (extension.isForge()) {
/* FORGE: Required for classes like aej$OptionalNamedTag (1.16.4) which are added by Forge patches.
* They won't get remapped to their proper packages, so IllegalAccessErrors will happen without ._.
*/
builder.fixPackageAccess(true);
}

builder.invalidLvNamePattern(MC_LV_PATTERN);
builder.inferNameFromSameLvIndex(true);
builder.extraPreApplyVisitor((cls, next) -> {
Expand Down