- 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>
22 lines
1.3 KiB
MCFunction
22 lines
1.3 KiB
MCFunction
# 한 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
|