개인 자료란 (JE)

  서버 커뮤니티

Profile Cupelt 대표칭호 없음

Kyoee01 a88429fff0b0408e9ed2c4af2b00b5e2

Profile

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

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

2024.10.20 조회 수 791 추천 수 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/632/197/004/262x150.crop.jpg?20260616133717

모드

Modrinth, Spark Universe와 합병하다.

BMlight

2026-06-16

0

/files/thumbnails/411/194/004/262x150.crop.jpg?20260606030535

이벤트

🎮 2026 군산 아마추어 e스포츠대회 참가자 모집! 🎮

MineStar

2026-06-04

0

사진이 없습니다.

소식

모장 인증서버 다운 6

명이

2026-06-03

0

/files/thumbnails/535/193/004/262x150.crop.jpg?20260601150848

건축

세탁소 컨텐츠 세트장 5

팀뉴일리시

2026-06-01

2

/files/thumbnails/340/187/004/262x150.crop.jpg?20260505002707

아티클

AI 검사기 디지털 시대에서 Minecraft 콘텐츠 진정성 향상

hicoyo

2026-05-05

0

사진이 없습니다.

아티클

초보자가 반드시 피해야 할 흔한 마인크래프트 실수들

hyunwooo

2026-05-04

3

/files/thumbnails/942/184/004/262x150.crop.jpg?20260426202012

건축

마인크래프트 리조트 건축 2

SHALDOPlus

2026-04-26

2

/files/thumbnails/918/182/004/262x150.crop.jpg?20260421002445

건축

프로젝트 헤일메리 완성🤩🤩 1

SHALDOPlus

2026-04-19

2

/files/thumbnails/579/182/004/262x150.crop.jpg?20260417144651

상품

《마인크래프트 서바이벌 챌린지 영웅편》 출간!

다코미

2026-04-17

1

/files/thumbnails/259/181/004/262x150.crop.jpg?20260412161348

건축

Project hail mary 우주선

SHALDOPlus

2026-04-12

2