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>
This commit is contained in:
@@ -1,7 +1,25 @@
|
||||
# 버튼 정의. 각 항목 의미:
|
||||
# n : 이름 (= 트리거/태그) x,y,z : 버튼 블록 좌표 f : facing
|
||||
# c : 클릭 시 실행 명령 (init=0 직접, 그 외 trigger $(n) 투표)
|
||||
# ox,oy,oz : interaction entity 소환 위치 오프셋 (블록 좌표 기준)
|
||||
# w,h : interaction width / height (float)
|
||||
#
|
||||
# stone_button[face=wall] hitbox: 가로 6/16 (0.375), 세로 4/16 (0.25),
|
||||
# 두께 2/16 (0.125), 벽 반대편으로만 튀어나옴. interaction 의 horizontal
|
||||
# hitbox 는 width × width 정사각형 강제 → width 를 가로(0.375) 에 맞추고
|
||||
# 위치 보정으로 "튀어나온 쪽 면 = visible face" 가 되게 함. 반대편은
|
||||
# 벽 블록 속으로 들어가 invisible.
|
||||
#
|
||||
# facing 별 오프셋:
|
||||
# south : ox=0.5 oy=0.375 oz=-0.0625
|
||||
# north : ox=0.5 oy=0.375 oz=1.0625
|
||||
# east : ox=-0.0625 oy=0.375 oz=0.5
|
||||
# west : ox=1.0625 oy=0.375 oz=0.5
|
||||
|
||||
data modify storage mq:main button_defs set value []
|
||||
data modify storage mq:main button_defs append value {n:"start", x:140, y:62, z:-225, f:"south", c:"function mq:commands/start with storage mq:main"}
|
||||
data modify storage mq:main button_defs append value {n:"stop", x:142, y:62, z:-225, f:"south", c:"function mq:commands/stop with storage mq:main"}
|
||||
data modify storage mq:main button_defs append value {n:"skip", x:144, y:62, z:-225, f:"south", c:"function mq:commands/skip"}
|
||||
data modify storage mq:main button_defs append value {n:"hint", x:146, y:62, z:-225, f:"south", c:"function mq:commands/hint"}
|
||||
data modify storage mq:main button_defs append value {n:"replay", x:148, y:62, z:-225, f:"south", c:"function mq:commands/replay"}
|
||||
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:"start", x:140, y:62, z:-225, f:"south", c:"function mq:commands/start with storage mq:main", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
|
||||
data modify storage mq:main button_defs append value {n:"stop", x:142, y:62, z:-225, f:"south", c:"function mq:commands/stop with storage mq:main", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
|
||||
data modify storage mq:main button_defs append value {n:"skip", x:144, y:62, z:-225, f:"south", c:"function mq:commands/skip", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
|
||||
data modify storage mq:main button_defs append value {n:"hint", x:146, y:62, z:-225, f:"south", c:"function mq:commands/hint", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
|
||||
data modify storage mq:main button_defs append value {n:"replay", x:148, y:62, z:-225, f:"south", c:"function mq:commands/replay", ox:"0.5", oy:"0.375", oz:"-0.0625", w:"0.375", h:"0.25"}
|
||||
data modify storage mq:main button_defs append value {n:"test", x:144, y:62, z:-213, f:"north", c:"function mq:commands/test", ox:"0.5", oy:"0.375", oz:"1.0625", w:"0.375", h:"0.25"}
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
# 버튼 1개에 대한 매 tick 처리. 매크로 인자: n, x, y, z, f, c
|
||||
# 버튼 1개에 대한 매 tick 처리.
|
||||
# 매크로 인자: n, x, y, z, f, c, ox, oy, oz, w, h
|
||||
# ox/oy/oz : interaction 소환 위치 오프셋 (블록 좌표 기준, facing 별)
|
||||
# w / h : interaction width / height (float, 버튼 hitbox 정합용)
|
||||
# buttons 점수 상태:
|
||||
# ..-2 : 비활성 (버튼 블록 제거, interaction 응답 차단)
|
||||
# -1 : 초기화 단계 (버튼 블록 배치 + interaction entity 보장 후 0 으로)
|
||||
@@ -21,7 +24,7 @@ $execute if score $(n) buttons matches ..-2 run return 0
|
||||
$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 positioned $(x) $(y) $(z) positioned ~0.5 ~ ~0.5 run summon minecraft:interaction ~ ~ ~ {Tags:["mq","$(n)"],width:1f,height:1f,response:0b}
|
||||
$execute if score $(n) buttons matches -1 positioned $(x) $(y) $(z) positioned ~$(ox) ~$(oy) ~$(oz) run summon minecraft:interaction ~ ~ ~ {Tags:["mq","$(n)"],width:$(w)f,height:$(h)f,response:0b}
|
||||
$execute if score $(n) buttons matches -1 run scoreboard players set $(n) buttons 0
|
||||
|
||||
# ---- 상시: interaction 클릭/타격 → playsound + 명령/투표 실행 ----
|
||||
|
||||
Reference in New Issue
Block a user