Files
mc_chat_answer_mod/build.gradle
Claude 939505c861 v1.3.1 — fix: declare nested fabric jars in outer fabric.mod.json
v1.3.0 의 nested fabric jar 가 실제로 로드되지 않던 버그 수정.

Fabric Loader 는 META-INF/jars/ 디렉토리를 자동 스캔하지 않고, 부모 jar 의
fabric.mod.json 에 "jars" 배열로 명시된 파일만 처리한다. v1.3.0 에선 jars
배열이 비어 있어서 outer chat_answer 컨테이너만 로드되고 (entrypoint 없으니
no-op), 실제 채팅 hook 을 담은 nested fabric jar 는 그대로 무시됐다.

수정:
  - container-resources/fabric.mod.json: "jars" 배열에 두 nested 경로 명시
  - root build.gradle: containerJar 의 nested jar 파일명을 버전 suffix 없는
    고정 이름 (chat_answer-fabric-1216.jar / -2612.jar) 으로 변경. outer
    fabric.mod.json 의 jars 항목과 일치해야 Fabric Loader 가 찾는다.

증상: 음악퀴즈 데이터팩 맵 접속 시 "모드 활성화" 메시지 안 뜸
      (ServerPlayConnectionEvents.JOIN 이 실행 안 되어 storage chat_answer:status
       active 가 0b 로 유지).
원인: 위와 같이 nested jar 가 로드 안 됨.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 02:50:25 +09:00

83 lines
3.1 KiB
Groovy

plugins {
id 'java'
}
allprojects {
apply plugin: 'java'
group = project.mod_group
version = project.mod_version
// 기본 JDK toolchain 은 Java 25 (26.x Loom 빌드 요구). subproject 가 필요하면
// 자체 release 21 등으로 다운그레이드.
java {
toolchain.languageVersion = JavaLanguageVersion.of(25)
}
tasks.withType(JavaCompile).configureEach {
options.release = 25
options.encoding = 'UTF-8'
}
repositories {
maven { url = 'https://maven.fabricmc.net/' }
maven { url = 'https://maven.neoforged.net/releases/' }
mavenCentral()
}
}
// ───── 단일 배포 jar 컨테이너 ────────────────────────────────────────────────
// 한 jar 가 어떤 환경에서도 동작하도록:
// * outer = NeoForge 1.21.6 모드 본체 (NeoForge 만 fabric.mod.json 을 무시)
// + 메타로 fabric.mod.json (entrypoint 없는 컨테이너)
// * META-INF/jars/ = Fabric 용 nested jar 둘 (1.21.6 / 26.1.2)
// Fabric Loader 가 depends.minecraft 로 자동 매칭. NeoForge 는 무시.
//
// 결과: chat_answer-<version>.jar 한 개를 Fabric 1.21.6 / Fabric 26.1.2 / NeoForge
// 1.21.6 어디에 넣어도 적절한 코드 경로가 활성화된다.
tasks.register('containerJar', Jar) {
dependsOn ':fabric-1216:remapJar',
':fabric-2612:remapJar',
':neoforge-1216:jar'
archiveBaseName = project.mod_id
archiveVersion = project.mod_version
archiveClassifier = ''
destinationDirectory = file('build/libs')
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
// 1. NeoForge 모드 본체 (classes + META-INF/neoforge.mods.toml + icon.png) 을 통째로.
// MANIFEST.MF 는 새 jar 가 자체적으로 생성하니 제외.
from(zipTree(project(':neoforge-1216').tasks.named('jar').flatMap { it.archiveFile })) {
exclude 'META-INF/MANIFEST.MF'
}
// 2. Fabric 컨테이너 메타데이터 (entrypoint 없이 그냥 "외피") 와 아이콘.
// fabric.mod.json 의 ${version} 만 치환.
filteringCharset = 'UTF-8'
from("${rootDir}/container-resources") {
filesMatching("fabric.mod.json") {
expand("version": project.mod_version)
}
}
// 3. Fabric nested jars. Fabric Loader 는 META-INF/jars/ 를 자동 스캔하지
// 않고 outer fabric.mod.json 의 "jars" 배열에 명시된 파일만 처리하므로,
// container-resources/fabric.mod.json 의 jars 항목과 일치하는 고정 파일명
// (버전 suffix 제거) 으로 넣는다.
into('META-INF/jars') {
from(project(':fabric-1216').tasks.named('remapJar').flatMap { it.archiveFile }) {
rename '.+\\.jar', 'chat_answer-fabric-1216.jar'
}
from(project(':fabric-2612').tasks.named('remapJar').flatMap { it.archiveFile }) {
rename '.+\\.jar', 'chat_answer-fabric-2612.jar'
}
}
}
tasks.register('buildAll') {
dependsOn 'containerJar'
}