시작하기
첫 번째 모드
아이템 하나, 블록 하나, 조합법 하나, 인사말과 명령어 하나. 처음부터 작은 파일로 나뉘어 있습니다. 게임을 열지 않고 시뮬레이션 서버에서 테스트합니다.
1. 모드 만들기
crafting new gemsgems/
├── main.craft
├── content/
│ ├── items.craft
│ ├── blocks.craft
│ └── recipes.craft
├── events/
│ └── welcome.craft
└── commands/
└── gem.craftmain.craft는 모드가 무엇이고 어떤 부분으로 이루어지는지만 말합니다. 콘텐츠는 content/에, 동작은 events/와 commands/에 들어갑니다. 이렇게 배치한 이유는 모드 정리하기에 있습니다. VS Code 확장을 쓰면 입력하는 동안 오류와 자동 완성을 볼 수 있습니다.
2. 파일
mod "gems" { name: "gems", version: "1.0.0", author: "you" }
// 존재하는 것
import "content/items"
import "content/blocks"
import "content/recipes"
// 일어나는 일
import "events/welcome"
import "commands/gem"item "magic_gem" { rarity: "rare", glint: true }block "magic_block" {
hardness: 3
light: 10
tool: "pickaxe"
drops: "magic_gem"
}recipe shaped "magic_block" {
pattern: ["GGG", "GGG", "GGG"]
keys: { G: "magic_gem" }
result: "magic_block"
}on join(e) {
e.player.send("&a환영합니다, {e.player.name}님!")
}command gem(target: player?) requires "gems.gem" {
let p = target ?? player
p.give(item("gems:magic_gem", 1))
return "{p.name}에게 마법 보석을 줬습니다"
}3. 검사하기
crafting check gems/main.craft검사기는 import를 따라갑니다. 문제가 있으면 파일, 줄, 기대한 내용을 알려 줍니다. 예: welcome.craft:2: error: Player has no property 'helth'. Did you mean 'health'?
4. 게임 없이 테스트하기
샌드박스는 실제 게임과 같은 API를 가진 시뮬레이션 서버입니다. 개발 모드로 시작하므로 파일을 저장하면 모드를 다시 불러옵니다.
mkdir -p test/mods && cp -r gems test/mods/
crafting sandbox test> join Steve
[Steve] 환영합니다, Steve님!
> op Steve
> as Steve /gem
[Steve] Steve에게 마법 보석을 줬습니다
> inv Steve
1x gems:magic_gem
> quit5. 플레이하기
gems 폴더를 .minecraft/mods/에 복사하고 Crafting 26.3 프로필을 실행하세요. 아이템 텍스처는 gems/textures/item/magic_gem.png에, 블록 텍스처는 gems/textures/block/magic_block.png에 넣습니다. 이 모드는 블록을 추가하므로, 서버에서는 서버와 모든 클라이언트에 설치해야 합니다.
6. 키워 나가기
새 아이디어는 각자의 자리에. 아이템을 더하려면 content/items.craft에, 새 게임 규칙은 events/ 아래 새 파일에, 여러 파일에서 쓰는 함수는 lib/에, 설정은 settings.craft에 둡니다. 전체 예제 모드는 모드 정리하기에 있습니다.