Skip to content

Commit 4e722c6

Browse files
committed
One mapping registry per context
1 parent e17168e commit 4e722c6

File tree

9 files changed

+305
-272
lines changed

9 files changed

+305
-272
lines changed

src/main/java/io/github/fabriccompatibiltylayers/modremappingapi/api/MappingUtils.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ static String unmapClass(String className) {
3838
*/
3939
@Deprecated
4040
static MappingUtils.ClassMember mapField(String className, String fieldName, @Nullable String fieldDesc) {
41-
return MappingsUtilsImpl.mapField(className, fieldName, fieldDesc);
41+
return MappingsUtilsImpl.mapField(MappingsUtilsImpl.getV1Registry(), className, fieldName, fieldDesc);
4242
}
4343

4444
/**
@@ -50,7 +50,7 @@ static MappingUtils.ClassMember mapField(String className, String fieldName, @Nu
5050
*/
5151
@Deprecated
5252
static MappingUtils.ClassMember mapFieldFromRemappedClass(String className, String fieldName, @Nullable String fieldDesc) {
53-
return MappingsUtilsImpl.mapFieldFromRemappedClass(className, fieldName, fieldDesc);
53+
return MappingsUtilsImpl.mapFieldFromRemappedClass(MappingsUtilsImpl.getV1Registry(), className, fieldName, fieldDesc);
5454
}
5555

5656
/**
@@ -62,7 +62,7 @@ static MappingUtils.ClassMember mapFieldFromRemappedClass(String className, Stri
6262
*/
6363
@Deprecated
6464
static MappingUtils.ClassMember mapMethod(String className, String methodName, String methodDesc) {
65-
return MappingsUtilsImpl.mapMethod(className, methodName, methodDesc);
65+
return MappingsUtilsImpl.mapMethod(MappingsUtilsImpl.getV1Registry(), className, methodName, methodDesc);
6666
}
6767

6868
/**
@@ -74,7 +74,7 @@ static MappingUtils.ClassMember mapMethod(String className, String methodName, S
7474
*/
7575
@Deprecated
7676
static MappingUtils.ClassMember mapMethodFromRemappedClass(String className, String methodName, String methodDesc) {
77-
return MappingsUtilsImpl.mapMethodFromRemappedClass(className, methodName, methodDesc);
77+
return MappingsUtilsImpl.mapMethodFromRemappedClass(MappingsUtilsImpl.getV1Registry(), className, methodName, methodDesc);
7878
}
7979

8080
/**
@@ -85,7 +85,7 @@ static MappingUtils.ClassMember mapMethodFromRemappedClass(String className, Str
8585
*/
8686
@Deprecated
8787
static MappingUtils.ClassMember mapField(Class<?> owner, String fieldName) {
88-
return MappingsUtilsImpl.mapField(owner, fieldName);
88+
return MappingsUtilsImpl.mapField(MappingsUtilsImpl.getV1Registry(), owner, fieldName);
8989
}
9090

9191
/**
@@ -97,7 +97,7 @@ static MappingUtils.ClassMember mapField(Class<?> owner, String fieldName) {
9797
*/
9898
@Deprecated
9999
static MappingUtils.ClassMember mapMethod(Class<?> owner, String methodName, Class<?>[] parameterTypes) {
100-
return MappingsUtilsImpl.mapMethod(owner, methodName, parameterTypes);
100+
return MappingsUtilsImpl.mapMethod(MappingsUtilsImpl.getV1Registry(), owner, methodName, parameterTypes);
101101
}
102102

103103
/**

src/main/java/io/github/fabriccompatibiltylayers/modremappingapi/api/v1/MappingUtils.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public interface MappingUtils {
1111
* @return remapped class name
1212
*/
1313
static String mapClass(String className) {
14-
return MappingsUtilsImpl.mapClass(className);
14+
return MappingsUtilsImpl.mapClass(MappingsUtilsImpl.getV1Registry(), className);
1515
}
1616

1717
/**
@@ -20,7 +20,7 @@ static String mapClass(String className) {
2020
* @return original class name
2121
*/
2222
static String unmapClass(String className) {
23-
return MappingsUtilsImpl.unmapClass(className);
23+
return MappingsUtilsImpl.unmapClass(MappingsUtilsImpl.getV1Registry(), className);
2424
}
2525

2626
/**
@@ -31,7 +31,7 @@ static String unmapClass(String className) {
3131
* @return
3232
*/
3333
static ClassMember mapField(String className, String fieldName, @Nullable String fieldDesc) {
34-
return MappingsUtilsImpl.mapField(className, fieldName, fieldDesc);
34+
return MappingsUtilsImpl.mapField(MappingsUtilsImpl.getV1Registry(), className, fieldName, fieldDesc);
3535
}
3636

3737
/**
@@ -42,7 +42,7 @@ static ClassMember mapField(String className, String fieldName, @Nullable String
4242
* @return
4343
*/
4444
static ClassMember mapFieldFromRemappedClass(String className, String fieldName, @Nullable String fieldDesc) {
45-
return MappingsUtilsImpl.mapFieldFromRemappedClass(className, fieldName, fieldDesc);
45+
return MappingsUtilsImpl.mapFieldFromRemappedClass(MappingsUtilsImpl.getV1Registry(), className, fieldName, fieldDesc);
4646
}
4747

4848
/**
@@ -53,7 +53,7 @@ static ClassMember mapFieldFromRemappedClass(String className, String fieldName,
5353
* @return
5454
*/
5555
static ClassMember mapMethod(String className, String methodName, String methodDesc) {
56-
return MappingsUtilsImpl.mapMethod(className, methodName, methodDesc);
56+
return MappingsUtilsImpl.mapMethod(MappingsUtilsImpl.getV1Registry(), className, methodName, methodDesc);
5757
}
5858

5959
/**
@@ -64,15 +64,15 @@ static ClassMember mapMethod(String className, String methodName, String methodD
6464
* @return
6565
*/
6666
static ClassMember mapMethodFromRemappedClass(String className, String methodName, String methodDesc) {
67-
return MappingsUtilsImpl.mapMethodFromRemappedClass(className, methodName, methodDesc);
67+
return MappingsUtilsImpl.mapMethodFromRemappedClass(MappingsUtilsImpl.getV1Registry(), className, methodName, methodDesc);
6868
}
6969

7070
static ClassMember mapField(Class<?> owner, String fieldName) {
71-
return MappingsUtilsImpl.mapField(owner, fieldName);
71+
return MappingsUtilsImpl.mapField(MappingsUtilsImpl.getV1Registry(), owner, fieldName);
7272
}
7373

7474
static ClassMember mapMethod(Class<?> owner, String methodName, Class<?>[] parameterTypes) {
75-
return MappingsUtilsImpl.mapMethod(owner, methodName, parameterTypes);
75+
return MappingsUtilsImpl.mapMethod(MappingsUtilsImpl.getV1Registry(), owner, methodName, parameterTypes);
7676
}
7777

7878
/**
@@ -81,7 +81,7 @@ static ClassMember mapMethod(Class<?> owner, String methodName, Class<?>[] param
8181
* @return remapped descriptor
8282
*/
8383
static String mapDescriptor(String desc) {
84-
return MappingsUtilsImpl.mapDescriptor(desc);
84+
return MappingsUtilsImpl.mapDescriptor(MappingsUtilsImpl.getV1Registry(), desc);
8585
}
8686

8787
class ClassMember {

src/main/java/io/github/fabriccompatibiltylayers/modremappingapi/impl/LibraryHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
public class LibraryHandler {
2121
private static final Map<RemapLibrary, Path> remapLibraries = new HashMap<>();
2222

23-
public static void gatherRemapLibraries(List<ModRemapper> remappers) {
23+
public static void gatherRemapLibraries(List<ModRemapper> remappers, String sourceNamespace) {
2424
try {
2525
for (ModRemapper remapper : remappers) {
2626
List<RemapLibrary> libraries = new ArrayList<>();
2727

2828
remapper.addRemapLibraries(libraries, FabricLoader.getInstance().getEnvironmentType());
2929

30-
Map<RemapLibrary, Path> temp = CacheUtils.computeExtraLibraryPaths(libraries, MappingsUtilsImpl.getSourceNamespace());
30+
Map<RemapLibrary, Path> temp = CacheUtils.computeExtraLibraryPaths(libraries, sourceNamespace);
3131

3232
for (Map.Entry<RemapLibrary, Path> entry : temp.entrySet()) {
3333
RemapLibrary library = entry.getKey();

0 commit comments

Comments
 (0)