2424import com .falsepattern .lib .dependencies .DependencyLoader ;
2525import com .falsepattern .lib .dependencies .Library ;
2626import com .falsepattern .lib .dependencies .SemanticVersion ;
27+ import com .falsepattern .lib .internal .Tags ;
2728import com .falsepattern .lib .internal .asm .CoreLoadingPlugin ;
2829import com .falsepattern .lib .mapping .storage .Lookup ;
2930import com .falsepattern .lib .mapping .types .MappingType ;
@@ -49,13 +50,15 @@ public class MappingManager {
4950 private static final Lookup <UniversalClass > regularLookup = new Lookup <>();
5051 private static final Map <String , String > stringPool = new HashMap <>();
5152 private static boolean initialized = false ;
52-
53+ private static final Object MUTEX = new Object ();
5354 @ SneakyThrows
54- private static synchronized void initialize () {
55- if (initialized ) {
56- return ;
55+ public static void initialize () {
56+ synchronized (MUTEX ) {
57+ if (initialized ) {
58+ return ;
59+ }
60+ initialized = true ;
5761 }
58- initialized = true ;
5962 DependencyLoader .addMavenRepo ("https://repo1.maven.org/maven2/" );
6063 DependencyLoader .loadLibraries (Library .builder ()
6164 .groupId ("org.tukaani" )
@@ -70,6 +73,7 @@ private static synchronized void initialize() {
7073 .minorVersion (9 )
7174 .patchVersion (-1 )
7275 .build ())
76+ .loadingModId (Tags .MODID )
7377 .build ());
7478 val input = new DataInputStream (new LZMA2Options (6 ).getInputStream (
7579 ResourceUtil .getResourceFromJar ("/mappings.lzma2" , CoreLoadingPlugin .class )));
@@ -128,6 +132,7 @@ public static UniversalClass classForName(NameType nameType, MappingType mapping
128132
129133 @ StableAPI .Expose
130134 public static boolean containsClass (NameType nameType , MappingType mappingType , String className ) {
135+ initialize ();
131136 switch (nameType ) {
132137 case Internal :
133138 return internalLookup .containsKey (mappingType , className );
@@ -141,6 +146,7 @@ public static boolean containsClass(NameType nameType, MappingType mappingType,
141146 @ StableAPI .Expose
142147 public static UniversalField getField (FieldInsnNode instruction )
143148 throws ClassNotFoundException , NoSuchFieldException {
149+ initialize ();
144150 if (!CoreLoadingPlugin .isObfuscated ()) {
145151 try {
146152 return classForName (NameType .Internal , MappingType .MCP , instruction .owner ).getField (MappingType .MCP ,
@@ -168,6 +174,7 @@ public static UniversalField getField(FieldInsnNode instruction)
168174 @ StableAPI .Expose
169175 public static UniversalMethod getMethod (MethodInsnNode instruction )
170176 throws ClassNotFoundException , NoSuchMethodException {
177+ initialize ();
171178 if (!CoreLoadingPlugin .isObfuscated ()) {
172179 try {
173180 return classForName (NameType .Internal , MappingType .MCP , instruction .owner ).getMethod (MappingType .MCP ,
0 commit comments