diff --git a/build.gradle b/build.gradle index 04aabb3..b740e18 100644 --- a/build.gradle +++ b/build.gradle @@ -26,7 +26,8 @@ dependencies { modImplementation "net.fabricmc:fabric-language-kotlin:$fabric_kotlin_version" include modImplementation ("com.github.yundom:kache:$kache_version") - include modImplementation ("net.mcbrawls:inject:$inject_version") + include modImplementation ("net.mcbrawls.inject:api:$inject_version") + include modImplementation ("net.mcbrawls.inject:fabric:$inject_version") } sourceSets { @@ -55,12 +56,12 @@ processResources { } tasks.withType(JavaCompile).configureEach { - it.options.release = 17 + it.options.release = 21 } tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all { kotlinOptions { - jvmTarget = 17 + jvmTarget = 21 } } diff --git a/gradle.properties b/gradle.properties index 6705436..ce4232a 100644 --- a/gradle.properties +++ b/gradle.properties @@ -10,8 +10,8 @@ loader_version=0.16.7 fabric_version=0.106.0+1.21.1 fabric_kotlin_version=1.10.20+kotlin.1.9.24 kache_version=1.0.5 -inject_version=1.3.1 +inject_version=2.0.2 # Mod Properties -mod_version=2.13.2 +mod_version=2.13.3 maven_group=dev.andante diff --git a/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt b/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt index 7c03ab1..42bd227 100644 --- a/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt +++ b/src/main/kotlin/dev/andante/audience/AudienceInitializer.kt @@ -3,6 +3,7 @@ package dev.andante.audience import dev.andante.audience.resource.ResourcePackHandler import net.fabricmc.api.ModInitializer import net.fabricmc.fabric.api.event.lifecycle.v1.ServerLifecycleEvents +import net.mcbrawls.inject.fabric.InjectFabric import net.minecraft.server.MinecraftServer object AudienceInitializer : ModInitializer { @@ -17,6 +18,6 @@ object AudienceInitializer : ModInitializer { // register event to capture server ServerLifecycleEvents.SERVER_STARTING.register { _minecraftServer = it } - ResourcePackHandler.register() + InjectFabric.INSTANCE.registerInjector(ResourcePackHandler) } } diff --git a/src/main/kotlin/dev/andante/audience/resource/ResourcePackHandler.kt b/src/main/kotlin/dev/andante/audience/resource/ResourcePackHandler.kt index 97c2546..e6c0290 100644 --- a/src/main/kotlin/dev/andante/audience/resource/ResourcePackHandler.kt +++ b/src/main/kotlin/dev/andante/audience/resource/ResourcePackHandler.kt @@ -1,16 +1,16 @@ package dev.andante.audience.resource import io.netty.channel.ChannelHandlerContext -import net.mcbrawls.inject.http.HttpByteBuf -import net.mcbrawls.inject.http.HttpInjector -import net.mcbrawls.inject.http.HttpRequest -import net.mcbrawls.inject.http.httpBuffer +import net.mcbrawls.inject.api.http.HttpByteBuf +import net.mcbrawls.inject.api.http.HttpByteBuf.httpBuf +import net.mcbrawls.inject.api.http.HttpInjector +import net.mcbrawls.inject.api.http.HttpRequest object ResourcePackHandler : HttpInjector() { private val resourcePacks: MutableMap = mutableMapOf() override fun intercept(ctx: ChannelHandlerContext, request: HttpRequest): HttpByteBuf { - val response = ctx.httpBuffer() + val response = httpBuf(ctx) val path = request.requestURI.removePrefix("/") val pack = resourcePacks[path] ?: return response