Fix mojmap package names for realms and math
parent
94ce38068c
commit
71c28bbcd0
|
@ -60,6 +60,8 @@ public record MojangMappingLayer(MinecraftVersionMeta.Download clientDownload,
|
|||
|
||||
printMappingsLicense(clientMappings);
|
||||
|
||||
mappingVisitor = new MojangPackageFixingMappingVisitor(mappingVisitor);
|
||||
|
||||
// Filter out field names matching the pattern
|
||||
DstNameFilterMappingVisitor nameFilter = new DstNameFilterMappingVisitor(mappingVisitor, SYNTHETIC_NAME_PATTERN);
|
||||
|
||||
|
|
|
@ -0,0 +1,30 @@
|
|||
package net.fabricmc.loom.configuration.providers.mappings.mojmap;
|
||||
|
||||
import net.fabricmc.mappingio.MappedElementKind;
|
||||
import net.fabricmc.mappingio.MappingVisitor;
|
||||
import net.fabricmc.mappingio.adapter.ForwardingMappingVisitor;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/*
|
||||
* This is temporary, since currently using the Quilt mappings layered on top of mojmap
|
||||
* crashes the game due to a conflict in mapped packages for anonymous inner classes.
|
||||
*
|
||||
* The problematic Mojang packages are replaced with their Quilt counterparts and the
|
||||
* remapped game then properly works.
|
||||
*/
|
||||
public class MojangPackageFixingMappingVisitor extends ForwardingMappingVisitor {
|
||||
public MojangPackageFixingMappingVisitor(MappingVisitor next) {
|
||||
super(next);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitDstName(MappedElementKind targetKind, int namespace, String name) throws IOException {
|
||||
if (targetKind == MappedElementKind.CLASS)
|
||||
name = name
|
||||
.replace("com/mojang/realmsclient/", "net/minecraft/client/realms/")
|
||||
.replace("com/mojang/math/", "net/minecraft/util/math/");
|
||||
|
||||
super.visitDstName(targetKind, namespace, name);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue