blob: 8a6144e22ad36afdfea1d5b298528b5a9051eb92 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package com.replaymod.gradle.remap.legacy
import org.cadixdev.lorenz.MappingSet
import org.cadixdev.lorenz.io.MappingsReader
class LegacyMappingsReader(private val map: Map<String, LegacyMapping>) : MappingsReader() {
override fun read(): MappingSet {
return read(MappingSet.create(LegacyMappingSetModelFactory()))
}
override fun read(mappings: MappingSet): MappingSet {
require(mappings.modelFactory is LegacyMappingSetModelFactory) { "legacy mappings must use legacy model factory, use read() instead" }
for (legacyMapping in map.values) {
val classMapping = mappings.getOrCreateClassMapping(legacyMapping.oldName)
.setDeobfuscatedName(legacyMapping.newName)
for ((key, value) in legacyMapping.fields) {
classMapping.getOrCreateFieldMapping(key).deobfuscatedName = value
}
for ((key, value) in legacyMapping.methods) {
classMapping.getOrCreateMethodMapping(key, "()V").deobfuscatedName = value
}
}
return mappings
}
override fun close() {}
}
|