개인 자료란 (JE)

  서버 커뮤니티

Profile Cupelt 대표칭호 없음

Kyoee01 a88429fff0b0408e9ed2c4af2b00b5e2

Profile

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

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

2 일 전 조회 수 37 추천 수 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/578/899/003/262x150.crop.jpg?20241010142350

건축

경주 월정교 1

KHC

2024-10-10

2

/files/thumbnails/219/899/003/262x150.crop.jpg?20241009200950

건축

송전탑+도시 2

dbasd12

2024-10-09

2

/files/thumbnails/246/898/003/262x150.crop.jpg?20241008102328

레드스톤

단다단 - 오토노케(オトノケ) | 마인크래프트 노트블럭 커버

노트블럭전문가

2024-10-08

1

/files/thumbnails/348/896/003/262x150.crop.jpg?20241006103035

디도스/봇테러등등을 낚는 방법 4

물귀신

2024-10-06

3

/files/thumbnails/839/895/003/262x150.crop.jpg?20241006021227

SRV레코드는 보안도메인이 아닙니다. [서버오픈시 필독]

물귀신

2024-10-05

4

/files/thumbnails/648/892/003/262x150.crop.jpg?20241002184058

아티클

마인크래프트 라이브 2024 후기: 무성의가 느껴졌던 '절망편' 라이브

라비

2024-10-02

4

/files/thumbnails/693/890/003/262x150.crop.jpg?20241007140310

소식

[방송인 필독] 시참 컨텐츠 방송인분들께 DDoS(디도스) 공격을 퍼붓는 용의자 특정중, 예방 & 대처법 정리 9

해그

2024-10-01

1

사진이 없습니다.

레드스톤

[노트블럭 패러디] 신창섭 - 모장이 다해줬잖아

노트블럭전문가

2024-09-28

0

/files/thumbnails/677/856/003/262x150.crop.jpg?20240913205849

아티클

마인크래프트 개발의 미래

학교가기싫다

2024-09-13

2

사진이 없습니다.

모드

아이리스 쉐이더

gyeol12

2024-09-07

0