Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump: inject 2.0.2 & java 21 #1

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading