19 Commits

Author SHA1 Message Date
Claude (owner)
0d33d22467 music_quiz: 버튼 라벨 위치 + interaction 깊이 부호 수정
- text_display Y `~-1` → `~-0.25`: entity Y 가 텍스트 윗변이라
  ~-1 이면 텍스트 본체가 바닥에 떨어져 표시됐음. ~-0.25 로 두면
  버튼 바로 아래 벽면 [Y-1, Y] 의 위쪽 절반에 라벨이 자리잡음.
- text 에 bold:true 기본 적용.
- interaction 깊이 부호 반전: v1.0.21 에서 "버튼 바깥 한 두께
  만큼 밀어 동시 발화 회피" 의도였는데 부호를 반대로 잡아 벽
  안쪽으로 들어가 있었음 (south z=-0.0625 등). 플레이어 쪽
  (south z=0.1875 등) 으로 수정.

이전엔 raycast tie 로 우연히 동작했지만 호스트/각도에 따라 벽이
먼저 차단되는 케이스 발생.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:51:14 +09:00
Claude (owner)
07753abd0c temp/README: jar 파일명 1.3.6 → 1.3.7 누락 fix
이전 커밋(4f82fb4) 에서 `replace_all` 로 `v1.3.6` 만 일괄 치환했는데,
다운로드 안내의 jar 파일명 `chat_answer-1.3.6.jar` 는 v prefix 가
없어서 안 바뀜. 사용자가 README 대로 1.3.6 을 넣으면 reload 후
false negative 가 그대로 재발하므로 반드시 1.3.7 로 교정.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:26:20 +09:00
Claude (owner)
4f82fb4a25 temp/README: 모드 권장 버전을 v1.3.7 로 갱신 — /reload 케이스 보강
v1.3.6 는 SERVER_STARTED + JOIN + ServerTick 셋만 등록해서, tick 이벤트가
죽은 호스트에서 이미 접속 중인 플레이어가 /reload 하면 어느 훅도 발화
안 되어 #server mq_chat_mod 가 0 인 채로 남는 갭이 있었음. v1.3.7 에서
END_DATA_PACK_RELOAD 훅 추가로 reload 직후에도 presence 가 다시 찍힘.

데이터팩 v1.0.23 자체는 그대로 — 모드 jar 만 v1.3.7 로 업그레이드하면 됨.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:22:55 +09:00
Claude (owner)
0d88ac7bbf music_quiz: v1.0.22 게이트 제거 되돌림 — 진짜 fix 는 모드 v1.3.6 에서
v1.0.22 는 채팅정답 모드 false negative 를 게이트 자체를 삭제해서 회피
했는데, 이건 채팅정답 모드 서버 설치 검증 자체를 잃는 잘못된 방향이었음.
모드 없는 서버에서도 시작이 됨.

진짜 root cause 는 모드 쪽 presence pulse 가 매 server tick 단일 hook
이라 banner/mohist 같은 fabric-bukkit 하이브리드에서 안 firing 되던 것.
mc_chat_answer_mod v1.3.6 에서 SERVER_STARTED / PlayerJoin / ServerTick
셋으로 확장 — 어느 한 이벤트만 firing 돼도 점수 갱신.

이 commit 은 데이터팩 쪽 v1.0.22 변경을 되돌림 (start.mcfunction 의
mq_chat_mod 게이트, load.mcfunction 의 mq_chat_mod objective add/set
복구). 결과적으로 v1.0.21 의 데이터팩 동작과 동일.

temp/README.md 갱신 — v1.0.23 로 가는 절차는 모드 jar 업그레이드 + (만약
v1.0.22 를 거쳐갔다면) start/load 두 파일 덮어쓰기. v1.0.21 에서 곧장
v1.0.23 으로 오면 datapack 파일은 동일하므로 사실상 모드 업그레이드만.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:16:51 +09:00
Claude (owner)
736ec2a3d1 music_quiz: 채팅정답 모드 게이트 제거 — false negative 차단 해결
모드를 설치했는데도 /start 가 "채팅정답 모드가 서버에 미설치" 로 막히던
문제. 검증 방식 (모드가 매 server tick #server mq_chat_mod 점수를 1 로
set 하는지 확인) 이 다음 케이스에서 false negative:

- 사용자가 옛 모드 버전 (v1.3.4 이하, presence tick 추가 전) 을 쓸 때
- banner/mohist 같은 fabric-bukkit 하이브리드 호스트에서
  ServerTickEvents.END_SERVER_TICK 이 안 들어올 때

채팅정답 모드는 입력을 편하게 만들어 주는 선택적 편의 기능일 뿐이고
모드 없는 환경에서도 /trigger input dialog 경로로 정답 제출이 가능.
게이트 자체를 제거하는 게 근본 해결. 영상재생 모드 (mc_video_player_mod)
는 진짜 필수이므로 게이트 유지.

- commands/start.mcfunction: mq_chat_mod 검사 라인 제거 + 주석 갱신
- load.mcfunction: mq_chat_mod objective add/set 제거 (defensive remove
  는 유지)
- temp/: start.mcfunction, load.mcfunction 추가 + README 갱신

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-19 00:01:07 +09:00
Claude (owner)
da075b60b8 music_quiz: 버튼 동시 눌림 방지 + text_display 텍스트 컴포넌트 형식 수정
(a) interaction 박스가 stone_button hitbox 와 겹쳐 있어서 한 번 클릭에
    interaction 도 발화하고 stone_button 도 vanilla 클릭으로 인식되어
    powered=true 애니메이션이 같이 일어나던 문제. interaction 박스를 버튼
    면 바깥쪽으로 한 두께(0.125) 만큼 빼서 ray 가 stone_button 에 닿기
    전에 interaction 에서 멈추도록.
    south z: 0.0625 → -0.0625, north z: 0.9375 → 1.0625
    east  x: 0.0625 → -0.0625, west  x: 0.9375 → 1.0625

(b) MC 1.20.5+ 부터 text_display.text 는 String 이 아닌 직접 TextComponent
    compound. 이전에 String 안에 JSON 을 넣어서 그 JSON 자체가 텍스트로
    렌더링되던 문제 (`{"text":"게임시작",...}` 가 그대로 보임). compound
    형태 `text:{text:"...",color:"...",font:"..."}` 로 변경.

temp/ 부분 적용 패키지의 btn.mcfunction 과 README 도 동기화.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 23:50:04 +09:00
Claude (owner)
b803a422a3 music_quiz: 버튼 interaction 0.5칸 어긋남 + btn_prep 파싱 에러 근본 수정
- btn.mcfunction 의 positioned $(x) $(y) $(z) → $(x).0 $(y).0 $(z).0.
  마인크래프트 vec3 인자는 정수만 쓰면 자동으로 +0.5 보정 (블록 중심으로
  잡힘) 되기 때문에 positioned 2773 86 5968 이 실제로는 (2773.5, 86,
  5968.5) 가 되고, 거기서 ~0.375 ~0.0625 같은 오프셋을 더해 interaction
  을 소환하면 박스가 블록 중앙으로 0.5 칸 밀린다. decimal 형태로 강제해
  보정 회피.

- btn_prep.mcfunction 을 execute-unless-data 방식에서 defaults 컴파운드 +
  merge 방식으로 재작성. 이전 v1.0.19 의 다중 공백 정규화는 근본 원인이
  아니었음 — `execute unless data storage mq:tmp btn.label run ...` 구문
  자체를 MC 26.1.2 파서가 거부. data modify ... merge from 으로 source 의
  키가 target 을 덮어쓰는 머지를 활용하면 같은 기능을 문제 라인 없이 구현.

- temp/ 부분 적용 패키지의 README 와 두 파일을 동기화. 진짜 원인 설명으로
  재작성.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 21:40:32 +09:00
Claude (owner)
5d610cf01a temp: v1.0.18→v1.0.19 부분 적용용 수정 파일과 README 추가
전체 datapack 교체 없이 두 파일만 덮어써서 v1.0.19 와 동일 상태로
만들 수 있도록 temp/ 에 수정된 파일과 적용 가이드만 남긴다.

- temp/data/mq/function/repeat/buttons/btn_prep.mcfunction
- temp/data/mq/function/repeat/buttons/btn.mcfunction
- temp/README.md (부분 적용 방법)

이전에 있던 temp/gif.png, gif.png.mcmeta 는 이번 부분 적용 패키지와
무관해서 제거.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-18 21:30:08 +09:00
Claude (owner)
2f5038e4f0 music_quiz: btn_prep/btn 의 정렬용 다중 공백 제거 — Brigadier 파싱 에러 회피
btn_prep.mcfunction line 10 에서 'Incorrect argument at position 45'
파싱 에러 발생. 이유는 보기 좋게 맞추려고 컬럼 정렬용으로 연속 공백을
넣었는데 MC 26.1.2 의 명령 파서가 컬럼 정렬을 토큰 구분으로 처리하지
못해 다음 인자를 못 찾음.

btn.mcfunction 의 가운데 타일 summon 라인 (~0.5   ~0.375 같이 두 칸
띄운 곳들) 도 동일 패턴 → 한 칸 공백으로 정규화.
2026-05-18 21:27:04 +09:00
Claude (owner)
75daf5bab9 music_quiz: 버튼 비활성 분기에서 data modify entity 단일 대상 제약 회피
interaction 이 버튼당 3개가 된 이후 (v1.0.16+) `data modify entity
@e[...] response set value 0b` 가 다중 대상 에러로 실패. 어차피 비활성
시점에 버튼 블록은 air 로 바꾸므로 interaction 과 text_display 도 함께
kill 하는 게 일관적 — 라벨이 stale 로 남는 것도 방지.
2026-05-17 04:17:58 +09:00
Claude (owner)
ba7089e7b2 music_quiz: 버튼 머리 hitbox 정확한 면 정합 + 라벨 text_display 자동 부착
오프셋 부호 정정 (v1.0.16 까지 모든 버전이 잘못된 convention 사용):
stone_button[face=wall, facing=X] AABB 는 facing X 쪽 face 에 붙어 안쪽
1/8 만 채움. 따라서 머리 hitbox center 는:
  south  z = 0.0625   (이전 -0.0625)
  north  z = 0.9375   (이전  1.0625)
  east   x = 0.0625   (이전 -0.0625)
  west   x = 0.9375   (이전  1.0625)

이전 부호는 머리 face 의 normal 방향 쪽으로 머리가 "튀어나온다" 라
가정했는데 실제로는 face 의 안쪽 1/8 로 들어가는 구조였음. 그 결과
v1.0.16 의 width=0.125 interaction 은 머리와 겹치지 않고 옆에 떠
있어 (touch only at edge) 클릭이 안 됨.

라벨 text_display 추가 (사용자 요청):
- button_defs 항목에 optional label, label_color, label_font, label_scale
  추가. 색 기본 black, 폰트 기본 minecraft:default, 크기 기본 1.0.
- handler 가 btn_prep 로 기본값 채운 뒤 btn 호출 — 매크로 인자 미존재
  에러 회피.
- btn 안에서 facing 별 위치/yaw 로 text_display 1개 summon. 같은 벽
  (button 머리 반대편 블록) 의 visible 면에 ~0.01 띄워 부착, y-1.
- background:0 (투명) 으로 벽에 직접 새긴 느낌.
- label 이 빈 문자열이면 summon 스킵.

commands/stop 에 stale text_display 정리도 추가 — 옛 정의 이름으로
남은 라벨이 reload 후에도 지워지지 않는 문제 방지.
2026-05-17 04:14:39 +09:00
Claude (owner)
55ab7fc04b music_quiz: 버튼 interaction hitbox 를 3 타일 분할로 정확히 정합
단일 interaction 의 horizontal hitbox 는 width × width 정사각형 강제라
"가로 0.375 × 두께 0.125" 직사각형이 불가능 → 두께 방향만 잡으면
가로 방향이 짧아지고, 가로를 잡으면 두께가 0.375 가 되어 벽 안쪽으로
0.25 묻혀 F3+B 디버그에서 wireframe 이 벽 안과 머리 앞쪽으로 튀어나옴.

해결: width=0.125 interaction 3개를 가로축으로 타일링.
- 각 타일 깊이 0.125 = 버튼 머리 두께와 정확히 일치
- 3 × 0.125 = 0.375 = 버튼 머리 가로와 정확히 일치 (gap 없이 인접)
- facing 별 가로축이 다름: south/north 는 x, east/west 는 z

selector limit=1 제거 — 한 버튼에 interaction 이 3개라 limit=1 두면
MC 가 임의로 1개만 골라 잘못된 entity 만 검사할 수 있음. `on target`
은 클릭된 1개만 통과하므로 limit 없이도 단일 발화가 보장됨.
2026-05-17 04:05:01 +09:00
Claude (owner)
28f1012294 music_quiz: 버튼 interaction 오프셋을 facing 으로부터 자동 계산
button_defs 항목은 이제 {n, x, y, z, f, c} 만 가진다 (ox/oy/oz/w/h 제거).
사용자가 facing 을 바꿀 때마다 손으로 오프셋 표를 옮겨 적을 필요가 없도록
repeat/buttons/btn.mcfunction 한 곳에 facing → 소환 오프셋을 고정해두고
mq:tmp.btn{f:"..."} 분기로 디스패치한다. width/height 도 stone_button
hitbox 에 맞춰 0.375/0.25 로 박제.

handler 는 각 entry 를 mq:tmp.btn 으로 복사한 뒤 btn 을 호출해 분기
predicate 에 사용할 수 있게 한다.
2026-05-17 03:56:41 +09:00
Claude (owner)
4349fddc25 music_quiz: dialog tag entry 에 required:false 추가 — /reload 시 datapack 깨짐 방지
증상:
- /reload 후 다음 에러:
  - Couldn't load tag minecraft:quick_actions as it is missing following references: mq:answer
  - Failed to load function mq:commands/start (Can't find element 'mq:page1' in registry 'minecraft:dialog')
  - Failed to load function mq:answer/open (Can't find element 'mq:answer' ...)

원인:
- MC 의 minecraft:dialog 레지스트리는 hot-reload 불가. /reload 로는 dialog 파일이
  registry 에 등록되지 않음 — 서버 완전 재시작이 필요.
- 그 상태에서 tag 가 `["mq:answer"]` 같은 짧은 형식으로 dialog 를 참조하면
  MC 는 누락된 reference 로 보고 태그 로드 실패 → 같은 reload 의 function 들이
  dialog registry 를 못 찾아 연쇄 실패.

수정:
- quick_actions.json: `"mq:answer"` → `{ "id": "mq:answer", "required": false }`.
  required:false 는 reference 가 없을 때 silently 무시하라는 지시. /reload 직후
  잠시 dialog registry 가 비어있어도 datapack 자체가 깨지지 않음.

주의 (운영):
- 데이터팩 업데이트 후에는 반드시 서버를 완전 재시작 해야 dialog show 호출이
  정상 동작함. /reload 만으로는 dialog 파일이 registry 에 들어가지 않음 — 이건
  MC 26.1 시점의 dialog 시스템 자체 제약 (Smithed/Mojang 문서 기준).
2026-05-17 00:10:51 +09:00
Claude (owner)
a8d09ece02 music_quiz: marker 엔티티 제거 + 노래 재생 채널을 player 로 변경
## marker 제거
모든 marker 소환 코드는 write-only — 어디에서도 @e[type=marker] / tag=default
selector 로 읽거나 죽이지 않았음. interaction 엔티티가 클릭 UI 를 대체한 이후
완전히 쓸모없는 잔존물.

- 삭제: quiz/macro/summon.mcfunction, quiz/macro/summon2.mcfunction (소비처 없음)
- commands/stop.mcfunction: marker_call 빌드 + macro 호출 제거.
  기존 월드에 누적된 legacy marker 청소를 위해 `kill @e[type=minecraft:marker,tag=mq]`
  한 줄 추가 (tag=mq 스코프라 외부 마커는 건드리지 않음).
- quiz/setanswer.mcfunction: 정답 marker 소환 블록 제거.
- init/config.mcfunction: marker 좌표 템플릿 (mq:main marker) 제거.

`answer.title="음악퀴즈"` 대기상태 sentinel 은 marker 외에 reader 가 없지만
다른 reset 의미를 가질 가능성을 고려해 보수적으로 유지.

## 노래 재생 채널을 player 로
init/config.mcfunction: mq:main audio.source 를 "weather" → "player".
play_sound / stop_sound 매크로 모두 동일 source 값을 읽으므로 한 곳 변경으로
모든 노래 재생/정지 채널이 player 채널로 이동. 음악/마스터/플레이어 슬라이더
중 "player" (음성) 슬라이더로 노래 음량 제어 가능.

타이머 비프 / UI 클릭음 등은 "노래 재생" 이 아니므로 weather 채널 그대로 유지.
2026-05-16 23:44:00 +09:00
Claude (owner)
b43d120e66 music_quiz: pack.mcmeta 를 min_format/max_format [101,1] 로 갱신 + normalize/step.mcfunction set string from 파싱 에러 수정
- pack.mcmeta: 25w31a 이후 도입된 min_format/max_format 배열 스펙으로 교체. min_format >= 82 이므로 pack_format 키는 생략.
- step.mcfunction L8, L45: `data modify ... set string from <source>` 는 잘못된 문법. 올바른 형태는 `set string <source> [start] [end]` (from 없음). 이로 인해 8행 부근 파싱이 멈추던 문제 해결.
2026-05-16 23:36:03 +09:00
claude
f0a2e4fb6b music_quiz: [정답 입력] 채팅 메시지 제거 + 외부 모드 설치 검증 가드 추가
- quiz/setanswer.mcfunction: 클릭형 tellraw 제거. dialog/`/trigger input` 인프라는 유지하여 모드 없는 환경 fallback.
- 외부 모드 검증 (load/login/start):
  - mq_chat_mod: 서버 전용 모드 (mc_chat_answer_mod) — `#server mq_chat_mod` fake holder 로 서버 presence 검증.
  - mq_video_mod: 클라이언트 렌더링 모드 (mc_video_player_mod) — 같은 objective 안에 `#server` (서버 컴포넌트 매 tick 갱신) + `<player>` (클라 payload 수신 시 갱신) 두 holder 로 server/client 부재 안내 분리.
  - start.mcfunction: server presence 우선 검사 → per-player client presence 검사. unset 매치 안 되는 selector 이슈는 `add @a ... 0` 으로 materialize.
  - login.mcfunction: 플레이어 join 시 `mq_video_mod=0` 초기화 (stale 1 방지).
- docs/mc_video_player_mod_integration.md: video mod 측 구현 사양 (서버 컴포넌트 매 tick presence pulse + client payload handshake, 주기 재전송 필수 명시).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 22:29:13 +09:00
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
34 changed files with 655 additions and 137 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

@@ -0,0 +1,184 @@
# mc_video_player_mod — 음악퀴즈 데이터팩 연동 사양
음악퀴즈 데이터팩(`music_quiz`)이 영상재생 모드의 **서버 측 + 클라이언트 측**
설치 여부를 둘 다 검증할 수 있도록, 모드의 서버 컴포넌트가 두 가지 점수를
갱신한다.
| holder | 의미 | 갱신 주체 / 시점 |
|--------|------|------------------|
| `#server mq_video_mod` | 서버에 모드 jar 존재 | 서버 컴포넌트가 매 server tick 마다 1 |
| `<player> mq_video_mod` | 해당 플레이어 클라에 모드 존재 | 서버 컴포넌트가 client→server payload 수신 시 1 |
둘 다 같은 objective `mq_video_mod` (dummy) 를 쓰고 holder 이름으로 의미를
구분한다. 데이터팩 `mq:commands/start` 가드는 두 단계로 검사:
서버 부재 → 전원 안내 후 차단 / 일부 플레이어 클라 부재 → 본인 안내 + 차단.
> 참고: 자매 모드 `mc_chat_answer_mod` 는 채팅 가로채기가 본질적으로 서버
> 측 동작이라 `#server mq_chat_mod` 한 가지만 쓴다 (per-player handshake 무의미).
> 본 모드는 클라이언트가 직접 영상 렌더링하므로 per-player handshake 도 필요함.
## 데이터팩 측이 이미 제공하는 것
`music_quiz/data/mq/function/load.mcfunction`
```
scoreboard objectives add mq_video_mod dummy
```
`music_quiz/data/mq/function/players/login.mcfunction` 에서 로그인 시 0
으로 초기화 (handshake 없는 플레이어는 0 유지).
```
scoreboard players set @s mq_video_mod 0
```
`mq:commands/start.mcfunction` 가드:
```mcfunction
# 서버 부재 우선 차단
execute unless score #server mq_video_mod matches 1 run return run function mq:tellraw {"text":"영상재생 모드가 서버에 미설치 — 서버 관리자에게 문의해주세요.","color":"red","msg":""}
# unset 매치 안 되므로 materialize
scoreboard players add @a mq_video_mod 0
# 본인 안내 (tellraw @s 직접 — mq:tellraw 는 @a broadcast 라 부적합)
execute as @a[scores={mq_video_mod=..0}] run tellraw @s ["",{"text":"영상재생 모드 미설치 — 모드 적용 후 다시 입장해주세요.","color":"red"}]
# 한 명이라도 누락이면 시작 차단
execute if entity @a[scores={mq_video_mod=..0}] run return run function mq:tellraw {"text":"필수 모드 미설치 플레이어가 있어 시작할 수 없습니다.","color":"red","msg":""}
```
`load.mcfunction` 에서 `#server mq_video_mod = 0` 으로 미리 깔아둠 → 서버
컴포넌트가 한 tick 도 안 돌면 0 유지 → 가드 차단.
즉, **서버 컴포넌트가 (a) 매 tick `#server mq_video_mod=1` 갱신,
(b) client payload 수신 시 송신 플레이어 점수=1 갱신**, 이 두 가지만 하면
나머지는 데이터팩이 알아서 한다.
## 모드가 구현해야 하는 동작
### 권장: 커스텀 payload handshake (Fabric Networking API / NeoForge Network)
가장 깔끔하고 위변조 방어도 자연스러움. `/trigger` 방식보다 추천.
#### Payload 정의 (공용)
식별자: `mq_video_mod:hello` (또는 자체 modid 네임스페이스).
페이로드 본문은 비어도 되고, 버전 정수 한 개 정도면 충분.
```java
public record HelloPayload(int version) implements CustomPacketPayload {
public static final CustomPacketPayload.Type<HelloPayload> TYPE =
new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath("mq_video_mod", "hello"));
public static final StreamCodec<FriendlyByteBuf, HelloPayload> CODEC =
StreamCodec.composite(ByteBufCodecs.VAR_INT, HelloPayload::version, HelloPayload::new);
@Override public Type<?> type() { return TYPE; }
}
```
#### 클라이언트 측
- payload 를 `PayloadTypeRegistry.playC2S()` 에 등록 (Fabric) /
`IPayloadRegistrar` 에 등록 (NeoForge).
- `ClientPlayConnectionEvents.JOIN` (Fabric) 또는 동등 NeoForge 이벤트에서
서버로 1회 전송 + **이후 5초마다 주기적으로 재전송 (필수)**. 데이터팩
`mq:players/login` 이 spawn dialog 통과 시점에 점수를 0 으로 리셋하기
때문에, JOIN 시점의 1 회 전송만으로는 login 의 리셋이 뒤에 들어와 가드
통과가 실패한다. 주기 재전송으로 login 이후 늦어도 다음 5 초 안에 다시
1 로 복구되어야 정상 동작.
```java
// JOIN 직후 1 회
ClientPlayNetworking.send(new HelloPayload(1));
// + 주기 재전송 (필수). ClientTickEvents.END_CLIENT_TICK 등에서 카운터.
// 100 tick = 5 초 (client 20 tps). 너무 빈번해도 부담 없으니 1~5 초
// 사이로 자유롭게.
```
#### 서버 측 (이 모드의 서버 컴포넌트)
서버 컴포넌트는 **두 가지** 를 한다.
(1) 매 server tick 마다 `#server mq_video_mod = 1` 갱신 (server presence).
점수 값이 변하지 않으면 packet 미전송이므로 매 tick 호출해도 비용 없음.
```java
public static void onServerTick(MinecraftServer server) {
Scoreboard sb = server.getScoreboard();
Objective obj = sb.getObjective("mq_video_mod");
if (obj == null) return; // 데이터팩 미적용 or 아직 load 전
sb.getOrCreatePlayerScore(ScoreHolder.forNameOnly("#server"), obj).set(1);
}
```
Fabric: `ServerTickEvents.END_SERVER_TICK.register(...)`.
NeoForge: `NeoForge.EVENT_BUS.addListener(ServerTickEvent.Post::...)`.
(2) payload 등록 + 수신 시 송신 플레이어 점수 갱신 (client presence).
같은 payload 를 `PayloadTypeRegistry.playC2S()` 에 등록한 뒤:
```java
ServerPlayNetworking.registerGlobalReceiver(HelloPayload.TYPE, (payload, context) -> {
ServerPlayer player = context.player();
MinecraftServer server = player.getServer();
if (server == null) return;
Scoreboard sb = server.getScoreboard();
Objective obj = sb.getObjective("mq_video_mod");
if (obj == null) return; // 데이터팩 미적용 or 아직 load 전
// ServerPlayer 자체가 ScoreHolder — @s selector 와 정확히 매칭
sb.getOrCreatePlayerScore(player, obj).set(1);
});
```
> 참고 구현: `mc_chat_answer_mod` 의 `ChatAnswerCore::markModPresence` 가
> 똑같이 `#server` holder 패턴을 쓴다 (단 그 쪽은 client payload 부분 없음).
#### 타이밍 / 안전망
- 데이터팩 `mq:players/login` 이 spawn dialog 통과 시점에 점수를 0 으로
리셋하므로, **클라 payload 주기 재전송은 필수**. login 이후 다음 재전송
까지의 짧은 공백에 호스트가 start 를 누르면 가드가 차단되니, 재전송
간격은 5 초 이하 권장.
- 서버가 set 한 점수는 다음 join 시 login 에서 다시 0 으로 리셋됨 → 모드를
빼고 재접속한 플레이어가 stale 1 을 가질 일 없음.
- payload 송신 → 서버 처리는 ms 단위 → 주기 재전송이 살아 있는 한 start
타이밍 race 없음.
### 대안: `/trigger` 방식 (별도 서버 컴포넌트 불필요)
데이터팩이 trigger objective 를 만들고 클라 모드가 `/trigger mq_video_mod set 1`
을 채팅 명령으로 전송하는 방식. 단점:
- 데이터팩에 `scoreboard objectives add mq_video_mod trigger` 와 매 join 시
`scoreboard players enable @a mq_video_mod` 가 추가로 필요 (현재는 dummy).
- 클라 모드가 commands 권한으로 채팅 명령을 보내야 함.
- 명령어 packet 이 chat history 에 흔적이 남을 수 있음.
커스텀 payload 가 추천이지만, 서버 컴포넌트를 추가하기 싫다면 이 경로도
가능. 그 경우 데이터팩 측 변경이 필요하니 별도 요청해주세요.
## 동작 흐름 (권장 경로)
1. 서버 시작 → 데이터팩 load → `mq_video_mod` objective 생성.
2. 클라(모드 있음) 접속 → `ClientPlayConnectionEvents.JOIN` → payload 1 회 전송.
3. 서버 모드 수신 → 해당 플레이어 `mq_video_mod = 1`.
4. 플레이어 spawn dialog 통과 → `mq:players/login` 이 점수를 0 으로 리셋.
5. **클라 모드가 주기 재전송 (5 초 이하 권장, 필수)** → 늦어도 다음 주기에
서버 모드가 다시 `mq_video_mod = 1` 로 갱신.
6. 호스트 start → 가드가 `@a[scores={mq_video_mod=..0}]` 검사 → 클라 모드
미설치 플레이어 있으면 시작 차단.
## 테스트
1. **서버 미설치**: 서버에 모드 jar 가 없는 상태에서 데이터팩만 적용 →
호스트 start → "영상재생 모드가 서버에 미설치 — 서버 관리자에게..." 한
줄 출력 후 차단. (`#server mq_video_mod` 가 갱신되지 않음.)
2. **서버 설치 + 일부 클라 미설치**: 모드를 클라에 설치한 플레이어와 안
한 플레이어 혼재 → 호스트 start → 클라 미설치 본인에게 "영상재생 모드
미설치" + 전원에게 "필수 모드 미설치 플레이어가 있어..." 후 차단.
3. **서버 + 모든 클라 설치**: 모두 정상 → start 정상 진행.
4. `/scoreboard players list #server` 로 server presence 점수 확인,
`/scoreboard players list <player>` 로 client presence 점수 확인.
## 참고: 자매 모드 `mc_chat_answer_mod` 의 다른 접근
`mc_chat_answer_mod/common/.../ChatAnswerCore.java::markModPresence` 참고.
서버 전용 모드라 fake player `#server` 한 곳에만 set 한다. 클라이언트
렌더링 모드인 본 모드는 이 패턴이 아닌 per-player handshake 가 정답.

View File

@@ -3,7 +3,6 @@ data modify storage func:temp zero set value 0
$data modify storage func:temp length set value $(length) $data modify storage func:temp length set value $(length)
execute store result score result func.temp run function func:comp_num {n1:"zero",n2:"length"} execute store result score result func.temp run function func:comp_num {n1:"zero",n2:"length"}
# warn-off execute-group
execute if score result func.temp matches 1 run tellraw @s {"text":"length는 1이상 이어야 합니다.","color":"red"} execute if score result func.temp matches 1 run tellraw @s {"text":"length는 1이상 이어야 합니다.","color":"red"}
execute if score result func.temp matches 1 run return 0 execute if score result func.temp matches 1 run return 0

View File

@@ -5,7 +5,7 @@ execute if score length func.temp matches 0 run return 1
execute store result score random func.temp run random value 0..2147483646 execute store result score random func.temp run random value 0..2147483646
scoreboard players operation random func.temp %= length func.temp scoreboard players operation random func.temp %= length func.temp
function func:shuffle/f2 with storage func:temp {index:0} execute run function func:shuffle/f2 with storage func:temp {index:0}
execute store result storage func:temp shuffle.index int 1 run scoreboard players get random func.temp execute store result storage func:temp shuffle.index int 1 run scoreboard players get random func.temp
function func:shuffle/f2 with storage func:temp shuffle function func:shuffle/f2 with storage func:temp shuffle

View File

@@ -3,7 +3,6 @@ data modify storage func:temp zero set value 0
$data modify storage func:temp length set value $(length) $data modify storage func:temp length set value $(length)
execute store result score result func.temp run function func:comp_num {n1:"zero",n2:"length"} execute store result score result func.temp run function func:comp_num {n1:"zero",n2:"length"}
# warn-off execute-group
execute if score result func.temp matches 1 run tellraw @s {"text":"length는 1이상 이어야 합니다.","color":"red"} execute if score result func.temp matches 1 run tellraw @s {"text":"length는 1이상 이어야 합니다.","color":"red"}
execute if score result func.temp matches 1 run return 0 execute if score result func.temp matches 1 run return 0

View File

@@ -3,7 +3,6 @@ execute store result score result func.temp run function func:is_space with stor
$execute store result score result2 func.temp run function func:is_index {l1:"half",l2:"result",index:$(index)} $execute store result score result2 func.temp run function func:is_index {l1:"half",l2:"result",index:$(index)}
# warn-off execute-group
execute if score result2 func.temp matches 0 if score result func.temp matches 0 run data modify storage func:temp text_list append value "" execute if score result2 func.temp matches 0 if score result func.temp matches 0 run data modify storage func:temp text_list append value ""
execute if score result2 func.temp matches 0 if score result func.temp matches 1 run data modify storage func:temp text_list append from storage func:temp space.text execute if score result2 func.temp matches 0 if score result func.temp matches 1 run data modify storage func:temp text_list append from storage func:temp space.text
execute if score result2 func.temp matches 1 run data modify storage func:temp text_list append from storage func:temp space.text execute if score result2 func.temp matches 1 run data modify storage func:temp text_list append from storage func:temp space.text

View File

@@ -9,7 +9,6 @@ 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 들과 순차 비교 (조기 종료)
# warn-off execute-group
execute unless score @s answer matches 1 run data modify storage mq:tmp aliases set from storage mq:main answer.alias execute unless score @s answer matches 1 run data modify storage mq:tmp aliases set from storage mq:main answer.alias
execute unless score @s answer matches 1 run function mq:answer/iter_aliases execute unless score @s answer matches 1 run function mq:answer/iter_aliases

View File

@@ -5,7 +5,6 @@ execute if score init main matches 1..4 run return run function mq:tellraw {"tex
execute if score init main matches 6.. run return run function mq:tellraw {"text":"아직 다음노래가 재생되지 않았습니다.","color":"red",msg:'""'} execute if score init main matches 6.. run return run function mq:tellraw {"text":"아직 다음노래가 재생되지 않았습니다.","color":"red",msg:'""'}
execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"red",msg:'""'} execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"red",msg:'""'}
# warn-off execute-group
execute if score init main matches 5 run data modify storage mq:main hint.text set from storage mq:main answer.title execute if score init main matches 5 run data modify storage mq:main hint.text set from storage mq:main answer.title
execute if score init main matches 5 run data modify storage mq:main hint.hint set value "" execute if score init main matches 5 run data modify storage mq:main hint.hint set value ""
execute if score init main matches 5 run function func:hint with storage mq:main hint execute if score init main matches 5 run function func:hint with storage mq:main hint

View File

@@ -5,6 +5,5 @@ execute if score init main matches 1..4 run return run function mq:tellraw {"tex
execute if score init main matches 6.. run return run function mq:tellraw {"text":"아직 다음노래가 재생되지 않았습니다.","color":"red",msg:'""'} execute if score init main matches 6.. run return run function mq:tellraw {"text":"아직 다음노래가 재생되지 않았습니다.","color":"red",msg:'""'}
execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"red",msg:'""'} execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"red",msg:'""'}
# warn-off execute-group
execute if score init main matches 5 run function mq:quiz/stop_sound execute if score init main matches 5 run function mq:quiz/stop_sound
execute if score init main matches 5 run function mq:quiz/play_sound execute if score init main matches 5 run function mq:quiz/play_sound

View File

@@ -5,6 +5,5 @@ execute if score init main matches 1..4 run return run function mq:tellraw {"tex
execute if score init main matches 6.. run return run function mq:tellraw {"text":"아직 다음노래가 재생되지 않았습니다.","color":"red",msg:'""'} execute if score init main matches 6.. run return run function mq:tellraw {"text":"아직 다음노래가 재생되지 않았습니다.","color":"red",msg:'""'}
execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"red",msg:'""'} execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"red",msg:'""'}
# warn-off execute-group
execute if score init main matches 5 run scoreboard players set skip buttons -2 execute if score init main matches 5 run scoreboard players set skip buttons -2
execute if score init main matches 5 run function mq:quiz/correct execute if score init main matches 5 run function mq:quiz/correct

View File

@@ -64,13 +64,13 @@ bossbar set mq:process players @a
data modify storage mq:main answer set value {title:"음악퀴즈", alias:[]} data modify storage mq:main answer set value {title:"음악퀴즈", alias:[]}
# 이전 버전이 남긴 legacy marker 정리 (현재는 marker 사용 안 함) # 이전 버전이 남긴 legacy marker 정리 (현재는 marker 사용 안 함)
kill @e[distance=0..,tag=mq,type=minecraft:marker] kill @e[type=minecraft:marker,tag=mq]
# 이전 버전이 남긴 잔존 text_display 정리. # 이전 버전이 남긴 잔존 text_display 정리.
# 현재 버튼은 -1 init 단계에서 같은 tag interaction 만 kill 하므로 (n 태그 # 현재 버튼은 -1 init 단계에서 같은 tag interaction 만 kill 하므로 (n 태그
# 가 일치할 때만), 옛 버튼 정의에 있던 이름의 text_display 가 남으면 안 # 가 일치할 때만), 옛 버튼 정의에 있던 이름의 text_display 가 남으면 안
# 지워짐. 여기서 mq 태그 전체를 한 번에 정리해 stale 제거. # 지워짐. 여기서 mq 태그 전체를 한 번에 정리해 stale 제거.
kill @e[distance=0..,tag=mq,type=minecraft:text_display] kill @e[type=minecraft:text_display,tag=mq]
function mq:quiz/stop_sound function mq:quiz/stop_sound
function mq:images/clear function mq:images/clear

View File

@@ -1,8 +1,5 @@
stopsound @a block minecraft:block.stone_button.click_on stopsound @a block minecraft:block.stone_button.click_on
function mq:tellraw {"text":"띵!!!","color":"white","msg":'""'} function mq:tellraw {"text":"띵!!!","color":"white","msg":'""'}
execute as @a at @s run playsound minecraft:block.note_block.bell weather @s ~ ~ ~ 1 0.9
$stopsound @a player $(namespace):bell execute as @a at @s run playsound minecraft:block.note_block.bell weather @s ~ ~ ~ 1 0.9
# warn-off execute-group execute as @a at @s run playsound minecraft:block.note_block.bell weather @s ~ ~ ~ 1 0.9
$execute as @a at @s run playsound $(namespace):bell $(source) @s ~ ~ ~ 1 0.9
$execute as @a at @s run playsound $(namespace):bell $(source) @s ~ ~ ~ 1 0.9
$execute as @a at @s run playsound $(namespace):bell $(source) @s ~ ~ ~ 1 0.9

View File

@@ -1 +1 @@
kill @e[distance=0..,tag=mq_cover,type=minecraft:painting] kill @e[type=minecraft:painting,tag=mq_cover]

View File

@@ -9,16 +9,15 @@
# label_color : 텍스트 색 (예 "black", "red", "#FFAA00"). 기본 "black". # label_color : 텍스트 색 (예 "black", "red", "#FFAA00"). 기본 "black".
# label_font : 텍스트 폰트 (예 "minecraft:default"). 기본 "minecraft:default". # label_font : 텍스트 폰트 (예 "minecraft:default"). 기본 "minecraft:default".
# label_scale : 텍스트 크기 (Vector3f 한 축, 3축 동일). 기본 "1.0". # label_scale : 텍스트 크기 (Vector3f 한 축, 3축 동일). 기본 "1.0".
# label_addY : 추가할 높이. 기본 "-0.1".
# #
# interaction entity 의 위치/크기와 text_display 의 위치/회전은 facing 만 # interaction entity 의 위치/크기와 text_display 의 위치/회전은 facing 만
# 보면 결정됨 — 매번 손으로 ox/oy/oz 를 적지 않는다. 실제 오프셋 테이블은 # 보면 결정됨 — 매번 손으로 ox/oy/oz 를 적지 않는다. 실제 오프셋 테이블은
# repeat/buttons/btn 안에서 한 곳에만 정의되어 있다. # repeat/buttons/btn 안에서 한 곳에만 정의되어 있다.
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:2773, y:86, z:5968, f:"north", c:"function mq:commands/start with storage mq:main", label:"게임시작"} data modify storage mq:main button_defs append value {n:"start", x:364, y:146, z:-263, f:"east", c:"function mq:commands/start with storage mq:main", label:"게임시작"}
data modify storage mq:main button_defs append value {n:"stop", x:2771, y:86, z:5968, f:"north", c:"function mq:commands/stop with storage mq:main", label:"정지"} data modify storage mq:main button_defs append value {n:"stop", x:364, y:146, z:-265, f:"east", c:"function mq:commands/stop with storage mq:main", label:"정지"}
data modify storage mq:main button_defs append value {n:"skip", x:2769, y:86, z:5968, f:"north", c:"function mq:commands/skip", label:"넘기기"} data modify storage mq:main button_defs append value {n:"skip", x:364, y:146, z:-267, f:"east", c:"function mq:commands/skip", label:"넘기기"}
data modify storage mq:main button_defs append value {n:"hint", x:2767, y:86, z:5968, f:"north", c:"function mq:commands/hint", label:"힌트"} data modify storage mq:main button_defs append value {n:"hint", x:364, y:146, z:-269, f:"east", c:"function mq:commands/hint", label:"힌트"}
data modify storage mq:main button_defs append value {n:"replay", x:2765, y:86, z:5968, f:"north", c:"function mq:commands/replay", label:"다시듣기"} data modify storage mq:main button_defs append value {n:"replay", x:364, y:146, z:-271, f:"east", c:"function mq:commands/replay", label:"다시듣기"}
data modify storage mq:main button_defs append value {n:"test", x:2769, y:87, z:5957, f:"south", c:"function mq:commands/test with storage mq:main audio", label:"소리\n테스트", label_addY: "-0.2"} data modify storage mq:main button_defs append value {n:"test", x:144, y:62, z:-213, f:"north", c:"function mq:commands/test", label:"소리 테스트"}

View File

@@ -2,12 +2,13 @@
data modify storage mq:main title set value "음악퀴즈" data modify storage mq:main title set value "음악퀴즈"
# 플레이어 접속 시 텔레포트 위치 (x y z, r=yaw, f=pitch) # 플레이어 접속 시 텔레포트 위치 (x y z, r=yaw, f=pitch)
data modify storage mq:main spawn set value {x: 2769, y: 85, z: 5963, r: 0, f: 0} data modify storage mq:main spawn set value {x: 144, y: 61, z: -219, r: 180, f: 0}
# 음원 재생 — minecraft_launcher 리소스팩의 musicquiz:track_NN 사운드 이벤트 # 음원 재생 — minecraft_launcher 리소스팩의 musicquiz:track_NN 사운드 이벤트
# namespace — 리소스팩 네임스페이스 (기본 "musicquiz") # namespace — 리소스팩 네임스페이스 (기본 "musicquiz")
# source — /playsound 채널. stopsound 와 동일해야 함. 노래는 "player" 채널로 # source — /playsound 채널. stopsound 와 동일해야 함. 노래는 "player" 채널로
# 재생 (음성/플레이어 채널 슬라이더로 음량 제어). # 재생 (음성/플레이어 채널 슬라이더로 음량 제어). 타이머/UI 비프는
# 별도로 weather 채널 사용.
# volume — 기본 음량. 곡별 override 는 init/songs.mcfunction 의 volume 필드 사용 # volume — 기본 음량. 곡별 override 는 init/songs.mcfunction 의 volume 필드 사용
# pitch — 1.0 = 원본 속도 # pitch — 1.0 = 원본 속도
data modify storage mq:main audio set value {namespace: "musicquiz", source: "player", volume: 1.0, pitch: 1.0} data modify storage mq:main audio set value {namespace: "musicquiz", source: "player", volume: 1.0, pitch: 1.0}
@@ -16,6 +17,6 @@ data modify storage mq:main audio set value {namespace: "musicquiz", source: "pl
# namespace — painting_variant 네임스페이스 (기본 "mq") # 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: "mq", x: 2775, y: 85, z: 5982, facing: 2b} data modify storage mq:main image set value {namespace: "mq", x: 144, y: 84, z: -261, facing: 0b}
# 곡 개수 max_index 는 init/songs.mcfunction 의 길이로 자동 계산됨 # 곡 개수 max_index 는 init/songs.mcfunction 의 길이로 자동 계산됨

View File

@@ -4,23 +4,56 @@
# 곡 순서가 리소스팩의 track_NN / cover_NN 인덱스와 1:1 매칭된다. # 곡 순서가 리소스팩의 track_NN / cover_NN 인덱스와 1:1 매칭된다.
# 예) {title:"Quiet Song", author:"...", alias:[...], volume:2.0} # 예) {title:"Quiet Song", author:"...", alias:[...], volume:2.0}
data modify storage mq:main songs set value [] data modify storage mq:main songs set value []
data modify storage mq:main songs append value {title:"푸르던", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"Lose My Mind", author:"Don Toliver", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"금요일에 만나요", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"The Chase", author:"Hearts2Hearts", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"나의 옛날이야기", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"HOT SAUCE", author:"BABYMONSTER", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"비밀의 화원", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"Golden", author:"HUNTR/X", alias:[""," "], volume:1.0}
data modify storage mq:main songs append value {title:"겨울잠", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"돌림판", author:"머쉬베놈", alias:["Spin the wheel"], volume:1.0}
data modify storage mq:main songs append value {title:"이런엔딩", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"OVERDRIVE", author:"TWS", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"이름에게", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"눈물참기", author:"QWER", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"드라마", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"깨어", author:"tripleS", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"가을아침", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"like JENNIE", author:"제니", alias:[" "," "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"Rain Drop", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"Rich Man", author:"aespa", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"에필로그", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"I DO ME", author:"KiiiKiii", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"무릎", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"SIGN", author:"izna", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"마음", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"WICKED", author:"ALLDAY PROJECT", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"잠 못 드는 밤 비는 내리고", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"Good Thing", author:"i-dle", alias:["굿 "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"정거장", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"0+0", author:"한로로", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"자장가", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"HANDS UP", author:"MEOVV", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"사랑이 지나가면", author:"아이유", alias:[]} data modify storage mq:main songs append value {title:"Blue Valentine", author:"NMIXX", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"Flower", author:"오반", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"Soda Pop", author:"Saja Boys", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"REBEL HEART", author:"IVE", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"GO!", author:"CORTIS", alias:["","!","GO","","!"], volume:1.0}
data modify storage mq:main songs append value {title:"BEEP", author:"izna", alias:["","",""], volume:1.0}
data modify storage mq:main songs append value {title:"Pookie", author:"FIFTY FIFTY", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"DAISIES", author:"Justin Bieber", alias:["","",""], volume:1.0}
data modify storage mq:main songs append value {title:"빌려온 고양이", author:"ILLIT", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"TOO BAD", author:"OfficialGDRAGON", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"시작의 아이", author:"마크툽", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"STYLE", author:"Hearts2Hearts", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"Good Goodbye", author:"화사", alias:["굿 굿"," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"너에게 닿기를", author:"10CM", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"IRIS OUT", author:"Kenshi Yonezu", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"Sugar On My Tongue", author:"Tyler, The Creator", alias:[" "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"Hollywood Action", author:"BOYNEXTDOOR", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"SPAGHETTI", author:"LE SSERAFIM", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"Gabriela", author:"KATSEYE", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"LIKE YOU BETTER", author:"프로미스나인", alias:[" "," "," "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"뛰어", author:"BLACKPINK", alias:["jump"], volume:1.0}
data modify storage mq:main songs append value {title:"CHANEL", author:"Tyla", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"오늘만 I LOVE YOU", author:"BOYNEXTDOOR", alias:[" "," "], volume:1.0}
data modify storage mq:main songs append value {title:"earthquake", author:"지수", alias:["","",""," "], volume:1.0}
data modify storage mq:main songs append value {title:"윽!", author:"염따", alias:[""], volume:1.0}
data modify storage mq:main songs append value {title:"Abracadabra", author:"Lady Gaga", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"멸종위기사랑", author:"이찬혁", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"Dirty Work", author:"aespa", alias:[" "," "," "," "," "], volume:1.0}
data modify storage mq:main songs append value {title:"HOT", author:"LE SSERAFIM", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"FAMOUS", author:"ALLDAY PROJECT", alias:["",""], volume:1.0}
data modify storage mq:main songs append value {title:"XOXZ", author:"IVE", alias:[" "," ",""], volume:1.0}
data modify storage mq:main songs append value {title:"여름이었다", author:"H1-KEY", alias:[], volume:1.0}
data modify storage mq:main songs append value {title:"LOV3", author:"식케이", alias:["3","3"], volume:1.0}
data modify storage mq:main songs append value {title:"Drive", author:"Ed Sheeran", alias:["",""], volume:1.0}
# 곡 개수는 songs 배열 길이에서 자동 계산됨 # 곡 개수는 songs 배열 길이에서 자동 계산됨
execute store result storage mq:main max_index int 1 run data get storage mq:main songs execute store result storage mq:main max_index int 1 run data get storage mq:main songs

View File

@@ -1,9 +0,0 @@
$execute unless data storage mq:main {answer:{title:"음악퀴즈"}} run summon minecraft:marker $(x) $(y) $(z) {Tags:["mq","default"],CustomName:"정답입력시작"}
$summon minecraft:marker $(x) $(y) $(z) {Tags:["mq","default"],CustomName:"$(name)"}
execute store result score length func.temp run data get storage mq:tmp marker_call.alias
execute if score length func.temp matches 1.. run data modify storage mq:tmp marker_call.name set from storage mq:tmp marker_call.alias[0]
execute if score length func.temp matches 1.. run data remove storage mq:tmp marker_call.alias[0]
execute if score length func.temp matches 1.. run function mq:quiz/macro/summon2 with storage mq:tmp marker_call
$execute unless data storage mq:main {answer:{title:"음악퀴즈"}} run summon minecraft:marker $(x) $(y) $(z) {Tags:["mq","default"],CustomName:"정답입력종료"}

View File

@@ -1,6 +0,0 @@
$summon minecraft:marker $(x) $(y) $(z) {Tags:["mq","default"],CustomName:"$(name)"}
execute store result score length func.temp run data get storage mq:tmp marker_call.alias
execute if score length func.temp matches 1.. run data modify storage mq:tmp marker_call.name set from storage mq:tmp marker_call.alias[0]
execute if score length func.temp matches 1.. run data remove storage mq:tmp marker_call.alias[0]
execute if score length func.temp matches 1.. run function mq:quiz/macro/summon2 with storage mq:tmp marker_call

View File

@@ -1,7 +1,5 @@
scoreboard players set timer main 0 scoreboard players set timer main 0
stopsound @a player
execute if score index main >= max_index main run return run function mq:quiz/end with storage mq:main execute if score index main >= max_index main run return run function mq:quiz/end with storage mq:main
scoreboard players add index main 1 scoreboard players add index main 1

View File

@@ -1,6 +1,5 @@
# warn-off-file always-pass-condition
# 버튼 1개에 대한 매 tick 처리. # 버튼 1개에 대한 매 tick 처리.
# 매크로 인자(mq:tmp.btn): n, x, y, z, f, c, label, label_color, label_font, label_scale, label_addY # 매크로 인자(mq:tmp.btn): n, x, y, z, f, c, label, label_color, label_font, label_scale
# buttons 점수 상태: # buttons 점수 상태:
# ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단) # ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단)
# -1 : 초기화 단계 (버튼 블록 + interaction × 3 + text_display 보장 후 0) # -1 : 초기화 단계 (버튼 블록 + interaction × 3 + text_display 보장 후 0)
@@ -66,39 +65,39 @@
# data modify entity @e[...] 는 대상 1개 강제 → interaction 3개 모드에선 # data modify entity @e[...] 는 대상 1개 강제 → interaction 3개 모드에선
# 못 쓰므로 그냥 kill. 어차피 버튼 블록도 air 로 바꾸므로 라벨도 같이 제거. # 못 쓰므로 그냥 kill. 어차피 버튼 블록도 air 로 바꾸므로 라벨도 같이 제거.
$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 kill @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] $execute if score $(n) buttons matches ..-2 run kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
# $execute if score $(n) buttons matches ..-2 run kill @e[type=minecraft:text_display,tag=mq,tag=$(n)] $execute if score $(n) buttons matches ..-2 run kill @e[type=minecraft:text_display,tag=mq,tag=$(n)]
$execute if score $(n) buttons matches ..-2 run return 0 $execute if score $(n) buttons matches ..-2 run return 0
# ---- 초기화: 블록 + interaction × 3 + text_display 보장 ---- # ---- 초기화: 블록 + interaction × 3 + text_display 보장 ----
$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 run kill @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] $execute if score $(n) buttons matches -1 run kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
$execute if score $(n) buttons matches -1 run kill @e[distance=0..,tag=mq,tag=$(n),type=minecraft:text_display] $execute if score $(n) buttons matches -1 run kill @e[type=minecraft:text_display,tag=mq,tag=$(n)]
# south: 깊이축=z(+0.1875, 플레이어 쪽), 가로축=x, 3 타일 + 라벨 # south: 깊이축=z(+0.1875, 플레이어 쪽), 가로축=x, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.37 ~0.37 ~0.07 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.375 ~0.375 ~0.1875 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.37 ~0.07 {Tags:["mq","$(n)"],width:0.13f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.375 ~0.1875 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.63 ~0.37 ~0.07 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.625 ~0.375 ~0.1875 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.5 ~-0.5 ~0.01 {Tags:["mq","$(n)"],Rotation:[0f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,$(label_addY)f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}} $execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.5 ~-0.25 ~0.01 {Tags:["mq","$(n)"],Rotation:[0f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
# north: 깊이축=z(+0.8125, 플레이어 쪽), 가로축=x, 3 타일 + 라벨 # north: 깊이축=z(+0.8125, 플레이어 쪽), 가로축=x, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.37 ~0.37 ~0.93 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.375 ~0.375 ~0.8125 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.37 ~0.93 {Tags:["mq","$(n)"],width:0.13f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.375 ~0.8125 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.63 ~0.37 ~0.93 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.625 ~0.375 ~0.8125 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.5 ~-0.5 ~0.99 {Tags:["mq","$(n)"],Rotation:[180f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,$(label_addY)f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}} $execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.5 ~-0.25 ~0.99 {Tags:["mq","$(n)"],Rotation:[180f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
# east: 깊이축=x(+0.1875, 플레이어 쪽), 가로축=z, 3 타일 + 라벨 # east: 깊이축=x(+0.1875, 플레이어 쪽), 가로축=z, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.07 ~0.37 ~0.37 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.1875 ~0.375 ~0.375 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.07 ~0.37 ~0.5 {Tags:["mq","$(n)"],width:0.13f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.1875 ~0.375 ~0.5 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.07 ~0.37 ~0.63 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.1875 ~0.375 ~0.625 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.01 ~-0.5 ~0.5 {Tags:["mq","$(n)"],Rotation:[-90f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,$(label_addY)f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}} $execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.01 ~-0.25 ~0.5 {Tags:["mq","$(n)"],Rotation:[-90f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
# west: 깊이축=x(+0.8125, 플레이어 쪽), 가로축=z, 3 타일 + 라벨 # west: 깊이축=x(+0.8125, 플레이어 쪽), 가로축=z, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.93 ~0.37 ~0.37 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.8125 ~0.375 ~0.375 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.93 ~0.37 ~0.5 {Tags:["mq","$(n)"],width:0.13f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.8125 ~0.375 ~0.5 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.93 ~0.37 ~0.63 {Tags:["mq","$(n)"],width:0.125f,height:0.26f,response:0b} $execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.8125 ~0.375 ~0.625 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.99 ~-0.5 ~0.5 {Tags:["mq","$(n)"],Rotation:[90f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,$(label_addY)f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}} $execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.99 ~-0.25 ~0.5 {Tags:["mq","$(n)"],Rotation:[90f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
$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
@@ -108,11 +107,10 @@ $execute if score $(n) buttons matches -1 run scoreboard players set $(n) button
# 한 버튼에 interaction 3개지만 `on target` 은 클릭된 1개만 통과 # 한 버튼에 interaction 3개지만 `on target` 은 클릭된 1개만 통과
# (나머지는 target 부재로 체인 중단). limit=1 을 두면 MC 가 임의로 1개를 # (나머지는 target 부재로 체인 중단). limit=1 을 두면 MC 가 임의로 1개를
# 골라 잘못된 entity 만 검사하므로 limit 두지 않음. # 골라 잘못된 entity 만 검사하므로 limit 두지 않음.
$execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target as @s positioned $(x).0 $(y).0 $(z).0 run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1 $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] on target as @s positioned $(x).0 $(y).0 $(z).0 run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1
$execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target if data storage mq:tmp btn{n:"test"} run $(c) $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] on target as @s positioned $(x).0 $(y).0 $(z).0 if score init main matches 0 run $(c)
$execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target unless data storage mq:tmp btn{n:"test"} as @s positioned $(x).0 $(y).0 $(z).0 if score init main matches 0 run $(c) $execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] on target as @s positioned $(x).0 $(y).0 $(z).0 unless score init main matches 0 run trigger $(n)
$execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] on target unless data storage mq:tmp btn{n:"test"} as @s positioned $(x).0 $(y).0 $(z).0 unless score init main matches 0 run trigger $(n)
# ---- 처리 후 attack/interaction NBT 클리어 (다음 tick 중복 발화 방지) ---- # ---- 처리 후 attack/interaction NBT 클리어 (다음 tick 중복 발화 방지) ----
$execute as @e[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] 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[distance=0..,tag=mq,tag=$(n),type=minecraft:interaction] 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

@@ -6,7 +6,6 @@
# label_color : 기본 "black" # label_color : 기본 "black"
# label_font : 기본 "minecraft:default" # label_font : 기본 "minecraft:default"
# label_scale : 기본 "1.0" (Vector3f 의 한 축, 3축 동일하게 사용됨) # label_scale : 기본 "1.0" (Vector3f 의 한 축, 3축 동일하게 사용됨)
# label_addY : 기본 "-0.1"
# #
# 구현: defaults 컴파운드를 먼저 만들고 entry (mq:tmp.btn) 를 그 위에 merge # 구현: defaults 컴파운드를 먼저 만들고 entry (mq:tmp.btn) 를 그 위에 merge
# 한 뒤 다시 mq:tmp.btn 으로 되돌린다. data modify ... merge from 은 source # 한 뒤 다시 mq:tmp.btn 으로 되돌린다. data modify ... merge from 은 source
@@ -17,6 +16,6 @@
# 방식이었으나 MC 26.1.2 parser 가 해당 라인을 거부했음. merge 방식은 문제 # 방식이었으나 MC 26.1.2 parser 가 해당 라인을 거부했음. merge 방식은 문제
# 난 execute-unless-data 구문 자체를 제거.) # 난 execute-unless-data 구문 자체를 제거.)
data modify storage mq:tmp btn_default set value {label:"",label_color:"black",label_font:"minecraft:default",label_scale:"1.0",label_addY:"-0.1"} data modify storage mq:tmp btn_default set value {label:"",label_color:"black",label_font:"minecraft:default",label_scale:"1.0"}
data modify storage mq:tmp btn_default merge from storage mq:tmp btn data modify storage mq:tmp btn_default merge from storage mq:tmp btn
data modify storage mq:tmp btn set from storage mq:tmp btn_default data modify storage mq:tmp btn set from storage mq:tmp btn_default

View File

@@ -6,10 +6,44 @@ execute unless score init main matches 2 \
run scoreboard players set timer main 0 run scoreboard players set timer main 0
# start title timer # start title timer
execute if score init main matches 2 run function mq:repeat/timers/init2 with storage mq:main audio execute if score init main matches 2 if score timer main matches 20 run title @a title {"text":"3"}
execute if score init main matches 2 if score timer main matches 20 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 20 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 20 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 40 run title @a title {"text":"2"}
execute if score init main matches 2 if score timer main matches 40 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 40 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 40 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 60 run title @a title {"text":"1"}
execute if score init main matches 2 if score timer main matches 60 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 60 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 60 as @a at @s run playsound minecraft:block.note_block.iron_xylophone weather @s ~ ~ ~ 1 1
execute if score init main matches 2 if score timer main matches 100 run title @a title {"text":""}
execute if score init main matches 2 if score timer main matches 100.. run function mq:quiz/select with storage mq:main
# next song timer # next song timer
execute if score init main matches 6 run function mq:repeat/timers/init6 execute if score init main matches 6 if score timer main matches 300 run title @a title {"text":""}
execute if score init main matches 6 if score timer main matches 290 run function mq:images/clear
execute if score init main matches 6 if score timer main matches 300.. run function mq:quiz/select with storage mq:main
# endding timer # endding timer
execute if score init main matches 10 run function mq:repeat/timers/init10 with storage mq:main audio execute if score init main matches 10 if score timer main matches 60 run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"white","msg":""}
execute if score init main matches 10 if score timer main matches 60 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 60 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 60 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 180 run function mq:tellraw {"text":"퀴즈를 다시 시작하시려면 종료를 눌러주세요.","color":"white","msg":""}
execute if score init main matches 10 if score timer main matches 120 as @a at @s run scoreboard players set stop buttons -1
execute if score init main matches 10 if score timer main matches 120 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 120 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 120 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 120 run function mq:tellraw {"text":"플레이 해주셔서 감사합니다.","color":"white","msg":""}
execute if score init main matches 10 if score timer main matches 180 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 180 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 180 as @a at @s run playsound minecraft:ui.button.click weather @s ~ ~ ~ 1 1
execute if score init main matches 10 if score timer main matches 200.. run scoreboard players set init main 11

View File

@@ -1,15 +0,0 @@
# warn-off-file execute-group
execute if score timer main matches 60 run function mq:tellraw {"text":"퀴즈가 종료되었습니다.","color":"white","msg":""}
$execute if score timer main matches 60 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 60 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 60 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
execute if score timer main matches 180 run function mq:tellraw {"text":"퀴즈를 다시 시작하시려면 종료를 눌러주세요.","color":"white","msg":""}
execute if score timer main matches 120 as @a at @s run scoreboard players set stop buttons -1
$execute if score timer main matches 120 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 120 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 120 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
execute if score timer main matches 120 run function mq:tellraw {"text":"플레이 해주셔서 감사합니다.","color":"white","msg":""}
$execute if score timer main matches 180 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 180 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 180 as @a at @s run playsound minecraft:ui.button.click $(source) @s ~ ~ ~ 1 1
execute if score timer main matches 200.. run scoreboard players set init main 11

View File

@@ -1,15 +0,0 @@
# warn-off-file execute-group
execute if score timer main matches 20 run title @a title {"text":"3"}
$execute if score timer main matches 20 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 20 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 20 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
execute if score timer main matches 40 run title @a title {"text":"2"}
$execute if score timer main matches 40 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 40 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 40 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
execute if score timer main matches 60 run title @a title {"text":"1"}
$execute if score timer main matches 60 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 60 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
$execute if score timer main matches 60 as @a at @s run playsound minecraft:block.note_block.iron_xylophone $(source) @s ~ ~ ~ 1 1
execute if score timer main matches 100 run title @a title {"text":""}
execute if score timer main matches 100.. run function mq:quiz/select with storage mq:main

View File

@@ -1,3 +0,0 @@
execute if score timer main matches 300 run title @a title {"text":""}
execute if score timer main matches 290 run function mq:images/clear
execute if score timer main matches 300.. run function mq:quiz/select with storage mq:main

View File

@@ -1,4 +1,3 @@
# warn-off execute-group
execute if score init main matches 0..1 run scoreboard players enable @a ready execute if score init main matches 0..1 run scoreboard players enable @a ready
execute if score init main matches 0..1 as @a if score @s ready matches 1 run function mq:tellraw {"text":"","color":"black",msg:[{"selector":"@s","color": "yellow","bold": true},{"text":" : ","color":"gray"},{"text":"준비완료","color":"white"}]} execute if score init main matches 0..1 as @a if score @s ready matches 1 run function mq:tellraw {"text":"","color":"black",msg:[{"selector":"@s","color": "yellow","bold": true},{"text":" : ","color":"gray"},{"text":"준비완료","color":"white"}]}
execute if score init main matches 0..1 as @a if score @s ready matches 1 run scoreboard players set @s ready 2 execute if score init main matches 0..1 as @a if score @s ready matches 1 run scoreboard players set @s ready 2

View File

@@ -6,6 +6,5 @@ execute if score init main matches 2.. run function mq:repeat/timer
execute if score init main matches 5..6 run function mq:repeat/check_answer execute if score init main matches 5..6 run function mq:repeat/check_answer
# 정답 입력 다이얼로그: init=5 (곡 재생 중) 일 때만 열림 / 제출 처리 # 정답 입력 다이얼로그: init=5 (곡 재생 중) 일 때만 열림 / 제출 처리
# warn-off execute-group
execute if score init main matches 5 as @a[scores={input=1..}] run function mq:answer/open execute if score init main matches 5 as @a[scores={input=1..}] run function mq:answer/open
execute if score init main matches 5 run function mq:answer/process execute if score init main matches 5 run function mq:answer/process

104
temp/README.md Normal file
View File

@@ -0,0 +1,104 @@
# 부분 적용 가이드 (→ v1.0.24)
전체 datapack 을 교체하지 않고, 이 폴더의 파일만 덮어쓰면 v1.0.24 와 동일한 상태가 됩니다.
## v1.0.24 의 변경 — 버튼 라벨 위치 & 인터랙션 깊이 방향 수정
증상 두 가지:
1. **라벨이 벽에 안 붙고 바닥에 떨어져 표시.** 버튼 바로 아래 벽면 가운데에
있어야 할 라벨이 한 칸 아래 바닥 근처에 떠 있음.
2. **interaction 박스가 벽 안쪽으로 들어감.** 버튼 머리보다 플레이어 쪽으로
튀어나와야 하는데 반대로 벽 속에 박혀 있어 각도에 따라 클릭이 벽에 먼저
막힘.
원인 두 가지:
1. `text_display` 의 entity Y 는 텍스트 윗변이고 text 는 아래로 자란다. Y
오프셋을 `~-1` 로 잡았더니 텍스트 윗변이 한 칸 아래로 내려가 결국 바닥에
표시됨.
2. v1.0.21 에서 "interaction 을 버튼 hitbox 바깥으로 한 두께만큼 밀어 stone
button 동시 발화 회피" 의도였는데 부호를 반대로 잡았음. `facing=south`
는 버튼 머리가 +z 방향 (= 플레이어 쪽) 인데 interaction 을 -z (= 벽 쪽)
로 보내서 벽 안에 박힘. 이전엔 우연히 raycast tie 로 interaction 이
이겨서 동작했지만, 호스트/각도에 따라 벽이 먼저 차단되는 케이스가 발생.
수정:
- `text_display` Y: `~-1``~-0.25`. 텍스트 윗변이 버튼 바로 아래에 위치,
한 줄이 버튼 아래 한 칸 벽면 [Y-1, Y] 의 위쪽 절반에 자리잡음.
- `text_display` 텍스트에 `bold:true` 기본 적용.
- interaction 깊이 부호 반전:
- south: z `~-0.0625``~0.1875` (벽 z=0 의 +z 쪽, 플레이어 측)
- north: z `~1.0625``~0.8125` (벽 z=1 의 -z 쪽, 플레이어 측)
- east: x `~-0.0625``~0.1875`
- west: x `~1.0625``~0.8125`
이 변경은 `repeat/buttons/btn.mcfunction` 한 파일에만 있음. 모드 jar 변경
없음 — v1.0.23 와 같은 `mc_chat_answer_mod` v1.3.7 그대로 사용.
## 같이 포함된 이전 fix (v1.0.20 ~ v1.0.23)
### v1.0.23 — 채팅정답 모드 false negative 의 진짜 fix
검증 게이트는 유지하고, 모드 쪽 presence pulse 지점을 넷으로 확장
(`SERVER_STARTED` + `END_DATA_PACK_RELOAD` + `PlayerJoin` + `ServerTick`).
진짜 fix 는 `mc_chat_answer_mod` v1.3.7 에 들어 있음.
### v1.0.21
- interaction 깊이축을 stone_button hitbox 바깥쪽으로 이동 (한 번 클릭에
stone_button 도 같이 눌리던 powered=true 문제 회피). — **부호는 v1.0.24
에서 수정.**
- `text_display.text` 를 String JSON 에서 직접 TextComponent compound 로
(MC 1.20.5+ 에서 라벨이 코드 그대로 렌더되던 문제 회피).
### v1.0.20
- `positioned $(x) $(y) $(z)``$(x).0 $(y).0 $(z).0` (MC vec3 정수 인자
자동 +0.5 보정 회피).
- `btn_prep.mcfunction`: `execute unless data storage ...` 가 MC 26.1.2
파서에 거부되던 문제 → defaults + `data modify ... merge from` 으로 재작성.
## 적용 방법
### 1. `mc_chat_answer_mod` v1.3.7 사용 (v1.0.23 와 동일)
이미 v1.3.7 을 쓰고 있으면 그대로 두면 됨. 아직 구버전이면 교체:
다운로드: https://git.tkrmagid.kr/tkrmagid/mc_chat_answer_mod/releases/tag/v1.3.7
서버 mods 폴더에서 기존 `chat_answer-*.jar` 제거 후 `chat_answer-1.3.7.jar`
투입, 서버 재시작.
### 2. 데이터팩 파일 덮어쓰기
서버의 datapack 폴더 (예: `world/datapacks/music_quiz/`) 기준으로 이 폴더의
파일을 **같은 경로에 덮어쓰세요**.
v1.0.24 에서 실제로 바뀐 파일은 `btn.mcfunction` 하나지만, 이전 단계를
건너뛰고 올라오는 경우를 위해 v1.0.23 의 4 파일을 그대로 동봉:
```
temp/data/mq/function/commands/start.mcfunction
-> <datapack>/data/mq/function/commands/start.mcfunction
temp/data/mq/function/load.mcfunction
-> <datapack>/data/mq/function/load.mcfunction
temp/data/mq/function/repeat/buttons/btn.mcfunction
-> <datapack>/data/mq/function/repeat/buttons/btn.mcfunction
temp/data/mq/function/repeat/buttons/btn_prep.mcfunction
-> <datapack>/data/mq/function/repeat/buttons/btn_prep.mcfunction
```
복사 후 게임 안에서:
```
/reload
```
## 확인
- 버튼 라벨이 버튼 바로 아래 벽면 가운데에 굵게 (bold) 표시.
- 버튼을 클릭할 때 stone_button 의 powered 애니메이션 없음.
- 비스듬한 각도에서도 interaction 이 벽에 가려지지 않고 잘 클릭됨
(interaction 박스가 버튼 머리보다 플레이어 쪽으로 튀어나와 있음).
- 채팅정답 모드가 설치되어 있으면 `/start` 정상 진행. 없으면 "채팅정답
모드 미설치" 로 차단 (가드 살아 있음).
- 콘솔에 파싱 에러 없음.

View File

@@ -0,0 +1,41 @@
execute if score init main matches 10 run return run function mq:tellraw {"text":"퀴즈가 완전히 종료된후 시작해주세요.","color":"red","msg":""}
# ---- 외부 모드 설치 검증 ----
# 두 모드는 성격이 달라서 검증 방식이 다름:
#
# * mq_chat_mod : mc_chat_answer_mod = 서버 전용 모드 (채팅 가로채기는
# 서버에서 일어남, 클라 설치 불필요). 따라서 fake player `#server`
# 점수를 모드가 매 server tick 마다 1 로 set. 서버에 모드가 없으면
# 이 점수가 갱신되지 않음.
#
# * mq_video_mod : mc_video_player_mod = 클라이언트 측 렌더링 + 서버 측
# 컴포넌트. 같은 objective 안에 holder 두 종류 사용:
# - `#server mq_video_mod` : 서버 컴포넌트가 매 tick 1 로 갱신 (server
# presence). 없으면 0 → 서버에 모드 미설치.
# - `<player> mq_video_mod` : 클라 join 시 payload 가 서버로 오면 서버
# 컴포넌트가 해당 플레이어 점수를 1 로 set (client presence). 클라
# 미설치면 0 유지.
# 이렇게 분리해야 "서버 미설치"와 "특정 플레이어 클라 미설치"가 안내에서
# 구분된다.
#
# 1) 서버 측 모드 부재 — 전원 차단, 단일 안내. 서버 부재는 클라 검사보다
# 우선해야 — 클라가 다 설치되어 있어도 서버가 없으면 동작 안 한다.
execute unless score #server mq_chat_mod matches 1 run return run function mq:tellraw {"text":"채팅정답 모드가 서버에 미설치 — 서버 관리자에게 문의해주세요.","color":"red","msg":""}
execute unless score #server mq_video_mod matches 1 run return run function mq:tellraw {"text":"영상재생 모드가 서버에 미설치 — 서버 관리자에게 문의해주세요.","color":"red","msg":""}
# 2) 클라이언트 측 모드 (mc_video_player_mod) 부재 — 본인 누락 안내 + 차단.
# selector `scores={X=..0}` 는 점수 미존재를 매치하지 않으므로 직전에
# `add @a ... 0` 으로 materialize. 개인 안내는 tellraw @s 직접 (mq:tellraw
# 는 내부 @a broadcast 라 부적합).
scoreboard players add @a mq_video_mod 0
execute as @a[scores={mq_video_mod=..0}] run tellraw @s ["",{"text":"영상재생 모드 미설치 — 모드 적용 후 다시 입장해주세요.","color":"red"}]
execute if entity @a[scores={mq_video_mod=..0}] run return run function mq:tellraw {"text":"필수 모드 미설치 플레이어가 있어 시작할 수 없습니다.","color":"red","msg":""}
setblock ~ ~ ~ minecraft:air
function mq:quiz/stop_sound
$scoreboard players set max_index main $(max_index)
scoreboard players set init main 1
dialog show @a mq:page1

View File

@@ -0,0 +1,47 @@
data modify storage mq:main answer set value {title:"", author:"", alias:[]}
data merge storage func:temp {}
data merge storage mq:tmp {}
function mq:init/config
function mq:init/songs
function mq:init/buttons
function mq:init/triggers
function mq:tellraw {"text":"서버 리로드 성공!","color":"white","msg":'""'}
scoreboard objectives remove func.temp
scoreboard objectives remove main
scoreboard objectives remove buttons
scoreboard objectives remove answer
scoreboard objectives remove leave_game
scoreboard objectives add func.temp dummy
scoreboard objectives add main dummy
scoreboard objectives add buttons dummy
scoreboard objectives add answer dummy
scoreboard objectives add leave_game custom:leave_game
# 외부 모드 존재 확인용 점수.
# mq_chat_mod : 서버 전용 모드(mc_chat_answer_mod). 모드가 매 server tick
# 마다 fake player `#server` 점수를 1 로 set. 모드가 서버에 없으면 0 유지.
# mq_video_mod : 클라이언트 모드(mc_video_player_mod). 클라 join 시 서버로
# handshake payload 전송 → 서버 측 모드가 해당 플레이어 점수를 1 로 set.
# 클라에 모드가 없으면 0 유지. (login.mcfunction 에서 플레이어별 0 초기화.)
scoreboard objectives remove mq_chat_mod
scoreboard objectives remove mq_video_mod
scoreboard objectives add mq_chat_mod dummy
scoreboard objectives add mq_video_mod dummy
# /reload 후 모드가 한 tick 도 돌기 전에 start 가 호출될 수 있으니
# #server 점수도 0 으로 materialize. 모드가 살아 있으면 다음 tick 에 1 로 갱신.
# mq_video_mod 도 같은 objective 안에서 holder 만 다르게 — `#server` 는 서버
# 컴포넌트 존재 (서버 측 모드가 매 tick 1 로 갱신), `<player>` 는 클라 측
# 존재 (payload 수신 시 1 로 갱신).
scoreboard players set #server mq_chat_mod 0
scoreboard players set #server mq_video_mod 0
scoreboard players set two func.temp 2
bossbar add mq:process [{"text":"진행도: ","color": "yellow","bold": true},{"text":"0","color": "yellow","bold": true},{"text":"/","color": "yellow","bold": true},{"text":"0","color": "yellow","bold": true}]
function mq:commands/stop with storage mq:main
function mq:players/login with storage mq:main spawn

View File

@@ -0,0 +1,116 @@
# 버튼 1개에 대한 매 tick 처리.
# 매크로 인자(mq:tmp.btn): n, x, y, z, f, c, label, label_color, label_font, label_scale
# buttons 점수 상태:
# ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단)
# -1 : 초기화 단계 (버튼 블록 + interaction × 3 + text_display 보장 후 0)
# 0 : 정상 (interaction 클릭 대기)
#
# interaction/text_display entity 는 데이터팩이 직접 summon — /reload 시
# commands/stop 에서 buttons 가 -1 로 재설정되어 다음 tick 에 ensure 로직
# 실행. -1 단계에서 같은 태그 entity 를 모두 kill 후 정확한 개수만 다시
# summon → 항상 idempotent (dup 누적 없음, 좌표/라벨 갱신 자동 반영).
#
# ---- facing → 머리 hitbox 위치 (이 파일 한 곳에서만 정의) ----
# stone_button[face=wall, facing=X] AABB (블록 상대 좌표):
# facing 의 의미 = "버튼 머리 visible 면의 normal 방향". 머리는 그 방향
# 쪽 face 에 붙어 있고 hitbox 는 그 face 에서 안쪽(1/8) 만큼 들어감.
# south : z ∈ [0, 0.125] 가로 x ∈ [0.3125, 0.6875]
# north : z ∈ [0.875, 1] 가로 x ∈ [0.3125, 0.6875]
# east : x ∈ [0, 0.125] 가로 z ∈ [0.3125, 0.6875]
# west : x ∈ [0.875, 1] 가로 z ∈ [0.3125, 0.6875]
# 세로 y ∈ [0.375, 0.625] 공통.
#
# interaction entity 의 horizontal hitbox 는 width × width 정사각형 강제라
# 단일 entity 로는 "가로 0.375 × 두께 0.125" 직사각형 불가. → 두께(0.125)
# 와 같은 width=0.125 인 interaction 을 가로축으로 3 개 타일링 (gap 없이
# 인접: 중심 0.375 / 0.5 / 0.625, 각 폭 0.125 → 합 [0.3125, 0.6875]).
# interaction Y 는 hitbox 바닥 → 소환 y = block y + 0.375, height = 0.25.
#
# ---- 깊이축: 블록 면 바로 바깥, 플레이어 쪽 (이중 트리거 방지) ----
# interaction 박스가 stone_button hitbox 와 겹치면 한 번 클릭에 interaction
# 도 발화하고 stone_button 도 vanilla 클릭으로 인식되어 powered=true 애니
# 메이션이 같이 일어남. → interaction 박스를 버튼 머리 바깥쪽 (플레이어
# 측) 으로 한 두께 (0.125) 만큼 밀어 ray 가 stone_button 에 닿기 전에
# interaction 에서 멈추게.
#
# 주의: facing 은 "버튼 머리 normal 방향" = 플레이어가 보는 방향.
# south 면 머리 +z 향함, 벽은 -z 쪽. 따라서 플레이어 쪽 = +z = interaction
# 을 z > 버튼 머리 (0.125) 영역으로. (v1.0.21 에서 한 두께만큼 뺀다는
# 의도였는데 부호를 반대로 잡아 interaction 이 벽 안으로 들어가 있었음.)
# south : 깊이 z 중심 = 0.1875 (interaction z ∈ [0.125, 0.25], 버튼 z ∈ [0, 0.125])
# north : 깊이 z 중심 = 0.8125 (interaction z ∈ [0.75, 0.875], 버튼 z ∈ [0.875, 1])
# east : 깊이 x 중심 = 0.1875
# west : 깊이 x 중심 = 0.8125
#
# ---- positioned 의 .5 보정 회피 ----
# MC 의 vec3 인자는 정수만 쓰면 자동으로 +0.5 보정됨 (블록 중심으로 잡힘).
# positioned 2773 86 5968 → 실제로는 (2773.5, 86, 5968.5). 거기서 ~ 오프셋
# 을 더하면 박스 전체가 0.5 칸 어긋남. $(x).0 $(y).0 $(z).0 처럼 decimal
# 형태로 넘기면 보정 없이 정확한 블록 origin (minimal corner) 이 됨.
#
# ---- text_display 위치 (버튼 바로 아래 같은 벽면에 가운데 정렬) ----
# 버튼 아래 블록의 같은 벽면 (visible 면, 플레이어 쪽) 에 살짝 띄워 부착.
# 가로축: ~0.5 (block 가로 중심, alignment=center 기본값과 합쳐져서 라벨
# 자체도 수평 중앙).
# 세로축: text_display 의 entity Y 는 텍스트 윗변 — 아래로 자람. ~-0.25
# 로 두면 텍스트 윗변이 Y-0.25 (버튼 바로 아래), 한 줄(기본 ~0.5 블록 높이)
# 이 Y-0.75 까지 내려와 버튼 아래 한 칸 벽면 [Y-1, Y] 의 위쪽 절반에
# 자리잡음 — 시각적으로 버튼 바로 밑 가운데 라벨.
# south : ~0.5 ~-0.25 ~0.01 yaw 0 (head 가 +z → 벽면 z=0 에서 +0.01 띄움)
# north : ~0.5 ~-0.25 ~0.99 yaw 180
# east : ~0.01 ~-0.25 ~0.5 yaw -90
# west : ~0.99 ~-0.25 ~0.5 yaw 90
# ---- 비활성: 블록 + interaction × 3 + text_display 전부 제거 후 종료 ----
# data modify entity @e[...] 는 대상 1개 강제 → interaction 3개 모드에선
# 못 쓰므로 그냥 kill. 어차피 버튼 블록도 air 로 바꾸므로 라벨도 같이 제거.
$execute if score $(n) buttons matches ..-2 run setblock $(x) $(y) $(z) minecraft:air
$execute if score $(n) buttons matches ..-2 run kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
$execute if score $(n) buttons matches ..-2 run kill @e[type=minecraft:text_display,tag=mq,tag=$(n)]
$execute if score $(n) buttons matches ..-2 run return 0
# ---- 초기화: 블록 + interaction × 3 + text_display 보장 ----
$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 kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
$execute if score $(n) buttons matches -1 run kill @e[type=minecraft:text_display,tag=mq,tag=$(n)]
# south: 깊이축=z(+0.1875, 플레이어 쪽), 가로축=x, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.375 ~0.375 ~0.1875 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.375 ~0.1875 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.625 ~0.375 ~0.1875 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"south"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.5 ~-0.25 ~0.01 {Tags:["mq","$(n)"],Rotation:[0f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
# north: 깊이축=z(+0.8125, 플레이어 쪽), 가로축=x, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.375 ~0.375 ~0.8125 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.375 ~0.8125 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.625 ~0.375 ~0.8125 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.5 ~-0.25 ~0.99 {Tags:["mq","$(n)"],Rotation:[180f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
# east: 깊이축=x(+0.1875, 플레이어 쪽), 가로축=z, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.1875 ~0.375 ~0.375 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.1875 ~0.375 ~0.5 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.1875 ~0.375 ~0.625 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"east"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.01 ~-0.25 ~0.5 {Tags:["mq","$(n)"],Rotation:[-90f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
# west: 깊이축=x(+0.8125, 플레이어 쪽), 가로축=z, 3 타일 + 라벨
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.8125 ~0.375 ~0.375 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.8125 ~0.375 ~0.5 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.8125 ~0.375 ~0.625 {Tags:["mq","$(n)"],width:0.125f,height:0.25f,response:0b}
$execute if score $(n) buttons matches -1 unless data storage mq:tmp btn{label:""} if data storage mq:tmp btn{f:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:text_display ~0.99 ~-0.25 ~0.5 {Tags:["mq","$(n)"],Rotation:[90f,0f],background:0,text:{text:"$(label)",color:"$(label_color)",font:"$(label_font)",bold:true},transformation:{scale:[$(label_scale)f,$(label_scale)f,$(label_scale)f],translation:[0f,0f,0f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}
$execute if score $(n) buttons matches -1 run scoreboard players set $(n) buttons 0
# ---- 상시: interaction 클릭/타격 → playsound + 명령/투표 실행 ----
# init main = 0 (퀴즈 시작 전 설정 단계) : 명령 직접 실행
# 그 외 : trigger 투표 경로
# 한 버튼에 interaction 3개지만 `on target` 은 클릭된 1개만 통과
# (나머지는 target 부재로 체인 중단). limit=1 을 두면 MC 가 임의로 1개를
# 골라 잘못된 entity 만 검사하므로 limit 두지 않음.
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] on target as @s positioned $(x).0 $(y).0 $(z).0 run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] on target as @s positioned $(x).0 $(y).0 $(z).0 if score init main matches 0 run $(c)
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] on target as @s positioned $(x).0 $(y).0 $(z).0 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 interaction

View File

@@ -0,0 +1,21 @@
# 한 button entry 의 optional 필드 기본값을 채워 macro 호출 시 $(arg) 미존재
# 에러를 방지한다. handler 에서 entry 복사 직후 호출.
#
# label : 없으면 "" (빈 문자열) -> btn 안의 text_display 분기는 label
# 이 "" 이면 스킵.
# label_color : 기본 "black"
# label_font : 기본 "minecraft:default"
# label_scale : 기본 "1.0" (Vector3f 의 한 축, 3축 동일하게 사용됨)
#
# 구현: defaults 컴파운드를 먼저 만들고 entry (mq:tmp.btn) 를 그 위에 merge
# 한 뒤 다시 mq:tmp.btn 으로 되돌린다. data modify ... merge from 은 source
# compound 의 키로 target compound 를 덮어쓰므로 entry 에 있는 값은 보존되고
# entry 에 없는 키만 default 값으로 채워진다.
#
# (이전에 `execute unless data storage mq:tmp btn.label run data modify ...`
# 방식이었으나 MC 26.1.2 parser 가 해당 라인을 거부했음. merge 방식은 문제
# 난 execute-unless-data 구문 자체를 제거.)
data modify storage mq:tmp btn_default set value {label:"",label_color:"black",label_font:"minecraft:default",label_scale:"1.0"}
data modify storage mq:tmp btn_default merge from storage mq:tmp btn
data modify storage mq:tmp btn set from storage mq:tmp btn_default

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.6 KiB

View File

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