Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f989ee135 | ||
|
|
a67ec47f89 | ||
|
|
d1c6504973 | ||
|
|
939505c861 | ||
|
|
e01137ee31 | ||
|
|
785efe24b9 |
58
build.gradle
58
build.gradle
@@ -8,6 +8,8 @@ allprojects {
|
||||
group = project.mod_group
|
||||
version = project.mod_version
|
||||
|
||||
// 기본 JDK toolchain 은 Java 25 (26.x Loom 빌드 요구). subproject 가 필요하면
|
||||
// 자체 release 21 등으로 다운그레이드.
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(25)
|
||||
}
|
||||
@@ -24,7 +26,57 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
// MC 26.1.2 배포물은 Fabric jar 단일 빌드. buildAll = fabric remapJar 결과물.
|
||||
tasks.register('buildAll') {
|
||||
dependsOn ':fabric:remapJar'
|
||||
// ───── 단일 배포 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'
|
||||
}
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
package kr.tkrmagid.chatanswer.core;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
@@ -29,25 +33,55 @@ public final class ChatAnswerCore {
|
||||
private static final String SCOREBOARD_HOLDER = "init";
|
||||
private static final int ACCEPTING_ANSWER_STATE = 5;
|
||||
|
||||
/** JOIN 이벤트 시점엔 클라이언트가 chat HUD 를 받을 준비가 안 됐을 수 있어
|
||||
* tellraw 패킷이 사라지는 경우가 있다. 그래서 N 틱 늦춰서 호출한다. */
|
||||
private static final int NOTICE_DELAY_TICKS = 20;
|
||||
private static final Map<UUID, Integer> PENDING_NOTICES = new ConcurrentHashMap<>();
|
||||
|
||||
private ChatAnswerCore() {}
|
||||
|
||||
/**
|
||||
* 플레이어 로그인 직후 호출. 데이터팩이 "모드 살아있음" 신호로 쓸 수 있게
|
||||
* storage chat_answer:status 에 active=1b 를 세팅한다. 데이터팩의 mq:load 가
|
||||
* 매 /reload 와 서버 시작 시 이 값을 0b 로 clear 하므로, 모드가 없으면 이
|
||||
* 호출이 일어나지 않아 0b 로 유지되고, 모드가 있으면 첫 로그인 직후 1b 로 갱신.
|
||||
* 플레이어 로그인 시점에 호출. 음악퀴즈 데이터팩의
|
||||
* mq:players/mod_active_notice
|
||||
* 함수를 해당 플레이어 컨텍스트로 호출한다. 단, JOIN 이벤트가 너무 일러서
|
||||
* 즉시 호출 시 tellraw 가 클라이언트에 도달하지 못하는 race 가 있어
|
||||
* {@link #NOTICE_DELAY_TICKS} 만큼 늦춘다 ({@link #onServerTick} 가 처리).
|
||||
*/
|
||||
public static void onPlayerJoin(ServerPlayer player) {
|
||||
MinecraftServer server = player.level().getServer();
|
||||
if (server == null) return;
|
||||
CommandSourceStack source = server.createCommandSourceStack().withSuppressedOutput();
|
||||
String name = player.getName().getString();
|
||||
LOG.info("[{}] onPlayerJoin fired for {}, scheduling notice in {} ticks",
|
||||
MOD_ID, name, NOTICE_DELAY_TICKS);
|
||||
PENDING_NOTICES.put(player.getUUID(), NOTICE_DELAY_TICKS);
|
||||
}
|
||||
|
||||
/** 각 로더 entrypoint 가 매 server tick 마다 호출해야 한다. */
|
||||
public static void onServerTick(MinecraftServer server) {
|
||||
if (PENDING_NOTICES.isEmpty()) return;
|
||||
Iterator<Map.Entry<UUID, Integer>> it = PENDING_NOTICES.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry<UUID, Integer> e = it.next();
|
||||
int remaining = e.getValue() - 1;
|
||||
if (remaining > 0) {
|
||||
e.setValue(remaining);
|
||||
continue;
|
||||
}
|
||||
UUID uuid = e.getKey();
|
||||
it.remove();
|
||||
ServerPlayer player = server.getPlayerList().getPlayer(uuid);
|
||||
if (player == null) continue;
|
||||
deliverNotice(server, player);
|
||||
}
|
||||
}
|
||||
|
||||
private static void deliverNotice(MinecraftServer server, ServerPlayer player) {
|
||||
String name = player.getName().getString();
|
||||
// 플레이어 자체를 source 로 써서 함수 안의 @s 가 그대로 player.
|
||||
CommandSourceStack source = player.createCommandSourceStack().withSuppressedOutput();
|
||||
try {
|
||||
server.getCommands().performPrefixedCommand(
|
||||
source,
|
||||
"data modify storage chat_answer:status active set value 1b"
|
||||
);
|
||||
server.getCommands().performPrefixedCommand(source, "function mq:players/mod_active_notice");
|
||||
LOG.info("[{}] mod_active_notice delivered for {}", MOD_ID, name);
|
||||
} catch (Exception e) {
|
||||
LOG.debug("[{}] failed to set active flag: {}", MOD_ID, e.toString());
|
||||
LOG.warn("[{}] failed to deliver mod_active_notice for {}: {}", MOD_ID, name, e.toString(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
BIN
container-resources/assets/chat_answer/icon.png
Normal file
BIN
container-resources/assets/chat_answer/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
19
container-resources/fabric.mod.json
Normal file
19
container-resources/fabric.mod.json
Normal file
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "chat_answer",
|
||||
"version": "${version}",
|
||||
"name": "채팅정답",
|
||||
"description": "음악퀴즈(mq) 데이터팩이 정답 입력을 받는 상태(init=5)에서 채팅을 가로채 mq:answer/submit 함수로 전달합니다. 단일 jar 에 1.21.6 (Fabric/NeoForge) + 26.1.2 (Fabric) 빌드가 모두 들어있어 어느 환경에서도 그대로 동작합니다.",
|
||||
"authors": [ "tkrmagid" ],
|
||||
"license": "MIT",
|
||||
"icon": "assets/chat_answer/icon.png",
|
||||
"environment": "*",
|
||||
"jars": [
|
||||
{ "file": "META-INF/jars/chat_answer-fabric-1216.jar" },
|
||||
{ "file": "META-INF/jars/chat_answer-fabric-2612.jar" }
|
||||
],
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16.0",
|
||||
"java": ">=21"
|
||||
}
|
||||
}
|
||||
53
fabric-1216/build.gradle
Normal file
53
fabric-1216/build.gradle
Normal file
@@ -0,0 +1,53 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.16-SNAPSHOT'
|
||||
}
|
||||
|
||||
base.archivesName = "${project.mod_id}-fabric-1216"
|
||||
|
||||
// 1.21.6 은 Java 21 런타임. release 21 로 컴파일.
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(25)
|
||||
}
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.release = 21
|
||||
}
|
||||
|
||||
// common/ 디렉토리의 로더 비종속 소스 포함. Mojang 매핑으로 컴파일됨.
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs += "${rootDir}/common/src/main/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
minecraft "com.mojang:minecraft:${project.mc_1216}"
|
||||
mappings loom.officialMojangMappings()
|
||||
modImplementation "net.fabricmc:fabric-loader:${project.fabric_loader_1216}"
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_1216}"
|
||||
}
|
||||
|
||||
loom {
|
||||
serverOnlyMinecraftJar()
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mod_id", project.mod_id
|
||||
|
||||
filteringCharset = 'UTF-8'
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(
|
||||
"version": project.version,
|
||||
"mod_id": project.mod_id
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${project.mod_id}_fabric_1216" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package kr.tkrmagid.chatanswer.fabric;
|
||||
|
||||
import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class ChatAnswerFabric implements ModInitializer {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatAnswerCore.MOD_ID);
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
LOG.info("[{}] Fabric entrypoint onInitialize starting", ChatAnswerCore.MOD_ID);
|
||||
try {
|
||||
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
||||
ChatAnswerCore.handleChat(sender, message.signedContent())
|
||||
);
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
||||
ChatAnswerCore.onPlayerJoin(handler.player)
|
||||
);
|
||||
ServerTickEvents.END_SERVER_TICK.register(ChatAnswerCore::onServerTick);
|
||||
LOG.info("[{}] Fabric entrypoint registered: ALLOW_CHAT_MESSAGE + JOIN + TICK", ChatAnswerCore.MOD_ID);
|
||||
} catch (Throwable t) {
|
||||
LOG.error("[{}] Fabric entrypoint event registration failed", ChatAnswerCore.MOD_ID, t);
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
fabric-1216/src/main/resources/assets/chat_answer/icon.png
Normal file
BIN
fabric-1216/src/main/resources/assets/chat_answer/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
20
fabric-1216/src/main/resources/fabric.mod.json
Normal file
20
fabric-1216/src/main/resources/fabric.mod.json
Normal file
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "chat_answer_fabric",
|
||||
"version": "${version}",
|
||||
"name": "채팅정답 (Fabric impl)",
|
||||
"description": "음악퀴즈(mq) 데이터팩이 정답 입력을 받는 상태(init=5)에서 채팅을 가로채 mq:answer/submit 함수로 전달합니다. (MC 1.21.6 변형)",
|
||||
"authors": [ "tkrmagid" ],
|
||||
"license": "MIT",
|
||||
"icon": "assets/chat_answer/icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [ "kr.tkrmagid.chatanswer.fabric.ChatAnswerFabric" ]
|
||||
},
|
||||
"depends": {
|
||||
"fabricloader": ">=0.16.0",
|
||||
"minecraft": ">=1.21.6 <1.22",
|
||||
"java": ">=21",
|
||||
"fabric-api": "*"
|
||||
}
|
||||
}
|
||||
42
fabric-2612/build.gradle
Normal file
42
fabric-2612/build.gradle
Normal file
@@ -0,0 +1,42 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.16-SNAPSHOT'
|
||||
}
|
||||
|
||||
base.archivesName = "${project.mod_id}-fabric-2612"
|
||||
|
||||
// common/ 디렉토리의 로더 비종속 소스 포함.
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs += "${rootDir}/common/src/main/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// MC 26.x: server jar 가 unobfuscated. intermediary 0.0.0 = identity mapping.
|
||||
minecraft "com.mojang:minecraft:${project.mc_2612}"
|
||||
mappings "net.fabricmc:intermediary:0.0.0:v2"
|
||||
implementation "net.fabricmc:fabric-loader:${project.fabric_loader_2612}"
|
||||
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_api_2612}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mod_id", project.mod_id
|
||||
|
||||
filteringCharset = 'UTF-8'
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(
|
||||
"version": project.version,
|
||||
"mod_id": project.mod_id
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${project.mod_id}_fabric_2612" }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package kr.tkrmagid.chatanswer.fabric;
|
||||
|
||||
import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public final class ChatAnswerFabric implements ModInitializer {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ChatAnswerCore.MOD_ID);
|
||||
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
LOG.info("[{}] Fabric entrypoint onInitialize starting", ChatAnswerCore.MOD_ID);
|
||||
try {
|
||||
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
||||
ChatAnswerCore.handleChat(sender, message.signedContent())
|
||||
);
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
||||
ChatAnswerCore.onPlayerJoin(handler.player)
|
||||
);
|
||||
ServerTickEvents.END_SERVER_TICK.register(ChatAnswerCore::onServerTick);
|
||||
LOG.info("[{}] Fabric entrypoint registered: ALLOW_CHAT_MESSAGE + JOIN + TICK", ChatAnswerCore.MOD_ID);
|
||||
} catch (Throwable t) {
|
||||
LOG.error("[{}] Fabric entrypoint event registration failed", ChatAnswerCore.MOD_ID, t);
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
fabric-2612/src/main/resources/assets/chat_answer/icon.png
Normal file
BIN
fabric-2612/src/main/resources/assets/chat_answer/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -1,14 +1,12 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"id": "${mod_id}",
|
||||
"id": "chat_answer_fabric",
|
||||
"version": "${version}",
|
||||
"name": "채팅정답",
|
||||
"description": "음악퀴즈(mq) 데이터팩이 정답 입력을 받는 상태(init=5)에서 채팅을 가로채 mq:answer/submit 함수로 전달합니다.",
|
||||
"name": "채팅정답 (Fabric impl)",
|
||||
"description": "음악퀴즈(mq) 데이터팩이 정답 입력을 받는 상태(init=5)에서 채팅을 가로채 mq:answer/submit 함수로 전달합니다. (MC 26.1.2 변형)",
|
||||
"authors": [ "tkrmagid" ],
|
||||
"contact": {
|
||||
"homepage": "https://git.tkrmagid.kr/tkrmagid/mc_chat_answer_mod"
|
||||
},
|
||||
"license": "MIT",
|
||||
"icon": "assets/chat_answer/icon.png",
|
||||
"environment": "*",
|
||||
"entrypoints": {
|
||||
"main": [ "kr.tkrmagid.chatanswer.fabric.ChatAnswerFabric" ]
|
||||
@@ -1,70 +0,0 @@
|
||||
plugins {
|
||||
id 'fabric-loom' version '1.16-SNAPSHOT'
|
||||
id 'com.gradleup.shadow' version '9.4.1'
|
||||
}
|
||||
|
||||
base.archivesName = "${project.mod_id}-fabric"
|
||||
|
||||
// common/ 디렉토리의 로더 비종속 소스를 fabric 컴파일에 포함 (Mojang 매핑으로 컴파일)
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs += "${rootDir}/common/src/main/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
// MC 26.x: server jar 가 unobfuscated. intermediary 0.0.0 = identity mapping.
|
||||
minecraft "com.mojang:minecraft:${project.minecraft_version}"
|
||||
mappings "net.fabricmc:intermediary:0.0.0:v2"
|
||||
implementation "net.fabricmc:fabric-loader:${project.loader_version}"
|
||||
implementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mod_id", project.mod_id
|
||||
inputs.property "mod_name", project.mod_name
|
||||
|
||||
filteringCharset = 'UTF-8'
|
||||
|
||||
filesMatching("fabric.mod.json") {
|
||||
expand(
|
||||
"version": project.version,
|
||||
"mod_id": project.mod_id,
|
||||
"mod_name": project.mod_name
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${project.mod_id}" }
|
||||
}
|
||||
}
|
||||
|
||||
// ───── relocation for single-jar merge ─────────────────────────────────────
|
||||
// Fabric 의 common 코드는 intermediary 매핑으로 컴파일되고, NeoForge 의 common
|
||||
// 코드는 Mojang 매핑으로 컴파일된다. 둘은 바이트코드가 달라서 같은 클래스 경로에
|
||||
// 공존 불가. Shadow 의 relocate 로 Fabric 쪽 common 클래스만 별도 패키지로 옮겨서
|
||||
// merged jar 안에서 충돌하지 않게 한다.
|
||||
//
|
||||
// 진행 순서: loom 의 remapJar 결과 → shadowJar 가 받아서 패키지 재배치 →
|
||||
// rootProject 의 mergedJar 가 이걸 사용.
|
||||
|
||||
// Shadow 가 자동으로 만든 shadowJar 는 main sourceSet + 런타임 classpath 를 전부
|
||||
// 포함해서 100MB+ 가 되어버린다. 우리한테 필요한 건 "remapJar 결과물에 relocate 만
|
||||
// 적용한 작은 jar" 이므로, 별도 ShadowJar 태스크를 새로 만들어서 입력을 명시적으로
|
||||
// remapJar 의 zipTree 만 지정한다.
|
||||
tasks.register('relocatedJar', com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar) {
|
||||
dependsOn 'remapJar'
|
||||
archiveClassifier = 'relocated'
|
||||
from zipTree(tasks.named('remapJar').flatMap { it.archiveFile })
|
||||
relocate 'kr.tkrmagid.chatanswer.core', 'kr.tkrmagid.chatanswer.fabric.core'
|
||||
mergeServiceFiles()
|
||||
}
|
||||
|
||||
tasks.named('build') {
|
||||
dependsOn 'relocatedJar'
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
package kr.tkrmagid.chatanswer.fabric;
|
||||
|
||||
import kr.tkrmagid.chatanswer.core.ChatAnswerCore;
|
||||
import net.fabricmc.api.ModInitializer;
|
||||
import net.fabricmc.fabric.api.message.v1.ServerMessageEvents;
|
||||
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
|
||||
|
||||
public final class ChatAnswerFabric implements ModInitializer {
|
||||
@Override
|
||||
public void onInitialize() {
|
||||
ServerMessageEvents.ALLOW_CHAT_MESSAGE.register((message, sender, params) ->
|
||||
ChatAnswerCore.handleChat(sender, message.signedContent())
|
||||
);
|
||||
ServerPlayConnectionEvents.JOIN.register((handler, sender, server) ->
|
||||
ChatAnswerCore.onPlayerJoin(handler.player)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,20 +1,26 @@
|
||||
org.gradle.jvmargs=-Xmx3G
|
||||
org.gradle.parallel=true
|
||||
|
||||
# ───── target Minecraft / loader versions ───────────────────────────────────
|
||||
# MC 26.1.2 = 사용자 환경. 1.21.6 과는 intermediary 매핑이 달라서 동일 jar 로 양쪽
|
||||
# 지원 불가 → 26.1.2 전용 빌드.
|
||||
minecraft_version=26.1.2
|
||||
|
||||
# Fabric
|
||||
loader_version=0.19.2
|
||||
fabric_version=0.148.2+26.1.2
|
||||
|
||||
# NeoForge
|
||||
neoforge_version=26.1.2.36-beta
|
||||
|
||||
# ───── mod metadata ─────────────────────────────────────────────────────────
|
||||
mod_id=chat_answer
|
||||
mod_version=1.2.0
|
||||
mod_version=1.3.4
|
||||
mod_group=kr.tkrmagid.chatanswer
|
||||
mod_name=채팅정답
|
||||
|
||||
# ───── per-target MC / loader versions ──────────────────────────────────────
|
||||
# 한 jar 로 1.21.6 (Fabric/NeoForge) + 26.1.2 (Fabric) 전부 커버하기 위해
|
||||
# 각 타겟마다 별도 subproject 가 자기 버전으로 빌드되고, 결과물을 outer
|
||||
# container jar 가 묶는다 (Fabric 은 META-INF/jars/ JiJ, NeoForge 는 outer 본체).
|
||||
|
||||
# Fabric MC 1.21.6
|
||||
mc_1216=1.21.6
|
||||
fabric_api_1216=0.128.2+1.21.6
|
||||
fabric_loader_1216=0.16.10
|
||||
|
||||
# Fabric MC 26.1.2 (26.x 서버 jar 는 unobfuscated. intermediary 0.0.0 = identity)
|
||||
mc_2612=26.1.2
|
||||
fabric_api_2612=0.148.2+26.1.2
|
||||
fabric_loader_2612=0.19.2
|
||||
|
||||
# NeoForge MC 1.21.6 (26.x 는 NeoForge moddev plugin 이 아직 인식 못 함)
|
||||
neoforge_1216=21.6.20-beta
|
||||
|
||||
49
neoforge-1216/build.gradle
Normal file
49
neoforge-1216/build.gradle
Normal file
@@ -0,0 +1,49 @@
|
||||
plugins {
|
||||
id 'net.neoforged.moddev' version '2.0.97'
|
||||
}
|
||||
|
||||
base.archivesName = "${project.mod_id}-neoforge-1216"
|
||||
|
||||
// NeoForge 1.21.6 은 Java 21. release 21 로 컴파일.
|
||||
java {
|
||||
toolchain.languageVersion = JavaLanguageVersion.of(25)
|
||||
}
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
options.release = 21
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs += "${rootDir}/common/src/main/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
neoForge {
|
||||
version = project.neoforge_1216
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mod_id", project.mod_id
|
||||
inputs.property "minecraft_version", project.mc_1216
|
||||
inputs.property "neoforge_version", project.neoforge_1216
|
||||
|
||||
filteringCharset = 'UTF-8'
|
||||
|
||||
filesMatching("META-INF/neoforge.mods.toml") {
|
||||
expand(
|
||||
"version": project.version,
|
||||
"mod_id": project.mod_id,
|
||||
"minecraft_version": project.mc_1216,
|
||||
"neoforge_version": project.neoforge_1216
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${project.mod_id}_neoforge_1216" }
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,14 @@ import net.neoforged.fml.common.Mod;
|
||||
import net.neoforged.neoforge.common.NeoForge;
|
||||
import net.neoforged.neoforge.event.ServerChatEvent;
|
||||
import net.neoforged.neoforge.event.entity.player.PlayerEvent;
|
||||
import net.neoforged.neoforge.event.tick.ServerTickEvent;
|
||||
|
||||
@Mod(ChatAnswerCore.MOD_ID)
|
||||
public final class ChatAnswerNeoForge {
|
||||
public ChatAnswerNeoForge(IEventBus modBus) {
|
||||
NeoForge.EVENT_BUS.addListener(ChatAnswerNeoForge::onServerChat);
|
||||
NeoForge.EVENT_BUS.addListener(ChatAnswerNeoForge::onPlayerLogin);
|
||||
NeoForge.EVENT_BUS.addListener(ChatAnswerNeoForge::onServerTick);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
@@ -30,4 +32,9 @@ public final class ChatAnswerNeoForge {
|
||||
ChatAnswerCore.onPlayerJoin(player);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onServerTick(ServerTickEvent.Post event) {
|
||||
ChatAnswerCore.onServerTick(event.getServer());
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,14 @@
|
||||
modLoader = "javafml"
|
||||
loaderVersion = "[1,)"
|
||||
license = "MIT"
|
||||
issueTrackerURL = "https://git.tkrmagid.kr/tkrmagid/mc_chat_answer_mod/issues"
|
||||
|
||||
[[mods]]
|
||||
modId = "${mod_id}"
|
||||
version = "${version}"
|
||||
displayName = "${mod_name}"
|
||||
displayName = "채팅정답"
|
||||
authors = "tkrmagid"
|
||||
description = '''음악퀴즈(mq) 데이터팩이 정답 입력을 받는 상태(init=5)에서 채팅을 가로채 mq:answer/submit 함수로 전달합니다.'''
|
||||
displayURL = "https://git.tkrmagid.kr/tkrmagid/mc_chat_answer_mod"
|
||||
logoFile = "icon.png"
|
||||
|
||||
[[dependencies.${mod_id}]]
|
||||
modId = "neoforge"
|
||||
BIN
neoforge-1216/src/main/resources/icon.png
Normal file
BIN
neoforge-1216/src/main/resources/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.4 KiB |
@@ -1,41 +0,0 @@
|
||||
plugins {
|
||||
id 'net.neoforged.moddev' version '2.0.97'
|
||||
}
|
||||
|
||||
base.archivesName = "${project.mod_id}-neoforge"
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs += "${rootDir}/common/src/main/java"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
neoForge {
|
||||
version = project.neoforge_version
|
||||
}
|
||||
|
||||
processResources {
|
||||
inputs.property "version", project.version
|
||||
inputs.property "mod_id", project.mod_id
|
||||
inputs.property "mod_name", project.mod_name
|
||||
inputs.property "minecraft_version", project.minecraft_version
|
||||
inputs.property "neoforge_version", project.neoforge_version
|
||||
|
||||
filesMatching("META-INF/neoforge.mods.toml") {
|
||||
expand(
|
||||
"version": project.version,
|
||||
"mod_id": project.mod_id,
|
||||
"mod_name": project.mod_name,
|
||||
"minecraft_version": project.minecraft_version,
|
||||
"neoforge_version": project.neoforge_version
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
jar {
|
||||
from(rootProject.file("LICENSE")) {
|
||||
rename { "${it}_${project.mod_id}" }
|
||||
}
|
||||
}
|
||||
@@ -8,5 +8,9 @@ pluginManagement {
|
||||
}
|
||||
|
||||
rootProject.name = 'chat_answer'
|
||||
// NeoForge moddev plugin 이 MC 26.1.2 를 파싱하지 못함(1.21.5 로 fallback) → 26.x 정식 지원 전까지 제외.
|
||||
include 'fabric'
|
||||
|
||||
// 세 개의 target-specific subproject. 각각 자기 MC/로더 버전으로 컴파일/리맵.
|
||||
// rootProject 의 containerJar 가 셋의 산출물을 하나로 묶어 단일 jar 배포물 생성.
|
||||
include 'fabric-1216'
|
||||
include 'fabric-2612'
|
||||
include 'neoforge-1216'
|
||||
|
||||
Reference in New Issue
Block a user