File tree Expand file tree Collapse file tree 1 file changed +19
-2
lines changed
common/src/main/kotlin/com/lambda/util Expand file tree Collapse file tree 1 file changed +19
-2
lines changed Original file line number Diff line number Diff line change @@ -74,16 +74,33 @@ object DynamicReflectionSerializer : Loadable {
7474 " ${Network .mappings} /${Network .gameVersion} "
7575 .downloadIfNotPresent(cache.resolveFile(Network .gameVersion))
7676 .map { file ->
77- file.readLines()
77+ val standardMappings = file.readLines()
7878 .map { it.split(' ' ) }
79- .associate { it[0 ].split(' $' ).last() to it[1 ] }
79+ .filter { it.size == 2 }
80+ .associate { (obf, deobf) -> obf to deobf }
81+
82+ buildMap {
83+ putAll(standardMappings)
84+
85+ standardMappings.forEach { (obf, deobf) ->
86+ put(obf.split(' $' ).last(), deobf)
87+ if (' $' !in obf) return @forEach
88+ put(obf.replace(' $' , ' .' ), deobf)
89+ val parts = obf.split(' $' )
90+ if (! parts.all { it.startsWith(" class_" ) }) return @forEach
91+ (1 until parts.size).forEach { i ->
92+ put(" ${parts.take(i).joinToString(" $" )} .${parts.drop(i).joinToString(" $" )} " , deobf)
93+ }
94+ }
95+ }
8096 }
8197 .getOrElse {
8298 LOG .error(" Unable to download deobfuscated qualifiers" , it)
8399 emptyMap()
84100 }
85101 }
86102
103+
87104 val String .remappedName get() = mappings.getOrDefault(this , this )
88105
89106 fun <T : Any > Class<T>.dynamicName (remap : Boolean ) =
You can’t perform that action at this time.
0 commit comments