[1.20.4] Feat: Dynamic class remapping#117
Merged
Avanatiker merged 10 commits intomasterfrom Apr 17, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR implements dynamic class remapping using existing dynamic reflection serialization while refactoring several file utilities and network endpoints to improve consistency and functionality.
- Removed deprecated contracts and unused file utility functions from various extensions.
- Integrated asynchronous mapping downloads with dynamic remapping support and updated endpoint documentation.
- Updated file path handling in modules to use a new relativeMCPath extension and improved download handling in the HTTP client.
Reviewed Changes
Copilot reviewed 16 out of 17 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| common/src/main/kotlin/com/lambda/util/extension/Other.kt | Removed experimental contracts imports. |
| common/src/main/kotlin/com/lambda/util/FolderRegister.kt | Removed deprecated file utility functions and added a relativeMCPath extension. |
| common/src/main/kotlin/com/lambda/util/FileUtils.kt | Introduced streamlined file download and utility functions. |
| common/src/main/kotlin/com/lambda/util/DynamicReflectionSerializer.kt | Added dynamic remapping support using asynchronously downloaded mappings and a configurable remap flag. |
| common/src/main/kotlin/com/lambda/util/DynamicException.kt | Implemented DynamicException to remap stack traces based on deobfuscated names. |
| common/src/main/kotlin/com/lambda/network/api/v1/endpoints/*.kt | Updated endpoint documentation to clarify return types. |
| common/src/main/kotlin/com/lambda/network/LambdaHttp.kt | Enhanced download functions with response status checks before writing content. |
| common/src/main/kotlin/com/lambda/module/modules/* | Adjusted file path references from relativePath to relativeMCPath for improved file handling. |
| common/src/main/java/com/lambda/mixin/CrashReportMixin.java | Added mixin modifications to adjust crash reporting and inject dynamic exception handling. |
Files not reviewed (1)
- common/src/main/resources/lambda.mixins.common.json: Language not supported
Comment on lines
73
to
84
| private val mappings = runBlocking { | ||
| "${Network.mappings}/${Network.gameVersion}" | ||
| .downloadIfNotPresent(cache.resolveFile(Network.gameVersion)) | ||
| .map { file -> | ||
| file.readLines() | ||
| .map { it.split(' ') } | ||
| .associate { it[0].split('$').last() to it[1] } | ||
| } | ||
| .getOrElse { | ||
| LOG.error("Unable to download deobfuscated qualifiers", it) | ||
| emptyMap() | ||
| } |
There was a problem hiding this comment.
Using runBlocking in the object initializer for mapping downloads can lead to performance issues during startup. Consider lazy initialization or an asynchronous approach to avoid blocking the main thread.
Suggested change
| private val mappings = runBlocking { | |
| "${Network.mappings}/${Network.gameVersion}" | |
| .downloadIfNotPresent(cache.resolveFile(Network.gameVersion)) | |
| .map { file -> | |
| file.readLines() | |
| .map { it.split(' ') } | |
| .associate { it[0].split('$').last() to it[1] } | |
| } | |
| .getOrElse { | |
| LOG.error("Unable to download deobfuscated qualifiers", it) | |
| emptyMap() | |
| } | |
| private val mappings by lazy { | |
| runCatching { | |
| "${Network.mappings}/${Network.gameVersion}" | |
| .downloadIfNotPresent(cache.resolveFile(Network.gameVersion)) | |
| .map { file -> | |
| file.readLines() | |
| .map { it.split(' ') } | |
| .associate { it[0].split('$').last() to it[1] } | |
| } | |
| .getOrElse { | |
| LOG.error("Unable to download deobfuscated qualifiers", it) | |
| emptyMap() | |
| } | |
| }.getOrElse { | |
| LOG.error("Error initializing mappings", it) | |
| emptyMap() | |
| } |
Avanatiker
approved these changes
Apr 17, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull requests implements a brand new dynamic class remapping that uses the existing dynamic reflection serializer
It allows reflection of obfuscated minecraft members for the packet logger module
Mappings are downloaded from our cloudflare bucket at
mappings.lambda-client.organd are stored loosely in the cache folderBefore:
After:
This pull request also revamps the file utilities with a more streamlined and functional approach
Examples: