Remove reflection from BauSystem

This commit is contained in:
2026-06-11 13:45:49 +02:00
parent 961331f029
commit eb866125ea
6 changed files with 62 additions and 20 deletions
+44
View File
@@ -30,6 +30,45 @@ java {
targetCompatibility = JavaVersion.VERSION_21
}
// ─── Collect all .accesswidener files from this plugin's resources ────────────
val accessWidenerFiles: FileCollection = fileTree("src/") {
include("**/*.accesswidener")
}
val paperJarProvider: Provider<File> = provider {
val dep = libs.nms.get()
configurations["compileClasspath"].resolvedConfiguration.resolvedArtifacts.first { artifact ->
artifact.moduleVersion.id.module.group == dep.module.group && artifact.moduleVersion.id.module.name == dep.module.name
}.file
}
// ─── Widen the Paper dev JAR so the IDE / javac see the patched access ────────
val widenedJar by tasks.registering(JavaExec::class) {
description = "Produces a widened copy of the Paper dev JAR for compile-time use."
group = "widener"
// Re-run whenever the .accesswidener files change
inputs.file(paperJarProvider)
inputs.files(accessWidenerFiles)
val output = layout.buildDirectory.file("widened/paper-widened.jar")
outputs.file(output)
classpath = project(":AccessWidener").tasks.named<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar>("shadowJar").get().outputs.files
mainClass.set("de.steamwar.Main")
doFirst {
args = buildList {
add(paperJarProvider.get().absolutePath)
add(output.get().asFile.absolutePath)
addAll(accessWidenerFiles.map { it.absolutePath })
}
}
dependsOn(":AccessWidener:shadowJar")
}
dependencies {
compileOnly(libs.classindex)
annotationProcessor(libs.classindex)
@@ -40,6 +79,7 @@ dependencies {
compileOnly(libs.paperapi)
compileOnly(libs.nms)
compileOnly(files(widenedJar))
compileOnly(libs.fawe)
compileOnly(libs.netty)
@@ -47,3 +87,7 @@ dependencies {
implementation(libs.luaj)
implementation(files("$projectDir/../libs/YAPION-SNAPSHOT.jar"))
}
tasks.compileJava {
dependsOn(widenedJar)
}