Skip to content

Commit 0a1e295

Browse files
committed
Add Mixin docs and fix target build directory
1 parent d897dee commit 0a1e295

File tree

2 files changed

+36
-1
lines changed

2 files changed

+36
-1
lines changed

LEGACY.md

+35
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,41 @@ obfuscation {
9191
}
9292
```
9393

94+
## Mixins
95+
96+
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).
97+
98+
This is usually done by including the Mixin annotation processor in your build:
99+
100+
```groovy
101+
dependencies {
102+
annotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
103+
// If you have additional source sets that contain Mixins, you also need to apply the AP to those
104+
// For example if you have a "client" source set:
105+
clientAnnotationProcessor 'org.spongepowered:mixin:0.8.5:processor'
106+
}
107+
```
108+
109+
You need to let the AP know about your Mixin configuration files, and how you'd like your refmap to be named for each
110+
of the source sets that contain mixins:
111+
112+
```groovy
113+
mixin {
114+
add sourceSets.main, 'mixins.mymod.refmap.json'
115+
config 'mixins.mymod.json' // This can be done for multiple configs
116+
}
117+
```
118+
119+
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:
120+
121+
```groovy
122+
jar {
123+
manifest.attributes([
124+
"MixinConfigs": "mixinextras.init.mixins.json"
125+
])
126+
}
127+
```
128+
94129
## Effects of applying the legacy plugin
95130
When applied, the legacy plugin will change the base NeoForm and NeoForge artifact coordinates of the `neoForge` extension to
96131
`de.oceanlabs.mcp:mcp_config` and `net.minecraftforge:forge`.

src/legacy/java/net/neoforged/moddevgradle/legacyforge/dsl/Obfuscation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public TaskProvider<RemapJar> reobfuscate(TaskProvider<? extends AbstractArchive
7070

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

0 commit comments

Comments
 (0)