개인 자료란 (JE)

  서버 커뮤니티

Profile Cupelt 대표칭호 없음

Kyoee01 a88429fff0b0408e9ed2c4af2b00b5e2

Profile

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

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

2024.10.20 조회 수 453 추천 수 0
게임버전 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 사용시 하이라이팅이 안되는 정도...?

Warning
댓글이 없습니다.

새로운 댓글을 등록해 주세요!

뉴스 및 창작물
/files/thumbnails/274/069/004/262x150.crop.jpg?20250630235341

업데이트

마인크래프트 자바 1.21.7 (Minecraft Java Edition 1.21.7)

updater

2025-06-30

0

/files/thumbnails/060/067/004/262x150.crop.jpg?20250627114203

업데이트

마인크래프트 자바 1.21.7 릴리스 후보 1 (Minecraft Java Edition 1.21.7 Release Candidate 1)

updater

2025-06-26

0

/files/thumbnails/482/063/004/262x150.crop.jpg?20250626003722

업데이트

마인크래프트 자바 1.21.6 (Minecraft Java Edition 1.21.6)

updater

2025-06-18

1

/files/thumbnails/520/060/004/262x150.crop.jpg?20250626003756

업데이트

마인크래프트 자바 1.21.6 릴리스 후보 1 한국어 번역본 (Minecraft 1.21.6 Release Candidate 1)

updater

2025-06-12

0

/files/thumbnails/267/050/004/262x150.crop.jpg?20250626003947

업데이트

마인크래프트 자바 1.21.6 프리릴리스 1 한국어 번역본 (Minecraft 1.21.6 Pre-Release 1)

updater

2025-05-28

1

/files/thumbnails/166/043/004/262x150.crop.jpg?20250626004054

업데이트

마인크래프트 자바 스냅숏 25w20a 한국어 번역본 (Minecraft Snapshot 25w20a)

updater

2025-05-14

0

/files/thumbnails/255/028/004/262x150.crop.jpg?20250626004140

업데이트

마인크래프트 자바 스냅숏 25w16a 한국어 번역본 (Minecraft Snapshot 25w16a)

updater

2025-04-16

0

/files/thumbnails/036/025/004/262x150.crop.jpg?20250626004219

업데이트

마인크래프트 자바 스냅숏 25w15a 한국어 번역본 (Minecraft Snapshot 25w15a)

updater

2025-04-09

1

/files/thumbnails/159/021/004/262x150.crop.jpg?20250402093702

업데이트

광산제작 업데이트 (The Craftmine 업데이트): 한국어 번역본

updater

2025-04-02

0

/files/thumbnails/729/017/004/262x150.crop.jpg?20250618232645

업데이트

마인크래프트 자바 1.21.5 출시 (Minecraft Java 1.21.5 Released): 한국어 번역본

updater

2025-03-26

0