Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da075b60b8 | ||
|
|
b803a422a3 | ||
|
|
5d610cf01a | ||
|
|
2f5038e4f0 | ||
|
|
75daf5bab9 | ||
|
|
ba7089e7b2 | ||
|
|
55ab7fc04b |
@@ -66,5 +66,11 @@ data modify storage mq:main answer set value {title:"음악퀴즈", alias:[]}
|
|||||||
# 이전 버전이 남긴 legacy marker 정리 (현재는 marker 사용 안 함)
|
# 이전 버전이 남긴 legacy marker 정리 (현재는 marker 사용 안 함)
|
||||||
kill @e[type=minecraft:marker,tag=mq]
|
kill @e[type=minecraft:marker,tag=mq]
|
||||||
|
|
||||||
|
# 이전 버전이 남긴 잔존 text_display 정리.
|
||||||
|
# 현재 버튼은 -1 init 단계에서 같은 tag interaction 만 kill 하므로 (n 태그
|
||||||
|
# 가 일치할 때만), 옛 버튼 정의에 있던 이름의 text_display 가 남으면 안
|
||||||
|
# 지워짐. 여기서 mq 태그 전체를 한 번에 정리해 stale 제거.
|
||||||
|
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
|
||||||
|
|||||||
@@ -4,14 +4,20 @@
|
|||||||
# f : facing (south / north / east / west)
|
# f : facing (south / north / east / west)
|
||||||
# c : 클릭 시 실행 명령 (init=0 직접, 그 외 trigger $(n) 투표)
|
# c : 클릭 시 실행 명령 (init=0 직접, 그 외 trigger $(n) 투표)
|
||||||
#
|
#
|
||||||
# interaction entity 의 위치/크기는 facing 만 보면 결정됨 — 매번 손으로
|
# optional 필드 (버튼 아래 y-1 위치에 같은 벽면 라벨 부착):
|
||||||
# ox/oy/oz/w/h 를 적지 않는다. 실제 오프셋 테이블은 repeat/buttons/btn
|
# label : 표시할 텍스트. 생략하면 라벨 없음.
|
||||||
# 안에서 한 곳에만 정의되어 있다 (stone_button[face=wall] 면 정합용).
|
# label_color : 텍스트 색 (예 "black", "red", "#FFAA00"). 기본 "black".
|
||||||
|
# label_font : 텍스트 폰트 (예 "minecraft:default"). 기본 "minecraft:default".
|
||||||
|
# label_scale : 텍스트 크기 (Vector3f 한 축, 3축 동일). 기본 "1.0".
|
||||||
|
#
|
||||||
|
# interaction entity 의 위치/크기와 text_display 의 위치/회전은 facing 만
|
||||||
|
# 보면 결정됨 — 매번 손으로 ox/oy/oz 를 적지 않는다. 실제 오프셋 테이블은
|
||||||
|
# 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:364, y:146, z:-263, f:"east", c:"function mq:commands/start with storage mq:main"}
|
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:364, y:146, z:-265, f:"east", c:"function mq:commands/stop with storage mq:main"}
|
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:364, y:146, z:-267, f:"east", c:"function mq:commands/skip"}
|
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:364, y:146, z:-269, f:"east", c:"function mq:commands/hint"}
|
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:364, y:146, z:-271, f:"east", c:"function mq:commands/replay"}
|
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:144, y:62, z:-213, f:"north", c:"function mq:commands/test"}
|
data modify storage mq:main button_defs append value {n:"test", x:144, y:62, z:-213, f:"north", c:"function mq:commands/test", label:"소리 테스트"}
|
||||||
|
|||||||
@@ -1,54 +1,105 @@
|
|||||||
# 버튼 1개에 대한 매 tick 처리.
|
# 버튼 1개에 대한 매 tick 처리.
|
||||||
# 매크로 인자(mq:tmp.btn): n, x, y, z, f, c
|
# 매크로 인자(mq:tmp.btn): n, x, y, z, f, c, label, label_color, label_font, label_scale
|
||||||
# buttons 점수 상태:
|
# buttons 점수 상태:
|
||||||
# ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단)
|
# ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단)
|
||||||
# -1 : 초기화 단계 (버튼 블록 배치 + interaction entity 보장 후 0 으로)
|
# -1 : 초기화 단계 (버튼 블록 + interaction × 3 + text_display 보장 후 0)
|
||||||
# 0 : 정상 (interaction 클릭 대기)
|
# 0 : 정상 (interaction 클릭 대기)
|
||||||
#
|
#
|
||||||
# interaction entity 는 데이터팩이 직접 summon — /reload 시 commands/stop
|
# interaction/text_display entity 는 데이터팩이 직접 summon — /reload 시
|
||||||
# 에서 buttons 가 -1 로 재설정되어 다음 tick 에 ensure 로직이 실행됨.
|
# commands/stop 에서 buttons 가 -1 로 재설정되어 다음 tick 에 ensure 로직
|
||||||
# -1 단계에서 같은 태그 entity 를 모두 kill 후 정확히 1개 summon → dup
|
# 실행. -1 단계에서 같은 태그 entity 를 모두 kill 후 정확한 개수만 다시
|
||||||
# 누적 없이 항상 "버튼당 1개, 올바른 좌표" 상태로 수렴 (idempotent).
|
# summon → 항상 idempotent (dup 누적 없음, 좌표/라벨 갱신 자동 반영).
|
||||||
#
|
#
|
||||||
# ---- facing → 소환 오프셋 (이 파일 한 곳에서만 정의) ----
|
# ---- facing → 머리 hitbox 위치 (이 파일 한 곳에서만 정의) ----
|
||||||
# stone_button[face=wall] hitbox: 가로 6/16 (0.375), 세로 4/16 (0.25),
|
# stone_button[face=wall, facing=X] AABB (블록 상대 좌표):
|
||||||
# 두께 2/16 (0.125). 벽 블록의 한 면에서만 튀어나오고 반대편은 안쪽으로
|
# facing 의 의미 = "버튼 머리 visible 면의 normal 방향". 머리는 그 방향
|
||||||
# 들어감. interaction 의 horizontal hitbox 는 width × width 정사각형
|
# 쪽 face 에 붙어 있고 hitbox 는 그 face 에서 안쪽(1/8) 만큼 들어감.
|
||||||
# 강제 → width 를 가로(0.375) 에 맞추고 위치를 튀어나온 쪽 면에 정렬.
|
# 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] 공통.
|
||||||
#
|
#
|
||||||
# facing 의미: "플레이어가 그 방향을 보면서 누른다". 즉 button 머리는
|
# interaction entity 의 horizontal hitbox 는 width × width 정사각형 강제라
|
||||||
# facing 의 반대쪽 면에 붙어 있다.
|
# 단일 entity 로는 "가로 0.375 × 두께 0.125" 직사각형 불가. → 두께(0.125)
|
||||||
# south : 머리는 블록의 -z 쪽 면(north face) → 소환 z = -0.0625
|
# 와 같은 width=0.125 인 interaction 을 가로축으로 3 개 타일링 (gap 없이
|
||||||
# north : 머리는 블록의 +z 쪽 면(south face) → 소환 z = 1.0625
|
# 인접: 중심 0.375 / 0.5 / 0.625, 각 폭 0.125 → 합 [0.3125, 0.6875]).
|
||||||
# east : 머리는 블록의 -x 쪽 면(west face) → 소환 x = -0.0625
|
# interaction Y 는 hitbox 바닥 → 소환 y = block y + 0.375, height = 0.25.
|
||||||
# west : 머리는 블록의 +x 쪽 면(east face) → 소환 x = 1.0625
|
#
|
||||||
# interaction entity Y 는 hitbox 의 바닥(=발 위치) — 버튼 머리가 블록의
|
# ---- 깊이축: 블록 면 바로 바깥 (이중 트리거 방지) ----
|
||||||
# 세로 중앙(y+0.5) 에 있고 높이 0.25 라 바닥은 y+0.375.
|
# interaction 박스가 stone_button hitbox 와 겹치면 한 번 클릭에 interaction
|
||||||
|
# 도 발화하고 stone_button 도 vanilla 클릭으로 인식되어 powered=true 애니
|
||||||
|
# 메이션이 같이 일어남. → interaction 박스를 버튼 면 바깥쪽으로 한 두께
|
||||||
|
# (0.125) 만큼 빼 ray 가 stone_button 에 닿기 전에 interaction 에서 멈추게.
|
||||||
|
# south : 깊이 z 중심 = -0.0625 (interaction z ∈ [-0.125, 0], 버튼 z ∈ [0, 0.125])
|
||||||
|
# north : 깊이 z 중심 = 1.0625 (interaction z ∈ [1, 1.125], 버튼 z ∈ [0.875, 1])
|
||||||
|
# east : 깊이 x 중심 = -0.0625
|
||||||
|
# west : 깊이 x 중심 = 1.0625
|
||||||
|
#
|
||||||
|
# ---- 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 위치 (버튼 바로 아래 같은 벽면에 부착) ----
|
||||||
|
# 같은 벽 (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 응답 차단 후 종료 ----
|
# ---- 비활성: 블록 + 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 setblock $(x) $(y) $(z) minecraft:air
|
||||||
$execute if score $(n) buttons matches ..-2 run data modify entity @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] response set value 0b
|
$execute if score $(n) buttons matches ..-2 run 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
|
$execute if score $(n) buttons matches ..-2 run return 0
|
||||||
|
|
||||||
# ---- 초기화: 버튼 블록 배치 + interaction entity 보장 ----
|
# ---- 초기화: 블록 + interaction × 3 + text_display 보장 ----
|
||||||
# 기존 mq/$(n) interaction 을 전부 제거 후 정확히 1개 소환.
|
|
||||||
# 옛 월드 cmd block 으로 누적 소환된 dup 이나 엉뚱한 좌표에 남은 잔존
|
|
||||||
# entity 까지 정리 → "정상 상태(버튼당 정확히 1개, 올바른 좌표)" 가 보장됨.
|
|
||||||
$execute unless score $(n) buttons matches -1.. run scoreboard players set $(n) buttons -1
|
$execute unless score $(n) buttons matches -1.. run scoreboard players set $(n) buttons -1
|
||||||
$execute if score $(n) buttons matches -1 run setblock $(x) $(y) $(z) minecraft:stone_button[face=wall,facing=$(f),powered=false]
|
$execute if score $(n) buttons matches -1 run setblock $(x) $(y) $(z) minecraft:stone_button[face=wall,facing=$(f),powered=false]
|
||||||
$execute if score $(n) buttons matches -1 run kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
|
$execute if score $(n) buttons matches -1 run kill @e[type=minecraft:interaction,tag=mq,tag=$(n)]
|
||||||
$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.375f,height:0.25f,response:0b}
|
$execute if score $(n) buttons matches -1 run kill @e[type=minecraft:text_display,tag=mq,tag=$(n)]
|
||||||
$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 ~1.0625 {Tags:["mq","$(n)"],width:0.375f,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.375f,height:0.25f,response:0b}
|
# south: 깊이축=z(-0.0625, 블록 면 바깥), 가로축=x, 3 타일 + 라벨
|
||||||
$execute if score $(n) buttons matches -1 if data storage mq:tmp btn{f:"west"} positioned $(x) $(y) $(z) run summon minecraft:interaction ~1.0625 ~0.375 ~0.5 {Tags:["mq","$(n)"],width:0.375f,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.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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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(+1.0625, 블록 면 바깥), 가로축=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 ~1.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:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.375 ~1.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:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.625 ~0.375 ~1.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:"north"} positioned $(x).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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(+1.0625, 블록 면 바깥), 가로축=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 ~1.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:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~1.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:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~1.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:"west"} positioned $(x).0 $(y).0 $(z).0 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
|
$execute if score $(n) buttons matches -1 run scoreboard players set $(n) buttons 0
|
||||||
|
|
||||||
# ---- 상시: interaction 클릭/타격 → playsound + 명령/투표 실행 ----
|
# ---- 상시: interaction 클릭/타격 → playsound + 명령/투표 실행 ----
|
||||||
# init main = 0 (퀴즈 시작 전 설정 단계) : 명령 직접 실행
|
# init main = 0 (퀴즈 시작 전 설정 단계) : 명령 직접 실행
|
||||||
# 그 외 : trigger 투표 경로
|
# 그 외 : trigger 투표 경로
|
||||||
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) run playsound minecraft:block.stone_button.click_on block @s ~ ~ ~ 1 1
|
# 한 버튼에 interaction 3개지만 `on target` 은 클릭된 1개만 통과
|
||||||
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) if score init main matches 0 run $(c)
|
# (나머지는 target 부재로 체인 중단). limit=1 을 두면 MC 가 임의로 1개를
|
||||||
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n),limit=1] on target as @s positioned $(x) $(y) $(z) unless score init main matches 0 run trigger $(n)
|
# 골라 잘못된 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 중복 발화 방지) ----
|
# ---- 처리 후 attack/interaction NBT 클리어 (다음 tick 중복 발화 방지) ----
|
||||||
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] at @s run data remove entity @s attack
|
$execute as @e[type=minecraft:interaction,tag=mq,tag=$(n)] at @s run data remove entity @s attack
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -1,16 +1,27 @@
|
|||||||
# 각 button_defs 항목을 mq:tmp.btn 으로 복사 후 btn 호출.
|
# 각 button_defs 항목을 mq:tmp.btn 으로 복사 → optional 필드 기본값 채움
|
||||||
# btn 안에서 facing 별 분기 (if data storage mq:tmp btn{f:"..."}) 를
|
# → btn 호출. btn 안에서 facing 별 분기 (if data storage mq:tmp btn{f:"..."})
|
||||||
# 사용하기 위해 현재 항목을 같은 storage 에 노출시킨다.
|
# 와 macro arg ($(label) 등) 둘 다 사용 가능하게 같은 storage 에 노출시킨다.
|
||||||
|
|
||||||
data modify storage mq:tmp btn set from storage mq:main button_defs[0]
|
data modify storage mq:tmp btn set from storage mq:main button_defs[0]
|
||||||
|
function mq:repeat/buttons/btn_prep
|
||||||
function mq:repeat/buttons/btn with storage mq:tmp btn
|
function mq:repeat/buttons/btn with storage mq:tmp btn
|
||||||
|
|
||||||
data modify storage mq:tmp btn set from storage mq:main button_defs[1]
|
data modify storage mq:tmp btn set from storage mq:main button_defs[1]
|
||||||
|
function mq:repeat/buttons/btn_prep
|
||||||
function mq:repeat/buttons/btn with storage mq:tmp btn
|
function mq:repeat/buttons/btn with storage mq:tmp btn
|
||||||
|
|
||||||
data modify storage mq:tmp btn set from storage mq:main button_defs[2]
|
data modify storage mq:tmp btn set from storage mq:main button_defs[2]
|
||||||
|
function mq:repeat/buttons/btn_prep
|
||||||
function mq:repeat/buttons/btn with storage mq:tmp btn
|
function mq:repeat/buttons/btn with storage mq:tmp btn
|
||||||
|
|
||||||
data modify storage mq:tmp btn set from storage mq:main button_defs[3]
|
data modify storage mq:tmp btn set from storage mq:main button_defs[3]
|
||||||
|
function mq:repeat/buttons/btn_prep
|
||||||
function mq:repeat/buttons/btn with storage mq:tmp btn
|
function mq:repeat/buttons/btn with storage mq:tmp btn
|
||||||
|
|
||||||
data modify storage mq:tmp btn set from storage mq:main button_defs[4]
|
data modify storage mq:tmp btn set from storage mq:main button_defs[4]
|
||||||
|
function mq:repeat/buttons/btn_prep
|
||||||
function mq:repeat/buttons/btn with storage mq:tmp btn
|
function mq:repeat/buttons/btn with storage mq:tmp btn
|
||||||
|
|
||||||
data modify storage mq:tmp btn set from storage mq:main button_defs[5]
|
data modify storage mq:tmp btn set from storage mq:main button_defs[5]
|
||||||
|
function mq:repeat/buttons/btn_prep
|
||||||
function mq:repeat/buttons/btn with storage mq:tmp btn
|
function mq:repeat/buttons/btn with storage mq:tmp btn
|
||||||
|
|||||||
59
temp/README.md
Normal file
59
temp/README.md
Normal file
@@ -0,0 +1,59 @@
|
|||||||
|
# v1.0.20 → v1.0.21 부분 적용 가이드
|
||||||
|
|
||||||
|
전체 datapack 을 교체하지 않고, 이 폴더의 파일만 덮어쓰면 v1.0.21 과 동일한 상태가 됩니다.
|
||||||
|
|
||||||
|
## 무엇이 바뀌었나
|
||||||
|
|
||||||
|
### 1. `repeat/buttons/btn.mcfunction` — 버튼이 같이 눌러지던 문제 + 라벨이 JSON 코드로 나오던 문제
|
||||||
|
|
||||||
|
**(a) 클릭 시 stone_button 도 같이 눌러짐**
|
||||||
|
|
||||||
|
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) 라벨이 `{"text":"게임시작",...}` JSON 텍스트 그대로 보임**
|
||||||
|
|
||||||
|
MC 1.20.5+ 부터 text_display 의 `text` 필드는 String 이 아니라 직접
|
||||||
|
TextComponent compound 로 저장됩니다. 이전에는 String 안에 JSON 을 넣어서
|
||||||
|
(`text:'{...}'`) 그 JSON 자체가 텍스트로 렌더링되었습니다. compound 형태
|
||||||
|
(`text:{text:"...",color:"...",font:"..."}`) 로 변경.
|
||||||
|
|
||||||
|
### 2. `repeat/buttons/btn_prep.mcfunction`
|
||||||
|
|
||||||
|
v1.0.20 에서 이미 수정됨 (defaults + merge 방식). 변경 없음 — 다만
|
||||||
|
v1.0.19 이하에서 점프하는 경우 같이 덮어써야 합니다.
|
||||||
|
|
||||||
|
## 적용 방법
|
||||||
|
|
||||||
|
서버의 datapack 폴더 (예: `world/datapacks/music_quiz/`) 기준으로 두 파일을
|
||||||
|
**반드시 덮어쓰세요**.
|
||||||
|
|
||||||
|
```
|
||||||
|
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
|
||||||
|
```
|
||||||
|
|
||||||
|
## 확인
|
||||||
|
|
||||||
|
- 버튼을 클릭해도 stone_button 의 `powered=true` 눌림 애니메이션이
|
||||||
|
발생하지 않아야 합니다 (interaction 만 발화).
|
||||||
|
- 버튼 아래 라벨이 `게임시작` / `정지` / `소리 테스트` 등으로 정상 표시
|
||||||
|
(JSON 텍스트 노출 없음).
|
||||||
|
- 콘솔에 파싱 에러 없음.
|
||||||
106
temp/data/mq/function/repeat/buttons/btn.mcfunction
Normal file
106
temp/data/mq/function/repeat/buttons/btn.mcfunction
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# 버튼 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 에서 멈추게.
|
||||||
|
# south : 깊이 z 중심 = -0.0625 (interaction z ∈ [-0.125, 0], 버튼 z ∈ [0, 0.125])
|
||||||
|
# north : 깊이 z 중심 = 1.0625 (interaction z ∈ [1, 1.125], 버튼 z ∈ [0.875, 1])
|
||||||
|
# east : 깊이 x 중심 = -0.0625
|
||||||
|
# west : 깊이 x 중심 = 1.0625
|
||||||
|
#
|
||||||
|
# ---- 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 위치 (버튼 바로 아래 같은 벽면에 부착) ----
|
||||||
|
# 같은 벽 (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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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(+1.0625, 블록 면 바깥), 가로축=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 ~1.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:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.5 ~0.375 ~1.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:"north"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~0.625 ~0.375 ~1.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:"north"} positioned $(x).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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).0 $(y).0 $(z).0 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(+1.0625, 블록 면 바깥), 가로축=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 ~1.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:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~1.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:"west"} positioned $(x).0 $(y).0 $(z).0 run summon minecraft:interaction ~1.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:"west"} positioned $(x).0 $(y).0 $(z).0 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).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
|
||||||
21
temp/data/mq/function/repeat/buttons/btn_prep.mcfunction
Normal file
21
temp/data/mq/function/repeat/buttons/btn_prep.mcfunction
Normal 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
|
||||||
BIN
temp/gif.png
BIN
temp/gif.png
Binary file not shown.
|
Before Width: | Height: | Size: 4.6 KiB |
@@ -1,6 +0,0 @@
|
|||||||
{
|
|
||||||
"animation": {
|
|
||||||
"frametime": 1,
|
|
||||||
"interpolate": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user