Skip to content

Commit da78f11

Browse files
committed
Merge branch '1.21.5' into feature/mouse-button-binds
2 parents e724b48 + d5976ba commit da78f11

File tree

5 files changed

+22
-26
lines changed

5 files changed

+22
-26
lines changed

src/main/kotlin/com/lambda/module/modules/render/NoRender.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,9 @@ object NoRender : Module(
177177

178178
@JvmStatic
179179
fun shouldAcceptFog(modifier: StatusEffectFogModifier) =
180-
when {
181-
isDisabled -> true
182-
modifier.statusEffect == StatusEffects.BLINDNESS && noBlindness -> false
183-
modifier.statusEffect == StatusEffects.DARKNESS && noDarkness -> false
180+
when (modifier.statusEffect) {
181+
StatusEffects.BLINDNESS if (noBlindness && isEnabled) -> false
182+
StatusEffects.DARKNESS if (noDarkness && isEnabled) -> false
184183
else -> true
185184
}
186185

@@ -189,4 +188,4 @@ object NoRender : Module(
189188
val remapped: String,
190189
val displayName: String
191190
)
192-
}
191+
}

src/main/kotlin/com/lambda/network/CapeManager.kt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import com.lambda.core.Loadable
2424
import com.lambda.event.events.WorldEvent
2525
import com.lambda.event.listener.SafeListener.Companion.listen
2626
import com.lambda.graphics.texture.TextureUtils
27-
import com.lambda.network.LambdaAPI.cdn
2827
import com.lambda.network.api.v1.endpoints.getCape
2928
import com.lambda.network.api.v1.endpoints.getCapes
3029
import com.lambda.network.api.v1.endpoints.setCape
@@ -65,11 +64,11 @@ object CapeManager : ConcurrentHashMap<UUID, String>(), Loadable {
6564
val capeList = runBlocking {
6665
capes.resolveFile("capes.txt")
6766
.isOlderThan(24.hours) {
68-
it.downloadIfNotPresent("$cdn/capes.txt")
67+
it.downloadIfNotPresent("${LambdaAPI.capes}.txt")
6968
.onFailure { err -> LOG.error("Could not download the cape list: $err") }
7069
}
7170
.ifNotExists {
72-
it.downloadCompare("$cdn/capes.txt", -1)
71+
it.downloadCompare("${LambdaAPI.capes}.txt", -1)
7372
.onFailure { err -> LOG.error("Could not download the cape list: $err") }
7473
}
7574
.createIfNotExists()

src/main/kotlin/com/lambda/network/LambdaAPI.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ object LambdaAPI : Configurable(LambdaConfig) {
4747
val authServer by setting("Auth Server", "auth.lambda-client.org")
4848
val apiUrl by setting("API Server", "https://api.lambda-client.org")
4949
val apiVersion by setting("API Version", ApiVersion.V1)
50-
val mappings by setting("Mappings", "https://mappings.lambda-client.org")
51-
val cdn by setting("CDN", "https://cdn.lambda-client.org")
50+
val assets by setting("Assets", "https://raw.githubusercontent.com/Edouard127/lambda-assets/refs/heads/master")
51+
52+
val mappings get() = "$assets/mappings" // Folder containing mappings for our dynamic serializer
53+
val capes get() = "$assets/capes" // Folder containing all the capes, add .txt to get the list of available capes
5254

5355
@Suppress("Deprecation")
5456
const val GAME_VERSION = SharedConstants.VERSION_NAME
@@ -102,4 +104,4 @@ object LambdaAPI : Configurable(LambdaConfig) {
102104

103105
override fun toString() = value
104106
}
105-
}
107+
}

src/main/kotlin/com/lambda/network/api/v1/models/Cape.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
package com.lambda.network.api.v1.models
1919

2020
import com.google.gson.annotations.SerializedName
21+
import com.lambda.network.LambdaAPI
2122
import java.util.*
2223

2324
class Cape(
@@ -28,7 +29,7 @@ class Cape(
2829
val id: String,
2930
) {
3031
val url: String
31-
get() = "https://cdn.lambda-client.org/$id.png"
32+
get() = "${LambdaAPI.capes}/$id.png"
3233

3334
override fun toString() = "Cape(uuid=$uuid, id=$id, url=$url)"
3435
}

src/main/kotlin/com/lambda/util/DynamicReflectionSerializer.kt

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,26 @@ object DynamicReflectionSerializer : Loadable {
7272
org.slf4j.Logger::class,
7373
String::class,
7474
)
75+
7576
private val skipFields = setOf(
7677
Codec::class,
7778
)
7879

7980
private const val INDENT = 2
8081

81-
private val simpleMappings = runBlocking {
82-
"${LambdaAPI.mappings}/${LambdaAPI.GAME_VERSION}"
83-
.downloadIfNotPresent(cache.resolveFile("${LambdaAPI.GAME_VERSION}-simple"))
82+
private val qualifiedMappings = runBlocking {
83+
cache.resolveFile(LambdaAPI.GAME_VERSION)
84+
.downloadIfNotPresent("${LambdaAPI.mappings}/${LambdaAPI.GAME_VERSION}")
8485
.map(::buildMappingsMap)
8586
.getOrElse {
8687
LOG.error("Unable to download simplified deobfuscated qualifiers", it)
8788
emptyMap()
8889
}
8990
}
9091

91-
private val qualifiedMappings = runBlocking {
92-
"${LambdaAPI.mappings}/${LambdaAPI.GAME_VERSION}-qualified"
93-
.downloadIfNotPresent(cache.resolveFile(LambdaAPI.GAME_VERSION))
94-
.map(::buildMappingsMap)
95-
.getOrElse {
96-
LOG.error("Unable to download deobfuscated qualifiers", it)
97-
emptyMap()
98-
}
99-
}
92+
private val simpleMappings =
93+
qualifiedMappings
94+
.mapValues { (_, v) -> v.substringAfterLast('.') }
10095

10196
val String.simpleRemappedName get() = simpleMappings.getOrDefault(this, this)
10297
val String.remappedName get() = qualifiedMappings.getOrDefault(this, this)
@@ -123,7 +118,7 @@ object DynamicReflectionSerializer : Loadable {
123118
}
124119

125120
fun <T : Any> KClass<T>.dynamicName(remap: Boolean, simple: Boolean = true) =
126-
if (remap)
121+
if (remap && simple)
127122
if (simple) qualifiedName?.simpleRemappedName else qualifiedName?.remappedName
128123
else if (simple) simpleName else qualifiedName
129124

@@ -216,5 +211,5 @@ object DynamicReflectionSerializer : Loadable {
216211
}
217212
}
218213

219-
override fun load() = "Loaded ${simpleMappings.size} deobfuscated qualifier"
214+
override fun load() = "Loaded ${qualifiedMappings.size} deobfuscated qualifier"
220215
}

0 commit comments

Comments
 (0)