Datapack ComputEREnglish · 한국어
A VS Code extension for editing Minecraft (Java Edition 26.3+)
Getting started
The calculatorThe layout follows Datapack TextER: an expression page on top, the Output (JSON or the command line) below,
with a copy button and a draggable splitter. The result is shown next to Output (
SavingEdits are written to the file only when you press Ctrl+S (or the Save button). Unsaved calculators show a ● on the tab. The calculator opens like Datapack TextER: in its own window, whose editor group is locked. Closing the calculator — its tab or its whole window — closes it (it is not moved back into the main window). With unsaved changes you are asked "Save the changes?": Save writes the file, Don't Save just closes it.
|
| Setting | Values | |
|---|---|---|
datapackComputer.language |
Auto, English, 한국어 | Auto = 한국어 when VS Code is in Korean, English otherwise |
datapackComputer.openIn |
newWindow, beside | where the calculator opens |
datapackComputer.maximizeWindow |
true / false | maximize the new window (Windows) |
datapackComputer.namespacedTypes |
true / false | write minecraft:add instead of add |
datapackComputer.codeLens |
true / false | show the "Open calculator" CodeLens |
datapackComputer.samples |
50–20000 | samples used to preview random values |
Command titles and setting descriptions follow VS Code's own display language (a VS Code limitation).
Sources
- SpyglassMC/vanilla-mcdoc —
java/data/number_provider/context_float.mcdoc,context_int.mcdoc - misode: context-float-provider, context-int-provider
- Minecraft Wiki: /compute
The result is a preview. Integer math mimics Java's 32-bit overflow, but from_float rounding (currently floor), conditions other than
random_chance, tags and macros may differ from the game. The inline provider format of /compute is assumed to be SNBT, like other
inline command data.
Development
npm install
npm run compile
npm test
npm run package
Datapack ComputER (한국어)
English · 한국어
[!WARNING] 지원 중단. 이 확장은 Datapack TextER(1.1.0 이상)에 통합되었습니다. 같은 계산기가 Datapack TextER에 들어 있으니, Datapack TextER를 설치하고 이 확장은 제거해 주세요. Datapack ComputER는 더 이상 업데이트되지 않습니다.
Minecraft (Java Edition 26.3+) 데이터팩의 context_float_provider / context_int_provider JSON과
.mcfunction의 /compute 명령어를 계산기처럼 편집하는 VS Code 확장입니다. 수식을 입력하면 JSON으로 써 줍니다.
| 입력 | Output |
|---|---|
(1+1) |
{"type": "minecraft:add", "inputs": [1, 1]} |
(2+7)*3 |
{"type": "minecraft:mul", "inputs": [{"type": "minecraft:add", "inputs": [2, 7]}, 3]} |
8/2(2) |
8 / (2 * 2) → = 2 |
시작하기
- 데이터팩 폴더를 엽니다. 다음을 자동으로 감지합니다.
data/<namespace>/context_float_provider/**.json,data/<namespace>/context_int_provider/**.json(탐색기의 Context Providers 뷰에 목록이 나옵니다).mcfunction파일의 모든compute명령어 줄
- 파일이나 명령어 위의
Float/Int 계산기 열기CodeLens를 누르거나, 값에서 Ctrl+Alt+Click / Ctrl+Click, 또는 Ctrl+Alt+Enter를 누릅니다.- 계산기는 새 창에 열리고, Windows에서는 자동으로 최대화됩니다
(
datapackComputer.openIn,datapackComputer.maximizeWindow). - Ctrl+Alt+Click은 VS Code의 "정의를 옆에 열기"를 이용하므로 기본값
editor.multiCursorModifier: "alt"에서 동작합니다.
- 계산기는 새 창에 열리고, Windows에서는 자동으로 최대화됩니다
(
계산기
Datapack TextER와 같은 구성입니다. 위는 수식 입력, 아래는 Output(JSON 또는 명령어 줄)이며 복사 버튼과 크기 조절 막대가 있습니다.
Output 옆에 결과값이 보입니다 (= 27, 랜덤이면 평균과 범위).
- 수학은 일반 수식:
a + b,a - b,a * b,a / b,a % b,a // b(floor_div),a^b,|a|,-(a),sqrt(a),sin(a),cos(a),ceil(a),floor(a),round(a),truncate(a),max(a, b, …),min,avg,length,floor_mod(a, b),uniform(min, max),binomial(n, p),constant(v),weighted_list(가중치, 값, …),conditional(조건, 참, 거짓),number_dispatcher(조건, 값, …, 그 외),from_int(a),from_float(a). - 생략된 곱셈:
5(2),(5)(2)는5 * 2이고,*/보다 먼저 계산합니다 —8/2(2)= 8 / (2·2) = 2. - 게임 데이터만 캡슐(pill):
Storage: ns:id path,Score: this luck,Environment: …,Enchantment: …,Reference: ns:id, 조건(Chance: 25%,Predicate: ns:id). 캡슐을 클릭하면 편집 창이 열립니다 (Save / Remove). - Insert 바: 첫 줄은 캡슐을 넣습니다 (Storage, Score, Environment, Enchantment, Reference, Condition).
그 아래 줄에는 모든 함수가 버튼으로 있고, 마우스를 올리면 설명이 나옵니다.
- 글자를 선택하고 함수를 고르면 감쌉니다 (
2+7→ Sqrt →sqrt(2+7)). 숫자 바로 뒤에서는 연산자만 붙습니다 (3→ Pow →3^2). - 커서 자리에서 쓸 수 없는 버튼은 꺼집니다 (실수 파일이라도
from_int( … )안이면 정수 함수가 켜집니다). - score는 정수라서 실수 provider에서는
from_int( … )안에서만 쓸 수 있습니다 — Score 버튼이 자동으로 감쌉니다. 정수 provider에서 Environment / Enchantment는from_float( … )로 감쌉니다.
- 글자를 선택하고 함수를 고르면 감쌉니다 (
- 자동완성 (Spyglass처럼): Score / Storage 창에서
.mcfunction에 있는 목표, 점수 소유자(#const등), 스토리지 ID와 경로를 보여 줍니다.@s는this로 바뀝니다. - 문법 오류나 쓸 수 없는 함수는 빨간 글씨로 알려 주고, 고칠 때까지 저장되지 않습니다.
저장
고친 내용은 Ctrl+S(또는 Save 버튼)를 누를 때에만 파일에 씁니다. 저장하지 않은 계산기는 탭에 ●가 붙습니다. 계산기는 Datapack TextER처럼 자기 창에 열리고, 그 창의 편집기 그룹은 잠깁니다. 계산기 탭이나 창을 닫으면 메인 창으로 옮겨지지 않고 그냥 닫힙니다. 저장하지 않은 변경이 있으면 **"변경 내용을 저장할까요?"**라고 묻고, 저장은 파일에 쓰고 저장 안 함은 그냥 닫습니다.
.mcfunction의 /compute
compute <default | block <x y z> | entity <대상>> float <provider> [<scale>]
compute <default | block <x y z> | entity <대상>> integer <provider>
- provider는 ID(
namespace:path)나 인라인 정의(SNBT, 예:{type:"minecraft:add",inputs:[1,2]})입니다.execute … run compute …도 됩니다. - 계산기에서 provider(float이면 scale도)를 고칩니다. 저장하면 provider와 scale만 바뀌고 줄의 나머지는 그대로 둡니다.
- 문법이 틀린 compute 줄은 빨간 밑줄과 CodeLens 경고로 알려 줍니다.
매크로 함수
- 매크로는
$(base) * 2처럼 직접 입력합니다. 글자 그대로 보이고, 결과값 계산에서는 0으로 봅니다. $(이름)은 줄 맨 앞에$가 있는 줄($compute …,$execute … run compute …)에서만 쓸 수 있습니다.$없이 쓰면 오류입니다.- 이름에 오류가 없으면(영문, 숫자,
_) provider 안, scale, 컨텍스트, ID(ns:$(id)) 어디든 그대로 통과합니다. - 저장할 때 매크로가 있으면 줄 맨 앞에
$를 붙이고, 하나도 없으면 뗍니다 (변수가 없는 매크로 줄은 Minecraft에서 오류이므로).
설정 (Ctrl+,)
| 설정 | 값 | |
|---|---|---|
datapackComputer.language |
Auto, English, 한국어 | Auto = VS Code가 한국어면 한국어, 그 외에는 영어 |
datapackComputer.openIn |
newWindow, beside | 계산기를 여는 위치 |
datapackComputer.maximizeWindow |
true / false | 새 창 자동 최대화 (Windows) |
datapackComputer.namespacedTypes |
true / false | add 대신 minecraft:add로 쓰기 |
datapackComputer.codeLens |
true / false | "계산기 열기" CodeLens 표시 |
datapackComputer.samples |
50–20000 | 랜덤 값을 미리 볼 때 쓰는 샘플 수 |
명령어 이름과 설정 설명은 VS Code의 표시 언어를 따릅니다 (VS Code의 제약).
출처
- SpyglassMC/vanilla-mcdoc —
java/data/number_provider/context_float.mcdoc,context_int.mcdoc - misode: context-float-provider, context-int-provider
- Minecraft Wiki: /compute
결과값은 미리보기입니다. 정수 연산은 Java 32비트 오버플로를 흉내 내지만, from_float의 반올림(현재 내림), random_chance 외의 조건,
태그, 매크로는 게임과 다를 수 있습니다. /compute의 인라인 provider 형식은 다른 명령어의 인라인 데이터처럼 SNBT라고 보고 처리합니다.
개발
npm install
npm run compile
npm test
npm run package