plugins { id 'java' id("com.gradleup.shadow") version "9.6.1" } group = 'cn.xiaozhou233.orangex' version = 'unspecified' repositories { mavenCentral() } dependencies { // Source: https://mvnrepository.com/artifact/org.projectlombok/lombok compileOnly 'org.projectlombok:lombok:1.18.48' annotationProcessor 'org.projectlombok:lombok:1.18.48' // Source: https://mvnrepository.com/artifact/com.google.code.gson/gson implementation 'com.google.code.gson:gson:2.15.0' // Source: https://mvnrepository.com/artifact/org.javassist/javassist implementation 'org.javassist:javassist:3.33.0-GA' // Source: https://mvnrepository.com/artifact/org.greenrobot/eventbus implementation 'org.greenrobot:eventbus:3.2.0' // Legacy OpenGL entry points for the 1.8.9 font backend. This is compile // only: the 1.8.9 runtime provides its own LWJGL 2, and the 26.2 backend // never loads these classes. compileOnly files('../libraries/lwjgl-2.9.4-nightly-20150209.jar') compileOnly files("../libraries/minecraft/Minecraft26.2.jar") compileOnly files("../libraries/minecraft/com/mojang/brigadier/1.3.10/brigadier-1.3.10.jar") // JuiceAgent is provided at runtime by the agent (see JuiceAgentBridge). // Do NOT bundle it: Fabric's KnotClassLoader would load a second copy of // the API whose native methods are not registered. } // The 26.2 input classes import game classes that are records / class-file // version 69, so they cannot be compiled with --release 8. Keep them in a // separate source set compiled by JDK 25, but still emit Java 8 bytecode so a // 1.8.9 JVM can load the rest of the jar. sourceSets { main { java { exclude 'cn/xiaozhou233/orangex/input/v26_2/**' } } v26_2 { java { srcDir 'src/main/java' include 'cn/xiaozhou233/orangex/input/v26_2/**' } compileClasspath += sourceSets.main.output compileClasspath += configurations.compileClasspath } } tasks.named('compileV26_2Java', JavaCompile).configure { javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(25) } // No --release: the JDK 25 platform classpath is needed to resolve records // from Minecraft26.2.jar, while -source/-target 8 keeps the output loadable // by Java 8. options.release = null options.encoding = 'UTF-8' } tasks.named('shadowJar') { destinationDirectory = rootProject.layout.projectDirectory.dir('out/tmp') archiveFileName = "${project.name}.jar" dependsOn tasks.named('v26_2Classes') from sourceSets.v26_2.output } shadowJar { relocate 'com.google.gson', 'cn.xiaozhou233.orangex.shaded.gson' // Javassist must live in OrangeX's own namespace: Forge's // LaunchClassLoader delegates the "javassist." package to its parent, // which cannot see the injected jar. relocate 'javassist', 'cn.xiaozhou233.orangex.shaded.javassist' relocate 'org.greenrobot.eventbus', 'cn.xiaozhou233.orangex.shaded.eventbus' }