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

Add Mixin docs and fix target build directory #194

Merged
merged 3 commits into from
Dec 5, 2024
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
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
Loading