12 Commits

Author SHA1 Message Date
Claude (owner)
2f6dc17092 music_quiz: interaction hitbox 를 stone_button 면 크기에 정합
interaction entity 의 위치/크기를 facing 별 오프셋 + 버튼 hitbox
치수 (6/16 × 4/16) 에 맞춰 분리.

- button_defs 각 항목에 ox/oy/oz/w/h 추가. facing 별 보정값으로
  interaction 의 "튀어나온 쪽 면 = 버튼 visible face" 가 되게 함.
  반대편은 벽 블록 속으로 들어가 invisible.
- width=0.375f, height=0.25f → 가로/세로 버튼 face 와 정합.
  horizontal hitbox 가 square 강제라 두께는 0.375 까지 가지만,
  벽 쪽 0.25 가 wall 블록 안에 묻혀 시각적으로는 버튼 두께 0.125 만 튀어나옴.
- btn.mcfunction 의 summon 라인이 매크로 변수 (~$(ox)/$(oy)/$(oz)) 와
  $(w)f / $(h)f 사용으로 변경됨.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 21:23:30 +09:00
Claude (owner)
c39a0516bc music_quiz: interaction 엔티티 소환을 데이터팩 내부로 흡수
월드 cmd block 의존 (redstone_block/red_wool 펄스) 을 제거하고
btn.mcfunction 이 직접 summon 하도록 변경.

- buttons=-1 초기화 단계에서 기존 mq/<버튼명> interaction 을 모두
  kill 후 정확히 1개를 (x+0.5, y, z+0.5) 에 1f×1f 로 재소환.
  /reload 마다 dup 누적 없이 "버튼당 1개, 올바른 좌표" 로 수렴.
- /reload → load → commands/stop 이 buttons 점수를 -1 로 재설정 →
  다음 tick 에 ensure 로직 실행. /kill @e 후에도 /reload 한 번으로 복구.
- stone_button 직접 감지 fallback 및 잉여 state machine (1→2→0)
  제거. 클릭 경로는 interaction 단일화 → trigger 투표 흐름 보존.
- README 의 버튼 본체 설명을 새 구조로 갱신.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 21:07:31 +09:00
Claude (owner)
cce5469dc2 music_quiz: answer 정규화 도입 (대소문자/공백 무시)
- mq:answer/normalize: storage 의 norm.in 을 한 글자씩 떼어내
  소문자화 + 공백 제거 후 norm.acc 에 누적. char 단위 반복은
  'data modify ... set string from ... <start> <end>' (1.20+) 로,
  결합은 매크로 ($(acc)$(c)) 로 수행하는 pure-datapack 구현.

- process: 큐의 text 를 정규화한 결과를 judge.input 으로 사용
- judge: answer.title 정규화 후 judge.answer 로 사용
- iter_aliases: alias 각 항목 정규화 후 비교

원본 songs.mcfunction 의 title/alias 표기는 그대로 유지 (display
및 정규화 입력으로 모두 사용됨). 입력이 'Lose My Mind' / 'lose my mind'
/ 'LOSEMYMIND' / 'losemymind' 어떤 형태든 동일한 정규형으로 떨어져 매치.
2026-05-15 00:23:42 +09:00
Claude (owner)
8c30f4de5e temp: 애니메이션 painting 텍스처 검증용 sample 파일 추가
리소스팩 1번 방식 (.png 세로 스트립 + .png.mcmeta) 이
painting_variant 에서 동작하는지 검증하기 위한 샘플.

사용 위치: musicquiz 리소스팩의
  assets/musicquiz/textures/painting/gif.png
  assets/musicquiz/textures/painting/gif.png.mcmeta

데이터팩 v1.0.6 의 mq:gif painting_variant 와 짝.
2026-05-14 23:58:07 +09:00
Claude (owner)
ae434c3a07 music_quiz: answer/macro/match — NBT path compound matcher 공백 제거
execute if data <source> <path> 의 path 토큰은 공백을 허용하지 않음.
'judge {input:...}' → 'judge{input:...}' 로 붙여써야 compound predicate 가
정상 적용됨.
2026-05-14 23:50:28 +09:00
Claude (owner)
663891c966 music_quiz: 애니메이션 텍스처 테스트용 painting_variant gif 추가
리소스팩 musicquiz:gif 텍스처가 .png.mcmeta 애니메이션을 따르는지
검증하기 위한 1×1 painting_variant. 텍스처 자체는 리소스팩에 별도 배치.
2026-05-14 23:39:20 +09:00
Claude (owner)
c2dcf0c44f music_quiz: painting_variant 를 mq 네임스페이스로 통합
- data/musicquiz/painting_variant/* → data/mq/painting_variant/* 로 이동
  변종 ID = mq:cover_NN, 텍스처 asset_id = musicquiz:cover_NN (리소스팩)
- title/author 필드 제거 (기본값 사용)
- init/config.mcfunction 의 image.namespace 기본값을 "mq" 로 변경
2026-05-14 23:23:29 +09:00
Claude (owner)
f71bd95de5 music_quiz: pack.mcmeta 에 min_format / max_format 명시 (26.1.2 = format 75)
25w31a 이후 pack metadata 에서 min_format / max_format 가 권장 필드로
추가됨. 없으면 게임 시작 시 PackRepository.reload 단계에서
"missing mandatory fields min_format and max_format" WARN 로그가
fallback 으로 처리되며, 향후 버전에서 hard fail 로 바뀔 가능성이
있어 명시. 단일 버전(26.1.2) 만 지원하므로 75/75 로 고정.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 23:04:43 +09:00
Claude (owner)
b19f37969a music_quiz: add painting_variant definitions (cover_01 ~ cover_50)
리소스팩의 assets/musicquiz/textures/painting/cover_NN.png 를 게임에서
painting entity 로 띄우려면 데이터팩 쪽에 painting_variant 정의가
있어야 한다. 곡 수(50)에 맞춰 data/musicquiz/painting_variant/cover_NN.json
50개를 추가. asset_id 의 musicquiz:cover_NN 이 자동으로
assets/musicquiz/textures/painting/cover_NN.png 를 가져다 쓴다.
width/height = 1×1 (정사각 한 블록).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 22:57:49 +09:00
Claude (owner)
416eaee14a music_quiz: chat_answer 모드 활성 알림 — race-free 함수 호출 방식으로 전환
기존: storage chat_answer:status active 1b/0b 플래그를 모드가 set,
데이터팩이 mq:load 에서 0b 로 reset 하는 구조였는데,
통합 서버에서 mq:load 가 player join 이후에 도는 케이스가 발견되어
모드가 써놓은 1b 를 데이터팩이 직후에 0b 로 덮어쓰는 race 발생.

수정: storage 플래그를 완전히 제거. 모드가 직접 PlayerLoggedInEvent
핸들러에서 mq:players/mod_active_notice 함수를 해당 플레이어로 호출.
데이터팩이 없으면 함수가 없어 silent fail → race 없음.

- mq:load: chat_answer:status 0b 초기화 라인 삭제
- mq:players/login: 조건부 tellraw 제거 (모드가 직접 호출하므로)
- mq:players/mod_active_notice: 새 함수, 그냥 tellraw 만 수행
2026-05-14 03:14:55 +09:00
Claude (owner)
de6e040623 music_quiz: add pack.png icon 2026-05-14 02:28:52 +09:00
Claude (owner)
141bc5eaa5 music_quiz: fix invalid dialog type — simple_input_form → notice
mq/dialog/answer.json 이 'minecraft:simple_input_form' 타입을 쓰는데
1.21.6 dialog registry 에 그 타입이 없어서 데이터팩 로드 자체가 실패
"세계를 불러올 수 없습니다" 오류. 유효한 타입 중 단일 버튼 + inputs 를
지원하는 minecraft:notice 로 교체, action 을 button(label+inner action)
구조로 감싼다. dynamic/run_command 템플릿은 그대로 — $(text) 매크로 치환.
2026-05-13 23:36:29 +09:00
70 changed files with 418 additions and 42 deletions

View File

@@ -77,8 +77,17 @@
- `start` / `stop` / `skip` / `hint` / `replay` / `test` - `start` / `stop` / `skip` / `hint` / `replay` / `test`
버튼 본체는 `interaction` 엔티티 + `redstone_block`-`red_wool` 토글 버튼 본체는 보이는 `stone_button` 블록 + 그 좌표에 덮인 `interaction`
패턴으로 디바운스를 처리한다. 엔티티로 구성된다. 클릭 처리는 항상 `interaction` 경로로 흐르므로
`on target as @s` 로 누른 플레이어가 식별되고, 다수결(`trigger $(n)`)
투표가 성립한다.
`interaction` 은 데이터팩이 직접 소환·관리한다 — `buttons` 점수가
`-1` (초기화) 일 때마다 같은 태그의 기존 entity 를 정리하고 정확히
1개를 (재)소환한다. `/reload``commands/stop` 을 호출해 `buttons`
점수를 `-1` 로 재설정하므로, 리로드 시 자동 보장된다. `/kill @e`
지워졌어도 다음 `/reload` 한 번으로 복구. 월드 회로(커맨드블럭) 의존은
없다.
### 파일 구조 ### 파일 구조

View File

@@ -1,9 +1,10 @@
{ {
"type": "minecraft:simple_input_form", "type": "minecraft:notice",
"title": { "title": {
"text": "정답 입력", "text": "정답 입력",
"bold": true "bold": true
}, },
"body": [],
"inputs": [ "inputs": [
{ {
"type": "minecraft:text", "type": "minecraft:text",
@@ -20,7 +21,12 @@
"pause": false, "pause": false,
"after_action": "close", "after_action": "close",
"action": { "action": {
"type": "minecraft:dynamic/run_command", "label": {
"template": "function mq:answer/submit {text:'$(text)'}" "text": "제출"
},
"action": {
"type": "minecraft:dynamic/run_command",
"template": "function mq:answer/submit {text:'$(text)'}"
}
} }
} }

View File

@@ -2,7 +2,9 @@
execute store result score alen func.temp run data get storage mq:tmp aliases execute store result score alen func.temp run data get storage mq:tmp aliases
execute if score alen func.temp matches 0 run return 0 execute if score alen func.temp matches 0 run return 0
data modify storage mq:tmp judge.answer set from storage mq:tmp aliases[0] data modify storage mq:tmp norm.in set from storage mq:tmp aliases[0]
function mq:answer/normalize
data modify storage mq:tmp judge.answer set from storage mq:tmp norm.acc
function mq:answer/macro/match with storage mq:tmp judge function mq:answer/macro/match with storage mq:tmp judge
data remove storage mq:tmp aliases[0] data remove storage mq:tmp aliases[0]

View File

@@ -2,8 +2,10 @@
# 매치되면 @s answer = 1 → check_answer 가 정답처리 흐름으로 진입 # 매치되면 @s answer = 1 → check_answer 가 정답처리 흐름으로 진입
# 매치 안되면 @s answer = 2 → check_answer 가 reset 처리 (1회 비교 후 초기화) # 매치 안되면 @s answer = 2 → check_answer 가 reset 처리 (1회 비교 후 초기화)
# 1) 제목과 비교 # 1) 제목과 비교 (정규화 후)
data modify storage mq:tmp judge.answer set from storage mq:main answer.title data modify storage mq:tmp norm.in set from storage mq:main answer.title
function mq:answer/normalize
data modify storage mq:tmp judge.answer set from storage mq:tmp norm.acc
function mq:answer/macro/match with storage mq:tmp judge function mq:answer/macro/match with storage mq:tmp judge
# 2) 제목 매치 실패 시 alias 들과 순차 비교 (조기 종료) # 2) 제목 매치 실패 시 alias 들과 순차 비교 (조기 종료)

View File

@@ -1,3 +1,3 @@
# judge.input 과 judge.answer 가 같으면 @s answer = 1 # judge.input 과 judge.answer 가 같으면 @s answer = 1
# 매크로 치환으로 answer 필드를 NBT predicate 의 리터럴로 박아넣음 # 매크로 치환으로 answer 필드를 NBT predicate 의 리터럴로 박아넣음
$execute if data storage mq:tmp judge {input:"$(answer)"} run scoreboard players set @s answer 1 $execute if data storage mq:tmp judge{input:"$(answer)"} run scoreboard players set @s answer 1

View File

@@ -0,0 +1,13 @@
# 입력 문자열 정규화 — 소문자 변환 + 공백 제거 (대소문자/공백 무시 비교용)
#
# 입력 : storage mq:tmp norm.in (원본 문자열)
# 출력 : storage mq:tmp norm.acc (정규화 결과)
#
# 호출 예:
# data modify storage mq:tmp norm.in set from storage mq:main answer.title
# function mq:answer/normalize
# # 이후 storage mq:tmp norm.acc 에 결과
#
# 동작: norm.in 을 한 글자씩 떼어내며 normalize/step 으로 재귀
data modify storage mq:tmp norm.acc set value ""
function mq:answer/normalize/step

View File

@@ -0,0 +1,3 @@
# acc 끝에 c 를 매크로로 concat
# 매크로 인자: storage mq:tmp norm → $(acc), $(c)
$data modify storage mq:tmp norm.acc set value "$(acc)$(c)"

View File

@@ -0,0 +1,47 @@
# normalize 의 1-문자 처리 + 재귀 스텝
# 사전조건: storage mq:tmp norm.in 비어있지 않을 수 있음 / norm.acc 누적값
execute store result score n.len func.temp run data get storage mq:tmp norm.in
execute if score n.len func.temp matches 0 run return 0
# 머리글자 추출 → norm.c
data modify storage mq:tmp norm.c set string from storage mq:tmp norm.in 0 1
# 공백 제거 (스킵)
execute if data storage mq:tmp norm{c:" "} run data modify storage mq:tmp norm.c set value ""
# 대문자 A-Z → 소문자 a-z
execute if data storage mq:tmp norm{c:"A"} run data modify storage mq:tmp norm.c set value "a"
execute if data storage mq:tmp norm{c:"B"} run data modify storage mq:tmp norm.c set value "b"
execute if data storage mq:tmp norm{c:"C"} run data modify storage mq:tmp norm.c set value "c"
execute if data storage mq:tmp norm{c:"D"} run data modify storage mq:tmp norm.c set value "d"
execute if data storage mq:tmp norm{c:"E"} run data modify storage mq:tmp norm.c set value "e"
execute if data storage mq:tmp norm{c:"F"} run data modify storage mq:tmp norm.c set value "f"
execute if data storage mq:tmp norm{c:"G"} run data modify storage mq:tmp norm.c set value "g"
execute if data storage mq:tmp norm{c:"H"} run data modify storage mq:tmp norm.c set value "h"
execute if data storage mq:tmp norm{c:"I"} run data modify storage mq:tmp norm.c set value "i"
execute if data storage mq:tmp norm{c:"J"} run data modify storage mq:tmp norm.c set value "j"
execute if data storage mq:tmp norm{c:"K"} run data modify storage mq:tmp norm.c set value "k"
execute if data storage mq:tmp norm{c:"L"} run data modify storage mq:tmp norm.c set value "l"
execute if data storage mq:tmp norm{c:"M"} run data modify storage mq:tmp norm.c set value "m"
execute if data storage mq:tmp norm{c:"N"} run data modify storage mq:tmp norm.c set value "n"
execute if data storage mq:tmp norm{c:"O"} run data modify storage mq:tmp norm.c set value "o"
execute if data storage mq:tmp norm{c:"P"} run data modify storage mq:tmp norm.c set value "p"
execute if data storage mq:tmp norm{c:"Q"} run data modify storage mq:tmp norm.c set value "q"
execute if data storage mq:tmp norm{c:"R"} run data modify storage mq:tmp norm.c set value "r"
execute if data storage mq:tmp norm{c:"S"} run data modify storage mq:tmp norm.c set value "s"
execute if data storage mq:tmp norm{c:"T"} run data modify storage mq:tmp norm.c set value "t"
execute if data storage mq:tmp norm{c:"U"} run data modify storage mq:tmp norm.c set value "u"
execute if data storage mq:tmp norm{c:"V"} run data modify storage mq:tmp norm.c set value "v"
execute if data storage mq:tmp norm{c:"W"} run data modify storage mq:tmp norm.c set value "w"
execute if data storage mq:tmp norm{c:"X"} run data modify storage mq:tmp norm.c set value "x"
execute if data storage mq:tmp norm{c:"Y"} run data modify storage mq:tmp norm.c set value "y"
execute if data storage mq:tmp norm{c:"Z"} run data modify storage mq:tmp norm.c set value "z"
# acc = acc + c (매크로 결합)
function mq:answer/normalize/append with storage mq:tmp norm
# 나머지로 진행
data modify storage mq:tmp norm.in set string from storage mq:tmp norm.in 1
function mq:answer/normalize/step

View File

@@ -5,7 +5,11 @@ execute if score qlen func.temp matches 0 run return 0
# 첫번째 항목 = 가장 먼저 제출된 것 # 첫번째 항목 = 가장 먼저 제출된 것
data modify storage mq:tmp judge set value {input:"", answer:""} data modify storage mq:tmp judge set value {input:"", answer:""}
data modify storage mq:tmp judge.input set from storage mq:input queue[0].text
# 입력 정규화 (소문자 + 공백제거) — 정답과 비교는 둘 다 정규화된 형태로
data modify storage mq:tmp norm.in set from storage mq:input queue[0].text
function mq:answer/normalize
data modify storage mq:tmp judge.input set from storage mq:tmp norm.acc
# 매크로로 해당 seq 를 가진 플레이어 찾아서 judge 실행 # 매크로로 해당 seq 를 가진 플레이어 찾아서 judge 실행
data modify storage mq:tmp _find set value {seq:0} data modify storage mq:tmp _find set value {seq:0}

View File

@@ -1,7 +1,25 @@
# 버튼 정의. 각 항목 의미:
# n : 이름 (= 트리거/태그) x,y,z : 버튼 블록 좌표 f : facing
# c : 클릭 시 실행 명령 (init=0 직접, 그 외 trigger $(n) 투표)
# ox,oy,oz : interaction entity 소환 위치 오프셋 (블록 좌표 기준)
# w,h : interaction width / height (float)
#
# stone_button[face=wall] hitbox: 가로 6/16 (0.375), 세로 4/16 (0.25),
# 두께 2/16 (0.125), 벽 반대편으로만 튀어나옴. interaction 의 horizontal
# hitbox 는 width × width 정사각형 강제 → width 를 가로(0.375) 에 맞추고
# 위치 보정으로 "튀어나온 쪽 면 = visible face" 가 되게 함. 반대편은
# 벽 블록 속으로 들어가 invisible.
#
# facing 별 오프셋:
# south : ox=0.5 oy=0.375 oz=-0.0625
# north : ox=0.5 oy=0.375 oz=1.0625
# east : ox=-0.0625 oy=0.375 oz=0.5
# west : ox=1.0625 oy=0.375 oz=0.5
data modify storage mq:main button_defs set value [] data modify storage mq:main button_defs set value []
data modify storage mq:main button_defs append value {n:"start", x:140, y:62, z:-225, f:"south", c:"function mq:commands/start with storage mq:main"} data modify storage mq:main button_defs append value {n:"start", x:140, y:62, z:-225, f:"south", c:"function mq:commands/start with storage mq:main", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
data modify storage mq:main button_defs append value {n:"stop", x:142, y:62, z:-225, f:"south", c:"function mq:commands/stop with storage mq:main"} data modify storage mq:main button_defs append value {n:"stop", x:142, y:62, z:-225, f:"south", c:"function mq:commands/stop with storage mq:main", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
data modify storage mq:main button_defs append value {n:"skip", x:144, y:62, z:-225, f:"south", c:"function mq:commands/skip"} data modify storage mq:main button_defs append value {n:"skip", x:144, y:62, z:-225, f:"south", c:"function mq:commands/skip", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
data modify storage mq:main button_defs append value {n:"hint", x:146, y:62, z:-225, f:"south", c:"function mq:commands/hint"} data modify storage mq:main button_defs append value {n:"hint", x:146, y:62, z:-225, f:"south", c:"function mq:commands/hint", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
data modify storage mq:main button_defs append value {n:"replay", x:148, y:62, z:-225, f:"south", c:"function mq:commands/replay"} data modify storage mq:main button_defs append value {n:"replay", x:148, y:62, z:-225, f:"south", c:"function mq:commands/replay", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
data modify storage mq:main button_defs append value {n:"test", x:144, y:62, z:-213, f:"north", c:"function mq:commands/test"} data modify storage mq:main button_defs append value {n:"test", x:144, y:62, z:-213, f:"north", c:"function mq:commands/test", ox:"0.5", oy:"0.375", oz:"1.0625", w:"0.375", h:"0.25"}

View File

@@ -11,11 +11,11 @@ data modify storage mq:main spawn set value {x: 144, y: 61, z: -219, r: 180, f:
# pitch — 1.0 = 원본 속도 # pitch — 1.0 = 원본 속도
data modify storage mq:main audio set value {namespace: "musicquiz", source: "weather", volume: 1.0, pitch: 1.0} data modify storage mq:main audio set value {namespace: "musicquiz", source: "weather", volume: 1.0, pitch: 1.0}
# 정답 페인팅 — minecraft_launcher 리소스팩 musicquiz:cover_NN painting_variant # 정답 페인팅 — 데이터팩의 mq:cover_NN painting_variant (텍스처는 리소스팩 musicquiz:cover_NN)
# namespace — painting_variant 네임스페이스 (기본 "musicquiz") # namespace — painting_variant 네임스페이스 (기본 "mq")
# x,y,z — 페인팅 entity 좌표 (벽면 앞쪽 블록 위치) # x,y,z — 페인팅 entity 좌표 (벽면 앞쪽 블록 위치)
# facing — 페인팅이 바라보는 방향: south=0 / west=1 / north=2 / east=3 # facing — 페인팅이 바라보는 방향: south=0 / west=1 / north=2 / east=3
data modify storage mq:main image set value {namespace: "musicquiz", x: 144, y: 84, z: -261, facing: 0b} data modify storage mq:main image set value {namespace: "mq", x: 144, y: 84, z: -261, facing: 0b}
# 정답 입력용 marker entity 소환 좌표 # 정답 입력용 marker entity 소환 좌표
data modify storage mq:main marker set value {x: 144, y: 59, z: -219} data modify storage mq:main marker set value {x: 144, y: 59, z: -219}

View File

@@ -2,10 +2,6 @@ data modify storage mq:main answer set value {title:"", author:"", alias:[]}
data merge storage func:temp {} data merge storage func:temp {}
data merge storage mq:tmp {} data merge storage mq:tmp {}
# chat_answer 모드 활성화 플래그 초기화. 모드가 살아있으면 첫 플레이어 로그인 직후
# 모드가 다시 1b 로 set 함. 모드가 빠지면 이대로 0b 유지 → 로그인 메세지 미표시.
data modify storage chat_answer:status active set value 0b
function mq:init/config function mq:init/config
function mq:init/songs function mq:init/songs
function mq:init/buttons function mq:init/buttons

View File

@@ -9,6 +9,5 @@ $setworldspawn $(x) $(y) $(z) $(r) $(f)
$tp @s $(x) $(y) $(z) $(r) $(f) $tp @s $(x) $(y) $(z) $(r) $(f)
gamemode adventure @s gamemode adventure @s
# chat_answer 모드가 살아있으면 PlayerLoggedInEvent 핸들러가 active=1b 로 set. # 채팅정답 모드 활성 알림은 모드가 직접 PlayerLoggedInEvent 핸들러에서
# mq:load 에서 0b 로 초기화되어 있으므로, 1b 인 상황 = 모드 활성. # mq:players/mod_active_notice 를 호출해서 표시한다 (race-free).
execute if data storage chat_answer:status {active:1b} run tellraw @s ["",{"text":"[채팅정답] ","color":"green","bold":true},{"text":"모드가 활성화되어 있습니다.","color":"gray"},{"text":" 정답 입력 시 ","color":"gray"},{"text":"채팅","color":"yellow","bold":true},{"text":"으로 바로 제출할 수 있습니다.","color":"gray"}]

View File

@@ -0,0 +1,3 @@
# chat_answer 모드의 PlayerLoggedInEvent 핸들러가 직접 호출.
# 모드가 없으면 이 함수가 호출될 일이 없으므로 메세지가 안 뜬다.
tellraw @s ["",{"text":"[채팅정답] ","color":"green","bold":true},{"text":"모드가 활성화되어 있습니다.","color":"gray"},{"text":" 정답 입력 시 ","color":"gray"},{"text":"채팅","color":"yellow","bold":true},{"text":"으로 바로 제출할 수 있습니다.","color":"gray"}]

View File

@@ -1,28 +1,39 @@
# 버튼 1개에 대한 매 tick 처리.
# 매크로 인자: n, x, y, z, f, c, ox, oy, oz, w, h
# ox/oy/oz : interaction 소환 위치 오프셋 (블록 좌표 기준, facing 별)
# w / h : interaction width / height (float, 버튼 hitbox 정합용)
# buttons 점수 상태:
# ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단)
# -1 : 초기화 단계 (버튼 블록 배치 + interaction entity 보장 후 0 으로)
# 0 : 정상 (interaction 클릭 대기)
#
# interaction entity 는 데이터팩이 직접 summon — /reload 시 commands/stop
# 에서 buttons 가 -1 로 재설정되어 다음 tick 에 ensure 로직이 실행됨.
# -1 단계에서 같은 태그 entity 를 모두 kill 후 정확히 1개 summon → dup
# 누적 없이 항상 "버튼당 1개, 올바른 좌표" 상태로 수렴 (idempotent).
# ---- 비활성: 버튼 제거 + interaction 응답 차단 후 종료 ----
$execute if score $(n) buttons matches ..-2 run setblock $(x) $(y) $(z) minecraft:air $execute if score $(n) buttons matches ..-2 run setblock $(x) $(y) $(z) minecraft:air
$execute if score $(n) buttons matches ..-2 run data modify entity @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] response set value 0b $execute if score $(n) buttons matches ..-2 run data modify entity @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] response set value 0b
$execute if score $(n) buttons matches ..-2 run return 0 $execute if score $(n) buttons matches ..-2 run return 0
# ---- 초기화: 버튼 블록 배치 + interaction entity 보장 ----
# 기존 mq/$(n) interaction 을 전부 제거 후 정확히 1개 소환.
# 옛 월드 cmd block 으로 누적 소환된 dup 이나 엉뚱한 좌표에 남은 잔존
# entity 까지 정리 → "정상 상태(버튼당 정확히 1개, 올바른 좌표)" 가 보장됨.
$execute unless score $(n) buttons matches -1.. run scoreboard players set $(n) buttons -1 $execute unless score $(n) buttons matches -1.. run scoreboard players set $(n) buttons -1
$execute if score $(n) buttons matches -1 run setblock $(x) $(y) $(z) minecraft:stone_button[face=wall,facing=$(f),powered=false] $execute if score $(n) buttons matches -1 run setblock $(x) $(y) $(z) minecraft:stone_button[face=wall,facing=$(f),powered=false]
$execute if score $(n) buttons matches -1 positioned $(x) $(y) $(z) run setblock ~ ~-3 ~ minecraft:redstone_block $execute if score $(n) buttons matches -1 run kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
$execute if score $(n) buttons matches -1 positioned $(x) $(y) $(z) run setblock ~ ~-3 ~ minecraft:red_wool $execute if score $(n) buttons matches -1 positioned $(x) $(y) $(z) positioned ~$(ox) ~$(oy) ~$(oz) run summon minecraft:interaction ~ ~ ~ {Tags:["mq","$(n)"],width:$(w)f,height:$(h)f,response:0b}
$execute if score $(n) buttons matches -1 run scoreboard players set $(n) buttons 0 $execute if score $(n) buttons matches -1 run scoreboard players set $(n) buttons 0
$execute if block $(x) $(y) $(z) minecraft:stone_button[face=wall,facing=$(f),powered=true] \ # ---- 상시: interaction 클릭/타격 → playsound + 명령/투표 실행 ----
if score $(n) buttons matches 0 \ # init main = 0 (퀴즈 시작 전 설정 단계) : 명령 직접 실행
run scoreboard players set $(n) buttons 1 # 그 외 : trigger 투표 경로
$execute if score $(n) buttons matches 1 unless entity @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] positioned $(x) $(y) $(z) run $(c)
$execute if score $(n) buttons matches 1 \
run scoreboard players set $(n) buttons 2
$execute if block $(x) $(y) $(z) minecraft:stone_button[face=wall,facing=$(f),powered=false] \
if score $(n) buttons matches 1.. \
run scoreboard players set $(n) buttons 0
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1 $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) if score init main matches 0 run $(c) $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) if score init main matches 0 run $(c)
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) unless score init main matches 0 run trigger $(n) $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) unless score init main matches 0 run trigger $(n)
# ---- 처리 후 attack/interaction NBT 클리어 (다음 tick 중복 발화 방지) ----
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] at @s run data remove entity @s attack $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] at @s run data remove entity @s attack
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] at @s run data remove entity @s interaction $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] at @s run data remove entity @s interaction

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_01",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_02",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_03",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_04",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_05",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_06",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_07",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_08",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_09",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_10",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_11",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_12",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_13",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_14",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_15",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_16",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_17",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_18",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_19",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_20",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_21",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_22",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_23",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_24",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_25",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_26",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_27",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_28",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_29",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_30",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_31",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_32",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_33",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_34",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_35",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_36",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_37",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_38",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_39",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_40",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_41",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_42",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_43",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_44",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_45",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_46",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_47",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_48",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_49",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:cover_50",
"width": 1,
"height": 1
}

View File

@@ -0,0 +1,5 @@
{
"asset_id": "musicquiz:gif",
"width": 1,
"height": 1
}

View File

@@ -1,6 +1,8 @@
{ {
"pack": { "pack": {
"pack_format": 75, "pack_format": 75,
"min_format": 75,
"max_format": 75,
"description": "음악퀴즈용 데이터팩입니다." "description": "음악퀴즈용 데이터팩입니다."
} }
} }

BIN
music_quiz/pack.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
temp/gif.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

6
temp/gif.png.mcmeta Normal file
View File

@@ -0,0 +1,6 @@
{
"animation": {
"frametime": 1,
"interpolate": false
}
}