Skip to content

Commit

Permalink
Add Mixin docs and fix target build directory (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
shartte authored Dec 5, 2024
1 parent 7cdbccd commit 610a6a1
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
35 changes: 35 additions & 0 deletions LEGACY.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,41 @@ obfuscation {
}
```

## Mixins

You need to create so-called "refmaps" for Mixin, which convert the names you used to declare injection points and reference other parts of Minecraft code to the names used at runtime (SRG).

This is usually done by including the Mixin annotation processor in your build:

```groovy
dependencies {
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
// If you have additional source sets that contain Mixins, you also need to apply the AP to those
// For example if you have a "client" source set:
clientAnnotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
}
```

You need to let the AP know about your Mixin configuration files, and how you'd like your refmap to be named for each
of the source sets that contain mixins:

```groovy
mixin {
add sourceSets.main, 'mixins.mymod.refmap.json'
config 'mixins.mymod.json' // This can be done for multiple configs
}
```

Please note, you also have to add the `MixinConfigs` attribute to your Jar manifest for your Mixins to load in production. Such as this way:

```groovy
jar {
manifest.attributes([
"MixinConfigs": "mixins.mymod.json"
])
}
```

## Effects of applying the legacy plugin
When applied, the legacy plugin will change the base NeoForm and NeoForge artifact coordinates of the `neoForge` extension to
`de.oceanlabs.mcp:mcp_config` and `net.minecraftforge:forge`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public TaskProvider<RemapJar> reobfuscate(TaskProvider<? extends AbstractArchive

var reobf = project.getTasks().register("reobf" + StringUtils.capitalize(jar.getName()), RemapJar.class, task -> {
task.getInput().set(jar.flatMap(AbstractArchiveTask::getArchiveFile));
task.getDestinationDirectory().convention(task.getProject().getLayout().getBuildDirectory());
task.getDestinationDirectory().convention(task.getProject().getLayout().getBuildDirectory().dir("libs"));
task.getArchiveBaseName().convention(jar.flatMap(AbstractArchiveTask::getArchiveBaseName));
task.getArchiveVersion().convention(jar.flatMap(AbstractArchiveTask::getArchiveVersion));
task.getArchiveClassifier().convention(jar.flatMap(AbstractArchiveTask::getArchiveClassifier));
Expand Down

0 comments on commit 610a6a1

Please sign in to comment.