Skip to content

Commit

Permalink
Apply fix for official
Browse files Browse the repository at this point in the history
  • Loading branch information
shedaniel committed Apr 7, 2024
1 parent f3fea21 commit 6f484de
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ import io.ktor.server.routing.*
import kotlinx.serialization.json.*
import me.shedaniel.linkie.Namespaces
import me.shedaniel.linkie.RemapperDaemon
import me.shedaniel.linkie.namespaces.MojangRawNamespace
import me.shedaniel.linkie.namespaces.MojangSrgNamespace
import me.shedaniel.linkie.obfMergedName
import me.shedaniel.linkie.utils.tryToVersion
import me.shedaniel.linkie.web.deps.depsCycle
import me.shedaniel.linkie.web.deps.startDepsCycle
Expand Down Expand Up @@ -150,12 +152,16 @@ fun main() {
val namespace = Namespaces.namespaces[namespaceStr] ?: throw IllegalArgumentException("No namespace found for $namespaceStr")
val defaultVersion = namespace.defaultVersion.takeIf { it in namespace.getAllSortedVersions() } ?: namespace.getAllSortedVersions().first()
val provider = version.let { namespace.getProvider(it) }.takeUnless { it.isEmpty() } ?: namespace.getProvider(defaultVersion)
val useObj = namespace == MojangRawNamespace
val noIntermediary = namespace == MojangSrgNamespace
call.respond(buildJsonObject {
provider.get().allClasses.forEach { clazz ->
var intermediaryName = clazz.intermediaryName
var mappedName = clazz.mappedName
if (noIntermediary) {
if (useObj) {
mappedName = intermediaryName
intermediaryName = clazz.obfMergedName ?: intermediaryName
} else if (noIntermediary) {
intermediaryName = mappedName ?: intermediaryName
mappedName = null
}
Expand Down

0 comments on commit 6f484de

Please sign in to comment.