diff --git a/temp/README.md b/temp/README.md new file mode 100644 index 0000000..eb1a0ab --- /dev/null +++ b/temp/README.md @@ -0,0 +1,43 @@ +# v1.0.18 → v1.0.19 부분 적용 가이드 + +전체 datapack 을 교체하지 않고, 이 폴더의 두 파일만 덮어쓰면 v1.0.19 와 동일한 상태가 됩니다. + +## 무엇이 바뀌었나 + +- `repeat/buttons/btn_prep.mcfunction` (v1.0.17 에서 신규 추가됨) +- `repeat/buttons/btn.mcfunction` + +두 파일 모두 정렬용 다중 공백 때문에 MC 26.1.2 의 명령 파서에서 +`Incorrect argument for command at position ...` 파싱 에러가 발생하던 것을, +다중 공백을 단일 공백으로 정규화해서 고친 것입니다. 로직 변경은 없습니다. + +## 적용 방법 + +이 폴더의 `data/` 트리는 datapack 의 `data/` 트리와 같은 구조입니다. +따라서 그대로 덮어쓰기만 하면 됩니다. + +서버의 datapack 폴더 (예: `world/datapacks/music_quiz/`) 기준으로: + +``` +temp/data/mq/function/repeat/buttons/btn_prep.mcfunction + -> /data/mq/function/repeat/buttons/btn_prep.mcfunction + +temp/data/mq/function/repeat/buttons/btn.mcfunction + -> /data/mq/function/repeat/buttons/btn.mcfunction +``` + +`btn_prep.mcfunction` 은 v1.0.17 이후에 추가된 파일이라, v1.0.16 이하에서 +바로 v1.0.19 로 점프한다면 새로 생성되는 것입니다. v1.0.17/v1.0.18 이미 +설치된 환경이라면 기존 파일을 덮어쓰면 됩니다. + +복사 후 게임 안에서: + +``` +/reload +``` + +## 확인 + +`/reload` 시 콘솔에 더 이상 +`Failed to load function mq:repeat/buttons/btn_prep` 같은 에러가 뜨지 않아야 합니다. +버튼을 클릭했을 때 정상적으로 동작하면 적용 성공입니다. diff --git a/temp/data/mq/function/repeat/buttons/btn.mcfunction b/temp/data/mq/function/repeat/buttons/btn.mcfunction new file mode 100644 index 0000000..dafe1c1 --- /dev/null +++ b/temp/data/mq/function/repeat/buttons/btn.mcfunction @@ -0,0 +1,90 @@ +# 버튼 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. +# +# ---- text_display 위치 (버튼 바로 아래 같은 벽면에 부착) ---- +# 같은 벽 (button 의 머리 normal 반대편 블록) 의 visible 면에 살짝 띄워 +# 부착. 텍스트 entity Y 는 텍스트 baseline 근방 → 아래 블록 바닥에 두면 +# 텍스트가 그 블록 안에 위로 솟아남. +# south : ~0.5 ~-1 ~0.01 yaw 0 (head 가 +z 방향 → 벽 +z=0.01 살짝 띄움) +# north : ~0.5 ~-1 ~0.99 yaw 180 +# east : ~0.01 ~-1 ~0.5 yaw -90 +# west : ~0.99 ~-1 ~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.0625), 가로축=x, 3 타일 + 라벨 +$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"south"} positioned $(x) $(y) $(z) run summon minecraft:interaction ~0.375 ~0.375 ~0.0625 {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) $(y) $(z) run summon minecraft:interaction ~0.5 ~0.375 ~0.0625 {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) $(y) $(z) run summon minecraft:interaction ~0.625 ~0.375 ~0.0625 {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) $(y) $(z) run summon minecraft:text_display ~0.5 ~-1 ~0.01 {Tags:["mq","$(n)"],Rotation:[0f,0f],background:0,text:'{"text":"$(label)","color":"$(label_color)","font":"$(label_font)"}',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.9375), 가로축=x, 3 타일 + 라벨 +$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"north"} positioned $(x) $(y) $(z) run summon minecraft:interaction ~0.375 ~0.375 ~0.9375 {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) $(y) $(z) run summon minecraft:interaction ~0.5 ~0.375 ~0.9375 {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) $(y) $(z) run summon minecraft:interaction ~0.625 ~0.375 ~0.9375 {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) $(y) $(z) run summon minecraft:text_display ~0.5 ~-1 ~0.99 {Tags:["mq","$(n)"],Rotation:[180f,0f],background:0,text:'{"text":"$(label)","color":"$(label_color)","font":"$(label_font)"}',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.0625), 가로축=z, 3 타일 + 라벨 +$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"east"} positioned $(x) $(y) $(z) run summon minecraft:interaction ~0.0625 ~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) $(y) $(z) run summon minecraft:interaction ~0.0625 ~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) $(y) $(z) run summon minecraft:interaction ~0.0625 ~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) $(y) $(z) run summon minecraft:text_display ~0.01 ~-1 ~0.5 {Tags:["mq","$(n)"],Rotation:[-90f,0f],background:0,text:'{"text":"$(label)","color":"$(label_color)","font":"$(label_font)"}',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.9375), 가로축=z, 3 타일 + 라벨 +$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x) $(y) $(z) run summon minecraft:interaction ~0.9375 ~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) $(y) $(z) run summon minecraft:interaction ~0.9375 ~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) $(y) $(z) run summon minecraft:interaction ~0.9375 ~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) $(y) $(z) run summon minecraft:text_display ~0.99 ~-1 ~0.5 {Tags:["mq","$(n)"],Rotation:[90f,0f],background:0,text:'{"text":"$(label)","color":"$(label_color)","font":"$(label_font)"}',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) $(y) $(z) 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) $(y) $(z) if score init main matches 0 run $(c) +$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] 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 interaction diff --git a/temp/data/mq/function/repeat/buttons/btn_prep.mcfunction b/temp/data/mq/function/repeat/buttons/btn_prep.mcfunction new file mode 100644 index 0000000..8b0a101 --- /dev/null +++ b/temp/data/mq/function/repeat/buttons/btn_prep.mcfunction @@ -0,0 +1,13 @@ +# 한 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축 동일하게 사용됨) + +execute unless data storage mq:tmp btn.label run data modify storage mq:tmp btn.label set value "" +execute unless data storage mq:tmp btn.label_color run data modify storage mq:tmp btn.label_color set value "black" +execute unless data storage mq:tmp btn.label_font run data modify storage mq:tmp btn.label_font set value "minecraft:default" +execute unless data storage mq:tmp btn.label_scale run data modify storage mq:tmp btn.label_scale set value "1.0" diff --git a/temp/gif.png b/temp/gif.png deleted file mode 100644 index 1a6e63f..0000000 Binary files a/temp/gif.png and /dev/null differ diff --git a/temp/gif.png.mcmeta b/temp/gif.png.mcmeta deleted file mode 100644 index f2c5c2b..0000000 --- a/temp/gif.png.mcmeta +++ /dev/null @@ -1,6 +0,0 @@ -{ - "animation": { - "frametime": 1, - "interpolate": false - } -}