kustom-mc 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +809 -0
- package/dist/commands/build.d.ts +2 -0
- package/dist/commands/build.js +447 -0
- package/dist/commands/bundle.d.ts +2 -0
- package/dist/commands/bundle.js +134 -0
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.js +219 -0
- package/dist/commands/list.d.ts +10 -0
- package/dist/commands/list.js +167 -0
- package/dist/commands/login.d.ts +9 -0
- package/dist/commands/login.js +167 -0
- package/dist/commands/new.d.ts +2 -0
- package/dist/commands/new.js +132 -0
- package/dist/commands/prepare.d.ts +9 -0
- package/dist/commands/prepare.js +267 -0
- package/dist/commands/push.d.ts +9 -0
- package/dist/commands/push.js +205 -0
- package/dist/commands/validate.d.ts +2 -0
- package/dist/commands/validate.js +191 -0
- package/dist/compiler/async-transform.d.ts +21 -0
- package/dist/compiler/async-transform.js +158 -0
- package/dist/compiler/inline.d.ts +32 -0
- package/dist/compiler/inline.js +87 -0
- package/dist/compiler/postprocess.d.ts +19 -0
- package/dist/compiler/postprocess.js +134 -0
- package/dist/compiler/rhino-plugin.d.ts +17 -0
- package/dist/compiler/rhino-plugin.js +324 -0
- package/dist/compiler/transform.d.ts +18 -0
- package/dist/compiler/transform.js +59 -0
- package/dist/config.d.ts +86 -0
- package/dist/config.js +166 -0
- package/dist/credentials.d.ts +65 -0
- package/dist/credentials.js +136 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +28 -0
- package/dist/runtime.d.ts +116 -0
- package/dist/runtime.js +96 -0
- package/dist/types/globals.d.ts +80 -0
- package/dist/types/globals.js +10 -0
- package/dist/types/index.d.ts +2094 -0
- package/dist/types/index.js +9 -0
- package/package.json +57 -0
- package/templates/project/kustom.config.json +26 -0
- package/templates/project/scripts/example.ts +17 -0
- package/templates/project/scripts/lib/utils.ts +19 -0
- package/templates/project/tsconfig.json +27 -0
- package/templates/scripts/block.ts.hbs +14 -0
- package/templates/scripts/gui.ts.hbs +28 -0
- package/templates/scripts/item.ts.hbs +13 -0
- package/templates/scripts/script.ts.hbs +18 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// kustom-mc type definitions
|
|
2
|
+
// Import globals to include them in the build output
|
|
3
|
+
import './globals.js';
|
|
4
|
+
// ============================================
|
|
5
|
+
// Global Declarations
|
|
6
|
+
// ============================================
|
|
7
|
+
// Note: console, setTimeout, setInterval are available in the Rhino runtime
|
|
8
|
+
// but we don't declare them here to avoid conflicts with @types/node.
|
|
9
|
+
// Add "lib": ["ES2020", "DOM"] to your tsconfig.json if you need console types.
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "kustom-mc",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "CLI and type library for kustompack development",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/runtime.js",
|
|
7
|
+
"types": "dist/runtime.d.ts",
|
|
8
|
+
"exports": {
|
|
9
|
+
".": {
|
|
10
|
+
"types": "./dist/runtime.d.ts",
|
|
11
|
+
"import": "./dist/runtime.js",
|
|
12
|
+
"require": "./dist/runtime.js"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"kustom": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"templates"
|
|
21
|
+
],
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "tsc",
|
|
24
|
+
"watch": "tsc --watch",
|
|
25
|
+
"prepublishOnly": "npm run build"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@babel/core": "^7.28.6",
|
|
29
|
+
"@babel/plugin-transform-async-to-generator": "^7.28.6",
|
|
30
|
+
"archiver": "^7.0.0",
|
|
31
|
+
"chalk": "^5.3.0",
|
|
32
|
+
"chokidar": "^3.6.0",
|
|
33
|
+
"commander": "^12.0.0",
|
|
34
|
+
"esbuild": "^0.20.0",
|
|
35
|
+
"glob": "^10.0.0",
|
|
36
|
+
"handlebars": "^4.7.0",
|
|
37
|
+
"regenerator-runtime": "^0.14.1"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/archiver": "^6.0.0",
|
|
41
|
+
"@types/babel__core": "^7.20.5",
|
|
42
|
+
"@types/node": "^20.0.0",
|
|
43
|
+
"typescript": "^5.4.0"
|
|
44
|
+
},
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=18.0.0"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"minecraft",
|
|
50
|
+
"kustom",
|
|
51
|
+
"typescript",
|
|
52
|
+
"rhino",
|
|
53
|
+
"scripting"
|
|
54
|
+
],
|
|
55
|
+
"author": "Levytation",
|
|
56
|
+
"license": "MIT"
|
|
57
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"include": [
|
|
3
|
+
"scripts/**/*.ts",
|
|
4
|
+
"blocks/**/*.ts",
|
|
5
|
+
"items/**/*.ts"
|
|
6
|
+
],
|
|
7
|
+
"exclude": [
|
|
8
|
+
"**/*.test.ts",
|
|
9
|
+
"**/*.spec.ts"
|
|
10
|
+
],
|
|
11
|
+
"outDir": ".",
|
|
12
|
+
"lib": ["scripts/lib"],
|
|
13
|
+
"deploy": {
|
|
14
|
+
"target": "../run/plugins/kustom-plugin/kustompack",
|
|
15
|
+
"reloadCommand": "/kustom reload"
|
|
16
|
+
},
|
|
17
|
+
"bundle": {
|
|
18
|
+
"output": "dist/kustompack.zip",
|
|
19
|
+
"include": [
|
|
20
|
+
"**/*.js",
|
|
21
|
+
"textures/**/*",
|
|
22
|
+
"gui/**/*",
|
|
23
|
+
"models/**/*"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineScript } from 'kustom-mc';
|
|
2
|
+
|
|
3
|
+
export default defineScript({
|
|
4
|
+
props: {
|
|
5
|
+
message: Props.String("Hello from kustompack!"),
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
run({ executor, props }) {
|
|
9
|
+
const player = executor.asPlayer();
|
|
10
|
+
if (!player) {
|
|
11
|
+
console.error("This script requires a player executor");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
player.sendMessage(props.message);
|
|
16
|
+
}
|
|
17
|
+
});
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for kustompack scripts.
|
|
3
|
+
* Import these in your scripts using:
|
|
4
|
+
* import { formatMessage } from './lib/utils';
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Format a message with a prefix.
|
|
9
|
+
*/
|
|
10
|
+
export function formatMessage(prefix: string, message: string): string {
|
|
11
|
+
return `[${prefix}] ${message}`;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Wait for a specified number of milliseconds.
|
|
16
|
+
*/
|
|
17
|
+
export function delay(ms: number): Promise<void> {
|
|
18
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
19
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2020",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleDetection": "force",
|
|
6
|
+
"moduleResolution": "bundler",
|
|
7
|
+
"strict": true,
|
|
8
|
+
"noEmit": true,
|
|
9
|
+
"isolatedModules": true,
|
|
10
|
+
"esModuleInterop": true,
|
|
11
|
+
"skipLibCheck": true,
|
|
12
|
+
"types": ["kustom-mc"],
|
|
13
|
+
"baseUrl": ".",
|
|
14
|
+
"paths": {
|
|
15
|
+
"@lib/*": ["scripts/lib/*"]
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"include": [
|
|
19
|
+
"scripts/**/*.ts",
|
|
20
|
+
"blocks/**/*.ts",
|
|
21
|
+
"items/**/*.ts"
|
|
22
|
+
],
|
|
23
|
+
"exclude": [
|
|
24
|
+
"node_modules",
|
|
25
|
+
"dist"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineScript } from 'kustom-mc';
|
|
2
|
+
|
|
3
|
+
export default defineScript({
|
|
4
|
+
run({ shaper }) {
|
|
5
|
+
shaper.create("{{name}}")
|
|
6
|
+
.withModel("kustom:block/{{name}}")
|
|
7
|
+
.fullBlockCollision()
|
|
8
|
+
.onClick((event) => {
|
|
9
|
+
const player = event.player;
|
|
10
|
+
player.sendMessage("You clicked {{name}}!");
|
|
11
|
+
})
|
|
12
|
+
.register();
|
|
13
|
+
}
|
|
14
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineScript } from 'kustom-mc';
|
|
2
|
+
|
|
3
|
+
export default defineScript({
|
|
4
|
+
props: {
|
|
5
|
+
title: Props.String("{{name}}"),
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
run({ executor, props, process }) {
|
|
9
|
+
const player = executor.asPlayer();
|
|
10
|
+
if (!player) {
|
|
11
|
+
console.error("This script requires a player executor");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const screen = new Screen("gui/{{name}}.png", 54, {
|
|
16
|
+
autoCover: true,
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
screen.appendText(props.title, 9, 20, true);
|
|
20
|
+
|
|
21
|
+
screen.addButton(8, "close", "Close", () => {
|
|
22
|
+
screen.close();
|
|
23
|
+
process.exit(null);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
screen.open(player);
|
|
27
|
+
}
|
|
28
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineScript } from 'kustom-mc';
|
|
2
|
+
|
|
3
|
+
export default defineScript({
|
|
4
|
+
run({ items, definition }) {
|
|
5
|
+
items.create("{{name}}")
|
|
6
|
+
.withModel(definition.model("kustom:item/{{name}}"))
|
|
7
|
+
.on("rightClick", (event) => {
|
|
8
|
+
const player = event.player;
|
|
9
|
+
player.sendMessage("You used {{name}}!");
|
|
10
|
+
})
|
|
11
|
+
.register();
|
|
12
|
+
}
|
|
13
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { defineScript } from 'kustom-mc';
|
|
2
|
+
|
|
3
|
+
export default defineScript({
|
|
4
|
+
props: {
|
|
5
|
+
// Define your props here
|
|
6
|
+
},
|
|
7
|
+
|
|
8
|
+
run({ executor, props, process }) {
|
|
9
|
+
const player = executor.asPlayer();
|
|
10
|
+
if (!player) {
|
|
11
|
+
console.error("This script requires a player executor");
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
// Your script logic here
|
|
16
|
+
player.sendMessage("Hello from {{name}}!");
|
|
17
|
+
}
|
|
18
|
+
});
|