Skip to content

Commit

Permalink
Fix NeoForge's new mixins
Browse files Browse the repository at this point in the history
  • Loading branch information
Jab125 committed Jul 9, 2024
1 parent efc2fd6 commit c697fb8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
import net.fabricmc.loom.util.srg.InnerClassRemapper;
import net.fabricmc.mappingio.tree.MappingTree;
import net.fabricmc.mappingio.tree.MemoryMappingTree;
import net.fabricmc.tinyremapper.extension.mixin.MixinExtension;
import net.fabricmc.tinyremapper.InputTag;
import net.fabricmc.tinyremapper.NonClassCopyMode;
import net.fabricmc.tinyremapper.OutputConsumerPath;
Expand Down Expand Up @@ -231,12 +232,17 @@ private TinyRemapper buildRemapper(SharedServiceManager serviceManager, Path inp
final String sourceNamespace = IntermediaryNamespaces.intermediary(project);
MemoryMappingTree mappings = mappingsService.getMappingTree();

TinyRemapper remapper = TinyRemapper.newRemapper()
TinyRemapper.Builder builder = TinyRemapper.newRemapper()
.withMappings(TinyRemapperHelper.create(mappings, sourceNamespace, "official", true))
.withMappings(InnerClassRemapper.of(InnerClassRemapper.readClassNames(input), mappings, sourceNamespace, "official"))
.renameInvalidLocals(true)
.rebuildSourceFilenames(true)
.build();
.rebuildSourceFilenames(true);

if (getExtension().isNeoForge()) {
builder.extension(new MixinExtension(inputTag -> true));
}

TinyRemapper remapper = builder.build();

if (project.getGradle().getStartParameter().getLogLevel().compareTo(LogLevel.LIFECYCLE) < 0) {
MappingsProviderVerbose.saveFile(remapper);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
import net.fabricmc.loom.util.srg.InnerClassRemapper;
import net.fabricmc.loom.util.srg.RemapObjectHolderVisitor;
import net.fabricmc.mappingio.tree.MemoryMappingTree;
import net.fabricmc.tinyremapper.extension.mixin.MixinExtension;
import net.fabricmc.tinyremapper.OutputConsumerPath;
import net.fabricmc.tinyremapper.TinyRemapper;

Expand Down Expand Up @@ -211,6 +212,7 @@ private void remapJar(RemappedJars remappedJars, ConfigContext configContext) th

TinyRemapper remapper = TinyRemapperHelper.getTinyRemapper(getProject(), configContext.serviceManager(), fromM, toM, fixRecords, (builder) -> {
builder.extraPostApplyVisitor(new SignatureFixerApplyVisitor(remappedSignatures));
if (extension.isNeoForge()) builder.extension(new MixinExtension(inputTag -> true));
configureRemapper(remappedJars, builder);
}, classNames);

Expand Down

0 comments on commit c697fb8

Please sign in to comment.