update thyroxine, add user agent
Some checks failed
Publish to snapshot maven / build (push) Failing after 17s

This commit is contained in:
moehreag 2024-08-28 12:46:00 +02:00
parent 91e3bf2195
commit 8e93c7ec92
4 changed files with 16 additions and 6 deletions

View file

@ -24,7 +24,7 @@ repositories {
} }
dependencies { dependencies {
implementation("dev.frogmc:thyroxine:0.0.1-alpha.13") implementation("dev.frogmc:thyroxine:0.0.1-alpha.15")
implementation("org.ow2.asm:asm:9.7") implementation("org.ow2.asm:asm:9.7")
implementation("org.ow2.asm:asm-commons:9.7") implementation("org.ow2.asm:asm-commons:9.7")
implementation("org.ow2.asm:asm-tree:9.7") implementation("org.ow2.asm:asm-tree:9.7")

View file

@ -208,7 +208,7 @@ class PhytotelmaPlugin : Plugin<Project> {
MojmapProvider.get( MojmapProvider.get(
storage.minecraftVersion!!, storage.minecraftVersion!!,
globalCacheDir.resolve("net/minecraft/client/${storage.minecraftVersion}/client-${storage.minecraftVersion}.txt") globalCacheDir.resolve("net/minecraft/client/${storage.minecraftVersion}/client-${storage.minecraftVersion}.txt")
).orElseThrow().reverse().renameDstNamespace(Constants.MOJMAP_NAMESPACE) ).reverse().renameDstNamespace(Constants.MOJMAP_NAMESPACE)
} else null } else null
val mappings = (moj?.let { val mappings = (moj?.let {
MappingBundle.merge( MappingBundle.merge(
@ -325,7 +325,7 @@ class PhytotelmaPlugin : Plugin<Project> {
val mojOfficial = MojmapProvider.get( val mojOfficial = MojmapProvider.get(
storage.minecraftVersion!!, storage.minecraftVersion!!,
globalCacheDir.resolve("net/minecraft/client/${storage.minecraftVersion}/client-${storage.minecraftVersion}.txt") globalCacheDir.resolve("net/minecraft/client/${storage.minecraftVersion}/client-${storage.minecraftVersion}.txt")
).orElseThrow().reverse().renameDstNamespace(Constants.MOJMAP_NAMESPACE).data[0].reverse() ).reverse().renameDstNamespace(Constants.MOJMAP_NAMESPACE).data[0].reverse()
val targetPath = project.layout.buildDirectory.asFile.get().toPath().resolve("remappedMods") val targetPath = project.layout.buildDirectory.asFile.get().toPath().resolve("remappedMods")
.resolve("dev/frogmc/phytotelma/remapped_mods") .resolve("dev/frogmc/phytotelma/remapped_mods")
val remappedPaths = mutableListOf<Path>() val remappedPaths = mutableListOf<Path>()

View file

@ -3,6 +3,9 @@ package dev.frogmc.phytotelma.common
import dev.frogmc.phytotelma.PhytotelmaPlugin import dev.frogmc.phytotelma.PhytotelmaPlugin
import java.io.InputStream import java.io.InputStream
import java.net.URI import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse.BodyHandlers
import java.nio.charset.StandardCharsets import java.nio.charset.StandardCharsets
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Path import java.nio.file.Path
@ -36,7 +39,14 @@ object CachingHttpClient {
} }
fun getUncached(uri: URI): InputStream { fun getUncached(uri: URI): InputStream {
return uri.toURL().openStream() HttpClient.newHttpClient().use {
return it.send(
HttpRequest.newBuilder().uri(uri).header(
"User-Agent",
"FrogMC Phytotelma/" + CachingHttpClient.javaClass.`package`.implementationVersion
).build(), BodyHandlers.ofInputStream()
).body()
}
} }
private fun getCacheFile(uri: URI): Path { private fun getCacheFile(uri: URI): Path {

View file

@ -52,7 +52,7 @@ abstract class MinecraftConfiguration @Inject constructor(
MojmapProvider.get( MojmapProvider.get(
version.get(), version.get(),
cacheDir.resolve("net/minecraft/client/${version.get()}/client-${version.get()}.txt") cacheDir.resolve("net/minecraft/client/${version.get()}/client-${version.get()}.txt")
).orElseThrow().reverse(), ).reverse(),
ParchmentProvider.getParchment( ParchmentProvider.getParchment(
version.get(), version.get(),
cacheDir.resolve("org/parchmentmc/parchment/${conf.gameVersion.get()}/${conf.version.get()}") cacheDir.resolve("org/parchmentmc/parchment/${conf.gameVersion.get()}/${conf.version.get()}")
@ -87,7 +87,7 @@ abstract class MinecraftConfiguration @Inject constructor(
return@provider MojmapProvider.get( return@provider MojmapProvider.get(
version.get(), version.get(),
cacheDir.resolve("net/minecraft/client/${version.get()}/client-${version.get()}.txt") cacheDir.resolve("net/minecraft/client/${version.get()}/client-${version.get()}.txt")
).orElseThrow().reverse().renameDstNamespace(targetNamespace) ).reverse().renameDstNamespace(targetNamespace)
} }
} }