2 Commits

Author SHA1 Message Date
Claude
d1c6504973 v1.3.2 — verbose logging to diagnose missing active=1b write
증상: chat_answer:status active 가 0b 그대로 → 데이터팩 login 메시지 안 뜸.
mq:load 는 정상 작동(0b 초기화 됨)인데 모드의 onPlayerJoin 이 1b 로 안 씀.

추가 로그:
  - ChatAnswerFabric.onInitialize: 진입/완료, event register 예외시 ERROR
  - ChatAnswerCore.onPlayerJoin: 진입 (player 이름 포함), 성공 시 INFO,
    실패 catch 를 LOG.debug → LOG.warn 으로 승격해 latest.log 에 보이게.

이 로그를 보고 다음 중 어디서 깨지는지 좁힐 수 있음:
  - "Fabric entrypoint onInitialize starting" 안 보임 → nested jar 미로드
  - "onInitialize starting" 보이고 "registered" 안 보임 → fabric-api ABI mismatch
  - "onPlayerJoin fired" 안 보임 → JOIN 이벤트 미발화
  - "active=1b set" 안 보이고 "failed" 만 보임 → command 실행 실패

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 03:02:00 +09:00
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
6 changed files with 57 additions and 19 deletions

View File

@@ -63,11 +63,17 @@ tasks.register('containerJar', Jar) {
} }
} }
// 3. Fabric nested jars (Fabric Loader META-INF/jars/ 를 스캔해서 // 3. Fabric nested jars. Fabric Loader META-INF/jars/ 를 자동 스캔하지
// depends.minecraft 매칭되는 jar 만 활성화). // 않고 outer fabric.mod.json 의 "jars" 배열에 명시된 파일만 처리하므로,
// container-resources/fabric.mod.json 의 jars 항목과 일치하는 고정 파일명
// (버전 suffix 제거) 으로 넣는다.
into('META-INF/jars') { into('META-INF/jars') {
from project(':fabric-1216').tasks.named('remapJar').flatMap { it.archiveFile } from(project(':fabric-1216').tasks.named('remapJar').flatMap { it.archiveFile }) {
from project(':fabric-2612').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'
}
} }
} }

View File

@@ -38,16 +38,22 @@ public final class ChatAnswerCore {
* 호출이 일어나지 않아 0b 로 유지되고, 모드가 있으면 첫 로그인 직후 1b 로 갱신. * 호출이 일어나지 않아 0b 로 유지되고, 모드가 있으면 첫 로그인 직후 1b 로 갱신.
*/ */
public static void onPlayerJoin(ServerPlayer player) { public static void onPlayerJoin(ServerPlayer player) {
String name = player.getName().getString();
LOG.info("[{}] onPlayerJoin fired for {}", MOD_ID, name);
MinecraftServer server = player.level().getServer(); MinecraftServer server = player.level().getServer();
if (server == null) return; if (server == null) {
LOG.warn("[{}] onPlayerJoin: server is null, skipping active-flag set for {}", MOD_ID, name);
return;
}
CommandSourceStack source = server.createCommandSourceStack().withSuppressedOutput(); CommandSourceStack source = server.createCommandSourceStack().withSuppressedOutput();
try { try {
server.getCommands().performPrefixedCommand( server.getCommands().performPrefixedCommand(
source, source,
"data modify storage chat_answer:status active set value 1b" "data modify storage chat_answer:status active set value 1b"
); );
LOG.info("[{}] active=1b set after {} joined", MOD_ID, name);
} catch (Exception e) { } catch (Exception e) {
LOG.debug("[{}] failed to set active flag: {}", MOD_ID, e.toString()); LOG.warn("[{}] failed to set active flag for {}: {}", MOD_ID, name, e.toString(), e);
} }
} }

View File

@@ -8,6 +8,10 @@
"license": "MIT", "license": "MIT",
"icon": "assets/chat_answer/icon.png", "icon": "assets/chat_answer/icon.png",
"environment": "*", "environment": "*",
"jars": [
{ "file": "META-INF/jars/chat_answer-fabric-1216.jar" },
{ "file": "META-INF/jars/chat_answer-fabric-2612.jar" }
],
"depends": { "depends": {
"fabricloader": ">=0.16.0", "fabricloader": ">=0.16.0",
"java": ">=21" "java": ">=21"

View File

@@ -4,15 +4,26 @@ import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents; import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class ChatAnswerFabric implements ModInitializer { public final class ChatAnswerFabric implements ModInitializer {
private static final Logger LOG = LoggerFactory.getLogger(ChatAnswerCore.MOD_ID);
@Override @Override
public void onInitialize() { public void onInitialize() {
LOG.info("[{}] Fabric entrypoint onInitialize starting", ChatAnswerCore.MOD_ID);
try {
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) -> ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
ChatAnswerCore.handleChat(sender, message.signedContent()) ChatAnswerCore.handleChat(sender, message.signedContent())
); );
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
ChatAnswerCore.onPlayerJoin(handler.player) ChatAnswerCore.onPlayerJoin(handler.player)
); );
LOG.info("[{}] Fabric entrypoint registered: ALLOW_CHAT_MESSAGE + JOIN", ChatAnswerCore.MOD_ID);
} catch (Throwable t) {
LOG.error("[{}] Fabric entrypoint event registration failed", ChatAnswerCore.MOD_ID, t);
throw t;
}
} }
} }

View File

@@ -4,15 +4,26 @@ import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
import net.fabricmc.api.ModInitializer; import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents; import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents; import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public final class ChatAnswerFabric implements ModInitializer { public final class ChatAnswerFabric implements ModInitializer {
private static final Logger LOG = LoggerFactory.getLogger(ChatAnswerCore.MOD_ID);
@Override @Override
public void onInitialize() { public void onInitialize() {
LOG.info("[{}] Fabric entrypoint onInitialize starting", ChatAnswerCore.MOD_ID);
try {
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) -> ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
ChatAnswerCore.handleChat(sender, message.signedContent()) ChatAnswerCore.handleChat(sender, message.signedContent())
); );
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) -> ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
ChatAnswerCore.onPlayerJoin(handler.player) ChatAnswerCore.onPlayerJoin(handler.player)
); );
LOG.info("[{}] Fabric entrypoint registered: ALLOW_CHAT_MESSAGE + JOIN", ChatAnswerCore.MOD_ID);
} catch (Throwable t) {
LOG.error("[{}] Fabric entrypoint event registration failed", ChatAnswerCore.MOD_ID, t);
throw t;
}
} }
} }

View File

@@ -3,7 +3,7 @@ org.gradle.parallel=true
# ───── mod metadata ───────────────────────────────────────────────────────── # ───── mod metadata ─────────────────────────────────────────────────────────
mod_id=chat_answer mod_id=chat_answer
mod_version=1.3.0 mod_version=1.3.2
mod_group=kr.tkrmagid.chatanswer mod_group=kr.tkrmagid.chatanswer
mod_name=채팅정답 mod_name=채팅정답