Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 35a460a

Browse files
committed
Final (hopefully) reviews
1 parent b8f049b commit 35a460a

2 files changed

Lines changed: 15 additions & 7 deletions

File tree

patchwork-fml/src/main/java/com/patchworkmc/impl/fml/PatchworkMappingService.java

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,10 @@
3131
import net.fabricmc.mapping.tree.TinyTree;
3232

3333
public class PatchworkMappingService {
34-
public static final TinyTree MAPPINGS = FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings();
35-
public static final String INTERMEDIARY = "intermediary";
36-
public static final String NAMED = "named";
34+
// We're technically messing with Loader's internal APIs here, if Loader ever gets a better mapping resolution system this class should be refactored.
35+
private static final TinyTree MAPPINGS = FabricLauncherBase.getLauncher().getMappingConfiguration().getMappings();
36+
private static final String INTERMEDIARY = "intermediary";
37+
private static final String NAMED = "named";
3738

3839
private PatchworkMappingService() {
3940
// NO-OP
@@ -48,7 +49,7 @@ private PatchworkMappingService() {
4849
*/
4950
@Nonnull
5051
public static String remapName(INameMappingService.Domain domain, String name) {
51-
if (FabricLoader.getInstance().getMappingResolver().getCurrentRuntimeNamespace().equals(INTERMEDIARY)) {
52+
if (runtimeNamespaceIsIntermediary()) {
5253
return name;
5354
}
5455

@@ -78,6 +79,10 @@ public static String remapName(INameMappingService.Domain domain, String name) {
7879
*/
7980
@Nonnull
8081
public static String remapNameFast(INameMappingService.Domain domain, Class<?> clazz, String name) {
82+
if (runtimeNamespaceIsIntermediary()) {
83+
return name;
84+
}
85+
8186
ClassDef classDef = MAPPINGS.getDefaultNamespaceClassMap().get(clazz.getName());
8287
String remappedName = remapNameInternal(domain, classDef, name);
8388

@@ -92,8 +97,8 @@ public static String remapNameFast(INameMappingService.Domain domain, Class<?> c
9297
* @return The remapped name, or null if it couldn't be remapped.
9398
*/
9499
@Nullable
95-
public static String remapNameInternal(INameMappingService.Domain domain, ClassDef classDef, String name) {
96-
if (FabricLoader.getInstance().getMappingResolver().getCurrentRuntimeNamespace().equals(INTERMEDIARY)) {
100+
private static String remapNameInternal(INameMappingService.Domain domain, ClassDef classDef, String name) {
101+
if (runtimeNamespaceIsIntermediary()) {
97102
return name;
98103
}
99104

@@ -111,4 +116,8 @@ public static String remapNameInternal(INameMappingService.Domain domain, ClassD
111116

112117
return null;
113118
}
119+
120+
private static boolean runtimeNamespaceIsIntermediary() {
121+
return FabricLoader.getInstance().getMappingResolver().getCurrentRuntimeNamespace().equals(INTERMEDIARY);
122+
}
114123
}

patchwork-fml/src/main/java/net/minecraftforge/fml/common/ObfuscationReflectionHelper.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
public class ObfuscationReflectionHelper {
5050
private static final Logger LOGGER = LogManager.getLogger();
5151
private static final Marker REFLECTION = MarkerManager.getMarker("REFLECTION");
52-
// We're technically messing with Loader's internal APIs here, if Loader ever gets a better mapping resolution system this class should be refactored.
5352

5453
/**
5554
* Remaps a name from intermediary to whatever is currently being used at runtime.

0 commit comments

Comments
 (0)