개인 자료란 (JE)

  서버 커뮤니티

Profile Cupelt 대표칭호 없음

Kyoee01 a88429fff0b0408e9ed2c4af2b00b5e2

Profile

자료 자바 에디션(JE) 데이터팩

대충 노가다를 줄여주는 " 다중 커맨드 실행 함수 "

2024.10.20 조회 수 905 추천 수 1
게임버전 1.20.2, 1.20.3, 1.20.4, 1.20.5, 1.20.6, 1.21, 1.21.1 
원산지 국산 
창작자 Cupelt 
자료 출처 https://www.koreaminecraft.net/ 

다중 커맨드 실행 함수입니다.

# utils:multi_commands.mcfunction
# args: { commands: [commands] }

$data modify storage minecraft:temp multi_command.commands set value $(commands)
data modify storage minecraft:temp multi_command.now_command \
    set from storage minecraft:temp multi_command.commands[0]

function utils:dynamic_command_executor with storage minecraft:temp multi_command

data remove storage minecraft:temp multi_command.commands[0]
execute if data storage minecraft:temp multi_command.commands[0] \
    run function utils:multi_commands with storage minecraft:temp multi_command
# utils:dynamic_command_executor.mcfunction

$$(now_command)


이걸 사용하면...

execute if score isHouseLightOn third_days matches 1 \
    as @e[type=minecraft:interaction, tag=house_drawer_interection] \
    on target \
    run give @s iron_ingot[custom_name='{"text":"ID 카드","color":"red", "italic": false}']

execute if score isHouseLightOn third_days matches 1 \
    as @e[type=minecraft:interaction, tag=house_drawer_interection] \
    on target \
    run tellraw @a ["",{"selector":"@a[tag=player]","color":"yellow"}," : ","ID카드를 챙겼으니 이제 출근하자.."]

execute if score isHouseLightOn third_days matches 1 \
    as @e[type=minecraft:interaction, tag=house_drawer_interection] \
    on target \
    as @a at @s run playsound minecraft:ui.button.click master @s ~ ~ ~ 0.5 1 1

execute if score isHouseLightOn third_days matches 1 \
    as @e[type=minecraft:interaction, tag=house_drawer_interection] \
    on target \
    run kill @e[type=minecraft:interaction, tag=house_drawer_interection]

이렇게 긴 코드를..


execute if score isHouseLightOn third_days matches 1 \
    as @e[type=minecraft:interaction, tag=house_drawer_interection] \
    on target \
    run function utils:multi_commands { commands: [ \
        "give @s iron_ingot[custom_name='{\"text\":\"ID 카드\",\"color\":\"red\", \"italic\": false}']", \
        "tellraw @a [\"\",{\"selector\":\"@a[tag=player]\",\"color\":\"yellow\"},\" : \",\"ID카드를 챙겼으니 이제 출근하자..\"]", \
        "playsound minecraft:ui.button.click master @a ~ ~ ~ 0.5 1 1", \
        "kill @e[type=minecraft:interaction, tag=house_drawer_interection]" \
    ]}

다음과 같이 줄일 수 있습니다.


단점으로는.. 

문자열 기반이라.. " 문자가 들어간 명령어 (ex: json) 와 같은 문자는 escape (\") 해줘야 한다는 단점과..

VSCode 사용시 하이라이팅이 안되는 정도...?



글쓴이의 최근 게시글
전체공지

1개의 댓글

뉴스 및 창작물
사진이 없습니다.

레드스톤

마크 노트블럭 커버 | 만찬가

노트블럭전문가

2026-11-07

0

/files/thumbnails/569/245/004/262x150.crop.jpg?t=1793237952

상품

《마인크래프트 탐험가 백과사전》 출간!

다코미

2026-10-29

0

/files/thumbnails/727/214/004/262x150.crop.jpg?t=1793021878

건축

마인크래프트로 만든 노래방

팀뉴일리시

2026-10-26

0

/files/thumbnails/608/241/004/262x150.crop.jpg?t=1792191919

모드

마크판 우마무스메 완성판

노트블럭전문가

2026-10-17

0

/files/thumbnails/345/223/004/262x150.crop.jpg?t=1789964285

레드스톤

[영상] 마인크래프트 맵에서 야라라라 노트블럭 커버해보기

노트블럭전문가

2026-09-21

1

사진이 없습니다.

업데이트

마인크래프트 Wilderness Bound 9월 15일 출시 예정, 새 바이옴·버려진 캠프 정리 1

핫브리프

2026-09-15

0

사진이 없습니다.

건축

[영상] 노갑옷으로 깊은 동굴에서 100일 생존하기에 도전해 봤습니다!

FinnMC

2026-09-07

0

/files/thumbnails/217/223/004/262x150.crop.jpg?t=1787202578

상품

《마인크래프트 놀라운 건축설계도》 출간!

다코미

2026-08-20

0

/files/thumbnails/429/222/004/262x150.crop.jpg?t=1787022491

레드스톤

쿠션 LED 끝판왕 (고퀄리티인가)

지구12345

2026-08-18

0

/files/thumbnails/643/220/004/262x150.crop.jpg?t=1786534625

모드

차량들 완료😄 [Minecity]

SHALDOPlus

2026-08-12

0