Skip to content

Commit

Permalink
bump: inject 2.0.2 & java 21 (#1)
Browse files Browse the repository at this point in the history
* bump: inject 2.0.2 & java 21

* bump: bump version
  • Loading branch information
radstevee authored Oct 31, 2024
1 parent 322b050 commit 53d8378
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
7 changes: 4 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
}

Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion src/main/kotlin/dev/andante/audience/AudienceInitializer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -17,6 +18,6 @@ object AudienceInitializer : ModInitializer {
// register event to capture server
ServerLifecycleEvents.SERVER_STARTING.register { _minecraftServer = it }

ResourcePackHandler.register()
InjectFabric.INSTANCE.registerInjector(ResourcePackHandler)
}
}
Original file line number Diff line number Diff line change
@@ -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<String, ByteArray> = 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
Expand Down

0 comments on commit 53d8378

Please sign in to comment.