mbler 0.1.3-alpha → 0.1.3-alpna-r1
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/LICENSE +21 -21
- package/README.md +8 -4
- package/bin/mbler.js +12 -12
- package/bin/minify.js +58 -44
- package/lib/build/base.js +1 -297
- package/lib/build/build-g-config.json +12 -12
- package/lib/build/getModule.js +1 -182
- package/lib/build/index.js +1 -370
- package/lib/build/manifest.build.js +1 -103
- package/lib/build/mcVersion.js +1 -86
- package/lib/build/utils.js +1 -6
- package/lib/code-processor/c-handler-export.js +1 -12
- package/lib/code-processor/index.js +1 -141
- package/lib/code-processor/mtreehandler.js +1 -164
- package/lib/commander/index.js +1 -154
- package/lib/data/includes.json +13 -13
- package/lib/data/version.json +88 -88
- package/lib/git/clone.js +1 -28
- package/lib/git/index.js +1 -12
- package/lib/git/pull.js +1 -100
- package/lib/lang/__translate.js +1 -93
- package/lib/lang/en.js +1 -128
- package/lib/lang/index.js +1 -78
- package/lib/lang/zh.js +1 -146
- package/lib/loger/colors.js +1 -13
- package/lib/loger/index.js +1 -136
- package/lib/mcx/ast/index.js +1 -11
- package/lib/mcx/ast/prop.js +1 -78
- package/lib/mcx/ast/tag.js +1 -246
- package/lib/mcx/compile-component/lib.js +1 -106
- package/lib/mcx/compile-component/types.js +1 -2
- package/lib/mcx/compile-component/utils.js +1 -26
- package/lib/mcx/compile-mcx/compile.js +1 -34
- package/lib/mcx/compile-mcx/compiler/bundler.js +1 -0
- package/lib/mcx/compile-mcx/compiler/compileData.js +1 -0
- package/lib/mcx/compile-mcx/compiler/compileMain.js +1 -0
- package/lib/mcx/compile-mcx/compiler/index.js +1 -0
- package/lib/mcx/compile-mcx/compiler/utils.js +1 -0
- package/lib/mcx/compile-mcx/context.js +1 -19
- package/lib/mcx/compile-mcx/index.js +1 -10
- package/lib/mcx/compile-mcx/mcx/index.js +1 -2
- package/lib/mcx/compile-mcx/mcx/types.js +1 -2
- package/lib/mcx/compile-mcx/template/module.js +1 -42
- package/lib/mcx/compile-mcx/types.js +1 -2
- package/lib/mcx/compile-mcx/utils.node.js +1 -207
- package/lib/mcx/index.js +1 -13
- package/lib/mcx/test/index.js +1 -7
- package/lib/mcx/test.js +1 -21
- package/lib/mcx/types.js +1 -2
- package/lib/mcx/utils.js +1 -86
- package/lib/module-handler/index.js +1 -482
- package/lib/modules/create-game/mbler.config.json +13 -13
- package/lib/modules/create-game/src/Runner/RunnerManager.js +1 -113
- package/lib/modules/create-game/src/Runner/scriptRunner.js +1 -70
- package/lib/modules/create-game/src/config.js +1 -27
- package/lib/modules/create-game/src/constants.js +1 -19
- package/lib/modules/create-game/src/createGameModule.js +1 -24
- package/lib/modules/create-game/src/gameComponent/common/autoStop.js +1 -38
- package/lib/modules/create-game/src/gameComponent/common/lazyLoader.js +1 -76
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/onTimeEvent.js +1 -36
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/stopWatch.js +1 -90
- package/lib/modules/create-game/src/gameComponent/common/stopWatch/tickEvent.js +1 -29
- package/lib/modules/create-game/src/gameComponent/common/timer/onTimeEvent.js +1 -36
- package/lib/modules/create-game/src/gameComponent/common/timer/tickEvent.js +1 -29
- package/lib/modules/create-game/src/gameComponent/common/timer/timer.js +1 -87
- package/lib/modules/create-game/src/gameComponent/gameComponent.js +1 -53
- package/lib/modules/create-game/src/gameComponent/index.js +1 -31
- package/lib/modules/create-game/src/gameComponent/player/blockInteractionBlocker.js +1 -40
- package/lib/modules/create-game/src/gameComponent/player/entityInteractionBlocker.js +1 -48
- package/lib/modules/create-game/src/gameComponent/player/healthIndicator.js +1 -48
- package/lib/modules/create-game/src/gameComponent/player/regionMonitor.js +1 -22
- package/lib/modules/create-game/src/gameComponent/player/respawn.js +1 -59
- package/lib/modules/create-game/src/gameComponent/player/spawnProtector.js +1 -69
- package/lib/modules/create-game/src/gameComponent/region/regionProtecter.js +1 -53
- package/lib/modules/create-game/src/gameComponent/region/regionTeamChooser.js +1 -71
- package/lib/modules/create-game/src/gameComponent/region/regionTeamCleaner.js +1 -20
- package/lib/modules/create-game/src/gameComponent/view/infoScoreboard.js +1 -77
- package/lib/modules/create-game/src/gameComponent/view/teamScoreboard.js +1 -83
- package/lib/modules/create-game/src/gameContext.js +1 -6
- package/lib/modules/create-game/src/gameEngine.js +1 -139
- package/lib/modules/create-game/src/gameEvent/eventManager.js +1 -108
- package/lib/modules/create-game/src/gameEvent/eventSignal.js +1 -28
- package/lib/modules/create-game/src/gameEvent/events/buttonPush.js +1 -41
- package/lib/modules/create-game/src/gameEvent/events/inSlot.js +1 -77
- package/lib/modules/create-game/src/gameEvent/events/interval.js +1 -51
- package/lib/modules/create-game/src/gameEvent/events/itemUse.js +1 -36
- package/lib/modules/create-game/src/gameEvent/events/onBlock.js +1 -106
- package/lib/modules/create-game/src/gameEvent/events/regionEvents.js +1 -105
- package/lib/modules/create-game/src/gameEvent/events/signClick.js +1 -45
- package/lib/modules/create-game/src/gameEvent/gameEvent.js +1 -54
- package/lib/modules/create-game/src/gameEvent/index.js +1 -20
- package/lib/modules/create-game/src/gameEvent/mapEventSignal.js +1 -101
- package/lib/modules/create-game/src/gameEvent/subscription.js +1 -17
- package/lib/modules/create-game/src/gamePlayer/gamePlayer.js +1 -102
- package/lib/modules/create-game/src/gamePlayer/groupBuilder.js +1 -38
- package/lib/modules/create-game/src/gamePlayer/groupSet.js +1 -96
- package/lib/modules/create-game/src/gamePlayer/index.js +1 -25
- package/lib/modules/create-game/src/gamePlayer/playerGroup.js +1 -145
- package/lib/modules/create-game/src/gamePlayer/playerManager.js +1 -57
- package/lib/modules/create-game/src/gameRegion/gameRegion.js +1 -229
- package/lib/modules/create-game/src/gameRegion/index.js +1 -43
- package/lib/modules/create-game/src/gameRegion/regionHelper.js +1 -79
- package/lib/modules/create-game/src/gameState/common/autoStop.js +1 -39
- package/lib/modules/create-game/src/gameState/gameState.js +1 -169
- package/lib/modules/create-game/src/gameState/index.js +1 -7
- package/lib/modules/create-game/src/gameState/types.js +1 -35
- package/lib/modules/create-game/src/gameStructure/gameStructure.js +1 -36
- package/lib/modules/create-game/src/main.js +1 -86
- package/lib/modules/create-game/src/system/gameCommand.js +1 -107
- package/lib/modules/create-game/src/system/gameManager.js +1 -124
- package/lib/modules/create-game/src/system/globalPlayerManager.js +1 -119
- package/lib/modules/create-game/src/utils/GameError.js +1 -31
- package/lib/modules/create-game/src/utils/algorithm.js +1 -95
- package/lib/modules/create-game/src/utils/chunk.js +1 -63
- package/lib/modules/create-game/src/utils/deferredObject.js +1 -27
- package/lib/modules/create-game/src/utils/duration.js +1 -25
- package/lib/modules/create-game/src/utils/func.js +1 -20
- package/lib/modules/create-game/src/utils/index.js +1 -52
- package/lib/modules/create-game/src/utils/interfaces.js +1 -2
- package/lib/modules/create-game/src/utils/logger.js +1 -47
- package/lib/modules/create-game/src/utils/random.js +1 -76
- package/lib/modules/create-game/src/utils/vanila-data.js +1 -123
- package/lib/modules/create-game/src/utils/vector.js +1 -96
- package/lib/modules/gameLib/mbler.config.json +15 -15
- package/lib/modules/gameLib/src/config.js +1 -134
- package/lib/modules/gameLib/src/data.js +1 -77
- package/lib/modules/gameLib/src/entity.js +1 -256
- package/lib/modules/gameLib/src/event.js +1 -285
- package/lib/modules/gameLib/src/index.js +1 -20
- package/lib/modules/gameLib/src/loger.js +1 -21
- package/lib/modules/gameLib/src/ui.js +1 -209
- package/lib/modules/gameLib/src/utils.js +1 -122
- package/lib/modules/gutils/mbler.config.json +11 -11
- package/lib/modules/gutils/src/index.js +1 -22
- package/lib/modules/innerDef.json +4 -4
- package/lib/runTemp/File.js +1 -54
- package/lib/runTemp/config.json +3 -3
- package/lib/runTemp/index.js +1 -137
- package/lib/runTemp/securityFile.js +1 -93
- package/lib/start/addPack.js +1 -3
- package/lib/start/clean.js +1 -84
- package/lib/start/create.js +1 -146
- package/lib/start/dev.js +1 -99
- package/lib/start/getResConfig.js +1 -3
- package/lib/start/incg.js +1 -3
- package/lib/start/index.js +1 -207
- package/lib/start/init.js +1 -125
- package/lib/start/rechce.js +1 -57
- package/lib/start/unaddPack.js +1 -3
- package/lib/start/unincg.js +1 -67
- package/lib/start/version.js +1 -73
- package/lib/utils/index.js +1 -298
- package/lib/uuid/index.js +1 -27
- package/package.json +49 -1
- package/test/2x sword/behavior/scripts/index.js +24 -24
- package/test/2x sword/mbler.config.json +11 -11
- package/test/2x sword/package.json +13 -13
- package/test/README.md +7 -7
- package/test/des/index.js +19 -19
- package/test/des/mbler.config.json +4 -4
- package/test/des/package.json +6 -6
- package/test/initializer/index.js +5 -5
- package/test/initializer/mbler.config.json +4 -4
- package/test/initializer/package.json +6 -6
- package/test/mbler-int/behavior/res/items/mang_one_int.json +21 -21
- package/test/mbler-int/behavior/scripts/index.js +7 -7
- package/test/mbler-int/behavior/scripts/lib/event/index.js +19 -19
- package/test/mbler-int/behavior/scripts/lib/ui/Lore.js +18 -18
- package/test/mbler-int/behavior/scripts/lib/ui/baseUi.js +6 -6
- package/test/mbler-int/behavior/scripts/lib/ui/index.js +206 -206
- package/test/mbler-int/behavior/scripts/lib/utils/index.js +51 -51
- package/test/mbler-int/mbler.config.json +18 -18
- package/test/mbler-int/package.json +12 -12
- package/test/script-mbler/behavior/scripts/index.js +5 -0
- package/test/script-mbler/behavior/scripts/index.ts +5 -5
- package/test/script-mbler/mbler.config.json +14 -14
- package/test/script-mbler/package.json +15 -15
- package/lib/mcx/compile-mcx/_compile.js +0 -602
package/lib/utils/index.js
CHANGED
|
@@ -1,298 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.config = exports.isVerison = exports.JSONparse = exports.readFile = exports.sleep = exports.waitGC = exports.input = void 0;
|
|
7
|
-
exports.hasKeys = hasKeys;
|
|
8
|
-
exports.zip = zip;
|
|
9
|
-
exports.toString = toString;
|
|
10
|
-
exports.ToArray = ToArray;
|
|
11
|
-
exports.readFileWithRetry = readFileWithRetry;
|
|
12
|
-
exports.join = join;
|
|
13
|
-
exports.Exit = Exit;
|
|
14
|
-
exports.FileExsit = FileExsit;
|
|
15
|
-
exports.GetData = GetData;
|
|
16
|
-
exports.isMblerProject = isMblerProject;
|
|
17
|
-
exports.handlerPackage = handlerPackage;
|
|
18
|
-
exports.copy = copy;
|
|
19
|
-
const node_path_1 = __importDefault(require("node:path"));
|
|
20
|
-
const adm_zip_1 = __importDefault(require("adm-zip"));
|
|
21
|
-
const index_js_1 = __importDefault(require("./../loger/index.js"));
|
|
22
|
-
const commander_1 = require("./../commander");
|
|
23
|
-
const config = require('./../build/build-g-config.json');
|
|
24
|
-
const promises_1 = __importDefault(require("node:fs/promises"));
|
|
25
|
-
function hasKeys(obj, keys, minValue) {
|
|
26
|
-
if (!(typeof obj === `object` &&
|
|
27
|
-
!Array.isArray(obj)))
|
|
28
|
-
return false;
|
|
29
|
-
if (!Array.isArray(keys))
|
|
30
|
-
return false;
|
|
31
|
-
let count = 0;
|
|
32
|
-
for (const key of keys) {
|
|
33
|
-
if (obj.hasOwnProperty(key)) {
|
|
34
|
-
count++;
|
|
35
|
-
if (count >= minValue)
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
exports.input = function () {
|
|
42
|
-
let curr;
|
|
43
|
-
let currstr = "";
|
|
44
|
-
let tip = "";
|
|
45
|
-
let show = true;
|
|
46
|
-
// 在输入时使用输入中间件
|
|
47
|
-
commander_1.Input.use(function (raw, ctrl, alt, name) {
|
|
48
|
-
if (typeof curr !== "function")
|
|
49
|
-
return;
|
|
50
|
-
if (ctrl || alt)
|
|
51
|
-
return;
|
|
52
|
-
if (raw) {
|
|
53
|
-
if (raw === 'return' || raw === 'enter') {
|
|
54
|
-
curr(currstr);
|
|
55
|
-
curr = null;
|
|
56
|
-
currstr = "";
|
|
57
|
-
console.log("");
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (raw === 'backspace') {
|
|
61
|
-
currstr = currstr.slice(0, -1);
|
|
62
|
-
refreshInput();
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
if (name && typeof name === 'string') {
|
|
67
|
-
currstr += name[0];
|
|
68
|
-
refreshInput();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
function refreshInput() {
|
|
72
|
-
const out = `\x1b[2K\r${tip}${show ? currstr : ""}`;
|
|
73
|
-
process.stdout.write(out);
|
|
74
|
-
}
|
|
75
|
-
/**
|
|
76
|
-
* 输入文本
|
|
77
|
-
* @param{string} tip 提示
|
|
78
|
-
* @param{boolean} show 是否显示输入
|
|
79
|
-
*/
|
|
80
|
-
return async function (t = "", g = true) {
|
|
81
|
-
return new Promise((resolve) => {
|
|
82
|
-
show = g;
|
|
83
|
-
tip = t;
|
|
84
|
-
refreshInput();
|
|
85
|
-
curr = resolve;
|
|
86
|
-
});
|
|
87
|
-
};
|
|
88
|
-
}();
|
|
89
|
-
/**
|
|
90
|
-
* 压缩目录为 ZIP,解压后根目录是 sourceDir 内的内容,而不是 sourceDir 文件夹本身
|
|
91
|
-
* @param {Array} sourceDir 要压缩的目录路径,如 ['C:/data/myfolder' 或 '/home/user/myfolder']
|
|
92
|
-
* @param {string} outputFile 输出的 ZIP 文件完整路径,如 'C:/backup/output.zip' 或 '/backup/output.zip'
|
|
93
|
-
* @returns {Promise<boolean>} 是否压缩成功
|
|
94
|
-
*/
|
|
95
|
-
async function zip(sourceDir, outputFile) {
|
|
96
|
-
const zip = new adm_zip_1.default();
|
|
97
|
-
for (let item of sourceDir) {
|
|
98
|
-
if (typeof item !== "string")
|
|
99
|
-
continue;
|
|
100
|
-
zip.addLocalFolder(item);
|
|
101
|
-
}
|
|
102
|
-
await zip.writeZipPromise(outputFile);
|
|
103
|
-
}
|
|
104
|
-
const waitGC = () => new Promise(r => setImmediate(r));
|
|
105
|
-
exports.waitGC = waitGC;
|
|
106
|
-
function toString(t) {
|
|
107
|
-
if (typeof t === 'string')
|
|
108
|
-
return t;
|
|
109
|
-
if (t instanceof Error) {
|
|
110
|
-
if (typeof t.stack == "string")
|
|
111
|
-
return t.stack;
|
|
112
|
-
return t.message;
|
|
113
|
-
}
|
|
114
|
-
;
|
|
115
|
-
if (Array.isArray(t))
|
|
116
|
-
return t.map((item) => toString(item)).join('\n');
|
|
117
|
-
if (typeof t?.toString === 'function')
|
|
118
|
-
return t.toString();
|
|
119
|
-
if (t === void 0)
|
|
120
|
-
return '[Objeect utils]';
|
|
121
|
-
return JSON.stringify(t, null, 2);
|
|
122
|
-
}
|
|
123
|
-
function ToArray(str) {
|
|
124
|
-
return str.split(`.`).map(Number);
|
|
125
|
-
}
|
|
126
|
-
const sleep = (ms = 100) => new Promise(resolve => setTimeout(resolve, ms));
|
|
127
|
-
exports.sleep = sleep;
|
|
128
|
-
/**
|
|
129
|
-
* 读取文件内容
|
|
130
|
-
* @param filePath 文件路径
|
|
131
|
-
* @param opt 选项,包含 want: 'string' | 'object'
|
|
132
|
-
* @returns 文件内容(字符串或解析后的对象)
|
|
133
|
-
*/
|
|
134
|
-
async function readFileWithRetry(filePath, opt) {
|
|
135
|
-
const opts = {
|
|
136
|
-
maxRetries: 5,
|
|
137
|
-
delay: 200,
|
|
138
|
-
want: 'string',
|
|
139
|
-
...opt
|
|
140
|
-
};
|
|
141
|
-
let lastError;
|
|
142
|
-
for (let attempt = 0; attempt < opts.maxRetries; attempt++) {
|
|
143
|
-
try {
|
|
144
|
-
let resu = "";
|
|
145
|
-
const text = (await promises_1.default.readFile(filePath)).toString();
|
|
146
|
-
if (opts.want === 'string')
|
|
147
|
-
resu = text.toString();
|
|
148
|
-
if (opts.want === 'object') {
|
|
149
|
-
try {
|
|
150
|
-
resu = JSON.parse(text);
|
|
151
|
-
}
|
|
152
|
-
catch {
|
|
153
|
-
resu = {};
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
return resu;
|
|
157
|
-
}
|
|
158
|
-
catch (err) {
|
|
159
|
-
lastError = err;
|
|
160
|
-
if (attempt < opts.maxRetries - 1) {
|
|
161
|
-
await (0, exports.sleep)(opts.delay);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
return {};
|
|
166
|
-
}
|
|
167
|
-
exports.readFile = readFileWithRetry;
|
|
168
|
-
const JSONparse = function (str) {
|
|
169
|
-
return JSON.parse(str);
|
|
170
|
-
};
|
|
171
|
-
exports.JSONparse = JSONparse;
|
|
172
|
-
function join(baseDir, inputPath) {
|
|
173
|
-
return node_path_1.default.isAbsolute(inputPath) ?
|
|
174
|
-
inputPath :
|
|
175
|
-
node_path_1.default.join(baseDir, inputPath);
|
|
176
|
-
}
|
|
177
|
-
const isVerison = function (str) {
|
|
178
|
-
return /\d+\.\d+\.\d+/.test(str);
|
|
179
|
-
};
|
|
180
|
-
exports.isVerison = isVerison;
|
|
181
|
-
function Exit(msg) {
|
|
182
|
-
index_js_1.default.e('ERROR', msg);
|
|
183
|
-
process.exit(1);
|
|
184
|
-
}
|
|
185
|
-
async function FileExsit(dir) {
|
|
186
|
-
try {
|
|
187
|
-
await promises_1.default.access(dir);
|
|
188
|
-
return true;
|
|
189
|
-
}
|
|
190
|
-
catch (err) {
|
|
191
|
-
return false;
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
async function GetData(dir) {
|
|
195
|
-
const configPath = node_path_1.default.join(dir, config.PackageFile);
|
|
196
|
-
const fileContent = await promises_1.default.readFile(configPath, 'utf-8');
|
|
197
|
-
const data = (0, exports.JSONparse)(fileContent);
|
|
198
|
-
if (typeof data.version === "string" && typeof data.name === "string" && typeof data.description === "string")
|
|
199
|
-
return data;
|
|
200
|
-
throw new Error("[mbler find config]: " + dir + ": not found config");
|
|
201
|
-
}
|
|
202
|
-
async function isMblerProject(Dir) {
|
|
203
|
-
const rel = await Promise.all([
|
|
204
|
-
node_path_1.default.join(Dir, "package.json"),
|
|
205
|
-
node_path_1.default.join(Dir, config.PackageFile)
|
|
206
|
-
].map(FileExsit)).catch((e) => {
|
|
207
|
-
console.log(e.stack);
|
|
208
|
-
return [false, false];
|
|
209
|
-
});
|
|
210
|
-
const res = rel.every(Boolean);
|
|
211
|
-
return res;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* 检查版本号是否有效(有效返回 true)
|
|
215
|
-
* @param {any} v
|
|
216
|
-
* @returns {boolean}
|
|
217
|
-
*/
|
|
218
|
-
function isValidVersion(v) {
|
|
219
|
-
return typeof v === 'string' && (0, exports.isVerison)(v);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* 处理模块包配置,提取依赖、主入口、UI 配置等
|
|
223
|
-
* @param {string} dir 模块目录路径
|
|
224
|
-
* @param {Object} opt 可选参数(如:已处理的依赖列表)
|
|
225
|
-
* @returns {Promise<Object>} { des: string[], ui: boolean, main: string }
|
|
226
|
-
*/
|
|
227
|
-
async function handlerPackage(dir, opt = {
|
|
228
|
-
des: []
|
|
229
|
-
}) {
|
|
230
|
-
let data;
|
|
231
|
-
try {
|
|
232
|
-
data = await GetData(dir);
|
|
233
|
-
}
|
|
234
|
-
catch (err) {
|
|
235
|
-
throw new Error(`无法读取模块配置文件: ${node_path_1.default.join(dir, config.PackageFile)}`);
|
|
236
|
-
}
|
|
237
|
-
// 必需字段校验
|
|
238
|
-
if (typeof data.name !== 'string' ||
|
|
239
|
-
typeof data.description !== 'string' ||
|
|
240
|
-
!isValidVersion(data.version)) {
|
|
241
|
-
throw new Error(`ERR-\n${node_path_1.default.join(dir, config.PackageFile)} 缺少必要字段。\n` +
|
|
242
|
-
'必需字段: name, description, version');
|
|
243
|
-
}
|
|
244
|
-
const result = {
|
|
245
|
-
des: {}, // 依赖模块名数组
|
|
246
|
-
ui: false, // 是否使用 @minecraft/server-ui
|
|
247
|
-
main: './index.js', // 默认主入口
|
|
248
|
-
name: data.name,
|
|
249
|
-
version: data.version,
|
|
250
|
-
description: data.description
|
|
251
|
-
};
|
|
252
|
-
// opt.des : Type Array || undefined
|
|
253
|
-
if (opt.des && data?.script?.dependencies)
|
|
254
|
-
result.des = ForOfMod(data.script.dependencies, opt.des);
|
|
255
|
-
result.ui = Boolean(Boolean(data?.script?.ui));
|
|
256
|
-
if (data?.script) {
|
|
257
|
-
result.main = data.script.main;
|
|
258
|
-
}
|
|
259
|
-
return result;
|
|
260
|
-
}
|
|
261
|
-
;
|
|
262
|
-
/**
|
|
263
|
-
* * 遍历模块依赖配置,过滤掉已经安装的模块
|
|
264
|
-
* @param Mod 模块依赖对象,key 是包名,value 是 Git 地址,例如 { "module-a": "git-url" }
|
|
265
|
-
* @param InstallMod 已安装的模块名数组,例如 ["module-a", "module-b"]
|
|
266
|
-
* @returns 过滤后的模块对象,只包含未安装的模块
|
|
267
|
-
*/
|
|
268
|
-
function ForOfMod(Mod, // 比如 { "pkg": "git-url" }
|
|
269
|
-
InstallMod // 比如 ["pkg1", "pkg2"]
|
|
270
|
-
) {
|
|
271
|
-
let returnValue = {};
|
|
272
|
-
try {
|
|
273
|
-
for (const [packageName, gitRepo] of Object.entries(Mod)) {
|
|
274
|
-
if (InstallMod?.includes &&
|
|
275
|
-
typeof InstallMod.includes === 'function' &&
|
|
276
|
-
InstallMod.includes(packageName)) {
|
|
277
|
-
continue; // 如果已安装,跳过
|
|
278
|
-
}
|
|
279
|
-
returnValue[packageName] = gitRepo;
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
catch (err) {
|
|
283
|
-
console.error('ForOfMod 发生错误:', err);
|
|
284
|
-
}
|
|
285
|
-
return returnValue;
|
|
286
|
-
}
|
|
287
|
-
async function copy(src, out) {
|
|
288
|
-
try {
|
|
289
|
-
await promises_1.default.cp(src, out, {
|
|
290
|
-
force: true,
|
|
291
|
-
recursive: true
|
|
292
|
-
});
|
|
293
|
-
}
|
|
294
|
-
catch (err) { }
|
|
295
|
-
}
|
|
296
|
-
;
|
|
297
|
-
const iconfig = require("./../build/build-g-config.json");
|
|
298
|
-
exports.config = iconfig;
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.config=exports.isVerison=exports.JSONparse=exports.readFile=exports.sleep=exports.waitGC=exports.input=void 0,exports.hasKeys=hasKeys,exports.zip=zip,exports.toString=toString,exports.ToArray=ToArray,exports.readFileWithRetry=readFileWithRetry,exports.join=join,exports.Exit=Exit,exports.FileExsit=FileExsit,exports.GetData=GetData,exports.isMblerProject=isMblerProject,exports.handlerPackage=handlerPackage,exports.copy=copy;const node_path_1=__importDefault(require("node:path")),adm_zip_1=__importDefault(require("adm-zip")),index_js_1=__importDefault(require("./../loger/index.js")),commander_1=require("./../commander"),config=require("./../build/build-g-config.json"),promises_1=__importDefault(require("node:fs/promises"));function hasKeys(e,t,r){if("object"!=typeof e||Array.isArray(e))return!1;if(!Array.isArray(t))return!1;let i=0;for(const o of t)if(e.hasOwnProperty(o)&&(i++,i>=r))return!0;return!1}async function zip(e,t){const r=new adm_zip_1.default;for(let t of e)"string"==typeof t&&r.addLocalFolder(t);await r.writeZipPromise(t)}exports.input=function(){let e,t="",r="",i=!0;function o(){const e=`[2K\r${r}${i?t:""}`;process.stdout.write(e)}return commander_1.Input.use(function(r,i,n,s){if("function"==typeof e&&!i&&!n){if(r){if("return"===r||"enter"===r)return e(t),e=null,t="",void console.log("");if("backspace"===r)return t=t.slice(0,-1),void o()}s&&"string"==typeof s&&(t+=s[0],o())}}),async function(t="",n=!0){return new Promise(s=>{i=n,r=t,o(),e=s})}}();const waitGC=()=>new Promise(e=>setImmediate(e));function toString(e){return"string"==typeof e?e:e instanceof Error?"string"==typeof e.stack?e.stack:e.message:Array.isArray(e)?e.map(e=>toString(e)).join("\n"):"function"==typeof e?.toString?e.toString():void 0===e?"[Objeect utils]":JSON.stringify(e,null,2)}function ToArray(e){return e.split(".").map(Number)}exports.waitGC=waitGC;const sleep=(e=100)=>new Promise(t=>setTimeout(t,e));async function readFileWithRetry(e,t){const r={maxRetries:5,delay:200,want:"string",...t};let i;for(let t=0;t<r.maxRetries;t++)try{let t="";const i=(await promises_1.default.readFile(e)).toString();if("string"===r.want&&(t=i.toString()),"object"===r.want)try{t=JSON.parse(i)}catch{t={}}return t}catch(e){i=e,t<r.maxRetries-1&&await(0,exports.sleep)(r.delay)}return{}}exports.sleep=sleep,exports.readFile=readFileWithRetry;const JSONparse=function(e){return JSON.parse(e)};function join(e,t){return node_path_1.default.isAbsolute(t)?t:node_path_1.default.join(e,t)}exports.JSONparse=JSONparse;const isVerison=function(e){return/\d+\.\d+\.\d+/.test(e)};function Exit(e){index_js_1.default.e("ERROR",e),process.exit(1)}async function FileExsit(e){try{return await promises_1.default.access(e),!0}catch(e){return!1}}async function GetData(e){const t=node_path_1.default.join(e,config.PackageFile),r=await promises_1.default.readFile(t,"utf-8"),i=(0,exports.JSONparse)(r);if("string"==typeof i.version&&"string"==typeof i.name&&"string"==typeof i.description)return i;throw new Error("[mbler find config]: "+e+": not found config")}async function isMblerProject(e){return(await Promise.all([node_path_1.default.join(e,"package.json"),node_path_1.default.join(e,config.PackageFile)].map(FileExsit)).catch(e=>(console.log(e.stack),[!1,!1]))).every(Boolean)}function isValidVersion(e){return"string"==typeof e&&(0,exports.isVerison)(e)}async function handlerPackage(e,t={des:[]}){let r;try{r=await GetData(e)}catch(t){throw new Error(`无法读取模块配置文件: ${node_path_1.default.join(e,config.PackageFile)}`)}if("string"!=typeof r.name||"string"!=typeof r.description||!isValidVersion(r.version))throw new Error(`ERR-\n${node_path_1.default.join(e,config.PackageFile)} 缺少必要字段。\n必需字段: name, description, version`);const i={des:{},ui:!1,main:"./index.js",name:r.name,version:r.version,description:r.description};return t.des&&r?.script?.dependencies&&(i.des=ForOfMod(r.script.dependencies,t.des)),i.ui=Boolean(Boolean(r?.script?.ui)),r?.script&&(i.main=r.script.main),i}function ForOfMod(e,t){let r={};try{for(const[i,o]of Object.entries(e))t?.includes&&"function"==typeof t.includes&&t.includes(i)||(r[i]=o)}catch(e){console.error("ForOfMod 发生错误:",e)}return r}async function copy(e,t){try{await promises_1.default.cp(e,t,{force:!0,recursive:!0})}catch(e){}}exports.isVerison=isVerison;const iconfig=require("./../build/build-g-config.json");exports.config=iconfig;
|
package/lib/uuid/index.js
CHANGED
|
@@ -1,27 +1 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fromString = void 0;
|
|
7
|
-
const node_crypto_1 = __importDefault(require("node:crypto"));
|
|
8
|
-
// 该模块用于从字符串生成哈希转 uuid
|
|
9
|
-
const fromString = (input, salt = '') => {
|
|
10
|
-
const combinedInput = salt + input;
|
|
11
|
-
const hash = node_crypto_1.default
|
|
12
|
-
.createHash('sha256')
|
|
13
|
-
.update(combinedInput)
|
|
14
|
-
.digest('hex');
|
|
15
|
-
const base = hash
|
|
16
|
-
.slice(0, 32); // 取前 32 个 hex 字符(16 字节)
|
|
17
|
-
const ls = '89ab';
|
|
18
|
-
const r = (t) => ls[(combinedInput.length + t) % ls.length];
|
|
19
|
-
// 构造成标准 UUID v4 格式:xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
|
|
20
|
-
const uuid = `${base.substring(0, 8)}-${base.substring(8, 12)}-4${base.substring(12, 15)}-8${r(1)}${r(2)}${r(3)}-${base.substring(18, 30)}`;
|
|
21
|
-
return uuid;
|
|
22
|
-
};
|
|
23
|
-
exports.fromString = fromString;
|
|
24
|
-
exports.default = {
|
|
25
|
-
fromString: exports.fromString,
|
|
26
|
-
uuid: node_crypto_1.default.randomUUID
|
|
27
|
-
};
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.fromString=void 0;const node_crypto_1=__importDefault(require("node:crypto")),fromString=(t,r="")=>{const e=r+t,o=node_crypto_1.default.createHash("sha256").update(e).digest("hex").slice(0,32),s="89ab",i=t=>s[(e.length+t)%4];return`${o.substring(0,8)}-${o.substring(8,12)}-4${o.substring(12,15)}-8${i(1)}${i(2)}${i(3)}-${o.substring(18,30)}`};exports.fromString=fromString,exports.default={fromString:exports.fromString,uuid:node_crypto_1.default.randomUUID};
|
package/package.json
CHANGED
|
@@ -1 +1,49 @@
|
|
|
1
|
-
{
|
|
1
|
+
{
|
|
2
|
+
"name": "mbler",
|
|
3
|
+
"version": "0.1.3-alpna-r1",
|
|
4
|
+
"description": "一个针对Minecraft JavaScript API 的lib库,让你的附加包版本管理更简单",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/RuanhoR/mbler.git"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [
|
|
10
|
+
"Minecraft",
|
|
11
|
+
"build",
|
|
12
|
+
"cli"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=16.0.0"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"type": "commonjs",
|
|
19
|
+
"main": "./lib/start/index.js",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"cli": "node bin/mbler.js",
|
|
22
|
+
"build": "node bin/minify.js"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@babel/generator": "7.28.5",
|
|
26
|
+
"@babel/parser": "7.28.5",
|
|
27
|
+
"@babel/traverse": "7.28.5",
|
|
28
|
+
"@babel/types": "7.28.6",
|
|
29
|
+
"adm-zip": "0.5.16",
|
|
30
|
+
"chokidar": "4.0.3",
|
|
31
|
+
"dayjs": "1.11.18",
|
|
32
|
+
"posthtml-parser": "^0.12.1",
|
|
33
|
+
"terser": "5.44.0",
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
|
+
},
|
|
36
|
+
"files": [
|
|
37
|
+
"lib",
|
|
38
|
+
"test",
|
|
39
|
+
"bin",
|
|
40
|
+
"README.md",
|
|
41
|
+
"LICENSE"
|
|
42
|
+
],
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"registry": "https://registry.npmjs.org"
|
|
45
|
+
},
|
|
46
|
+
"bin": {
|
|
47
|
+
"mbler": "bin/mbler.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
itemId: "§r§6§lmbler_test_2xsword:as§r§l §8 二倍剑",
|
|
3
|
-
ForRanger: 2
|
|
4
|
-
}
|
|
5
|
-
import {
|
|
6
|
-
EntityComponentTypes,
|
|
7
|
-
EquipmentSlot,
|
|
8
|
-
world,
|
|
9
|
-
system
|
|
10
|
-
} from "@minecraft/server"
|
|
11
|
-
world.afterEvents.entityDie.subscribe(({
|
|
12
|
-
deadEntity: entity,
|
|
13
|
-
damageSource: source
|
|
14
|
-
}) => {
|
|
15
|
-
system.run(()=>{ try { // 排除非正常人
|
|
16
|
-
if (!source.typeId.includes("player") || !getMainHand(source).nameTag.includes(config.itemId)) return;
|
|
17
|
-
} catch {}
|
|
18
|
-
for (let i = 0; i < config.ForRanger; i++) {
|
|
19
|
-
try {
|
|
20
|
-
entity.dimension.spawnEntity(entity.typeId)
|
|
21
|
-
} catch (err){
|
|
22
|
-
console.error(err)
|
|
23
|
-
}
|
|
24
|
-
}})
|
|
1
|
+
const config = {
|
|
2
|
+
itemId: "§r§6§lmbler_test_2xsword:as§r§l §8 二倍剑",
|
|
3
|
+
ForRanger: 2
|
|
4
|
+
}
|
|
5
|
+
import {
|
|
6
|
+
EntityComponentTypes,
|
|
7
|
+
EquipmentSlot,
|
|
8
|
+
world,
|
|
9
|
+
system
|
|
10
|
+
} from "@minecraft/server"
|
|
11
|
+
world.afterEvents.entityDie.subscribe(({
|
|
12
|
+
deadEntity: entity,
|
|
13
|
+
damageSource: source
|
|
14
|
+
}) => {
|
|
15
|
+
system.run(()=>{ try { // 排除非正常人
|
|
16
|
+
if (!source.typeId.includes("player") || !getMainHand(source).nameTag.includes(config.itemId)) return;
|
|
17
|
+
} catch {}
|
|
18
|
+
for (let i = 0; i < config.ForRanger; i++) {
|
|
19
|
+
try {
|
|
20
|
+
entity.dimension.spawnEntity(entity.typeId)
|
|
21
|
+
} catch (err){
|
|
22
|
+
console.error(err)
|
|
23
|
+
}
|
|
24
|
+
}})
|
|
25
25
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "双倍剑",
|
|
3
|
-
"description": "打生物会再生成一个的奇葩剑",
|
|
4
|
-
"mcVersion": "1.21.80",
|
|
5
|
-
"version": "0.0.2",
|
|
6
|
-
"script": {
|
|
7
|
-
"main": "index",
|
|
8
|
-
"ui": true
|
|
9
|
-
},
|
|
10
|
-
"minify": false,
|
|
11
|
-
"outdir": "/storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/development_behavior_packs/test/"
|
|
1
|
+
{
|
|
2
|
+
"name": "双倍剑",
|
|
3
|
+
"description": "打生物会再生成一个的奇葩剑",
|
|
4
|
+
"mcVersion": "1.21.80",
|
|
5
|
+
"version": "0.0.2",
|
|
6
|
+
"script": {
|
|
7
|
+
"main": "index",
|
|
8
|
+
"ui": true
|
|
9
|
+
},
|
|
10
|
+
"minify": false,
|
|
11
|
+
"outdir": "/storage/emulated/0/Android/data/com.mojang.minecraftpe/files/games/com.mojang/development_behavior_packs/test/"
|
|
12
12
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "双倍剑",
|
|
3
|
-
"description": "打生物会再生成一个的奇葩剑",
|
|
4
|
-
"version": "0.0.2",
|
|
5
|
-
"engines": {
|
|
6
|
-
"node": ">=20.0.0"
|
|
7
|
-
},
|
|
8
|
-
"scripts": {
|
|
9
|
-
"dev": "mbler dev",
|
|
10
|
-
"build": "MBLER_BUILD_MODULE=dist mbler build",
|
|
11
|
-
"dev-build": "MBLER_BUILD_MODULE=dev mbler build"
|
|
12
|
-
},
|
|
13
|
-
"dependencies": {}
|
|
1
|
+
{
|
|
2
|
+
"name": "双倍剑",
|
|
3
|
+
"description": "打生物会再生成一个的奇葩剑",
|
|
4
|
+
"version": "0.0.2",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20.0.0"
|
|
7
|
+
},
|
|
8
|
+
"scripts": {
|
|
9
|
+
"dev": "mbler dev",
|
|
10
|
+
"build": "MBLER_BUILD_MODULE=dist mbler build",
|
|
11
|
+
"dev-build": "MBLER_BUILD_MODULE=dev mbler build"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {}
|
|
14
14
|
}
|
package/test/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
# 欢迎来到测试脚本列表 !
|
|
2
|
-
|
|
3
|
-
这里有两个文件夹,分别是包测试,你可以使用
|
|
4
|
-
|
|
5
|
-
> mbler <
|
|
6
|
-
|
|
7
|
-
构建成Minecraft行为包 !
|
|
1
|
+
# 欢迎来到测试脚本列表 !
|
|
2
|
+
|
|
3
|
+
这里有两个文件夹,分别是包测试,你可以使用
|
|
4
|
+
|
|
5
|
+
> mbler <
|
|
6
|
+
|
|
7
|
+
构建成Minecraft行为包 !
|
|
8
8
|
这些包可供你学习mbler的用法
|
package/test/des/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
exports.main = async function main(content) {
|
|
2
|
-
const name = await MblerApi.input("名称")
|
|
3
|
-
const desc = await MblerApi.input(`描述 `)
|
|
4
|
-
const main = await MblerApi.input(`主脚本 `)
|
|
5
|
-
content.setWorkDir
|
|
6
|
-
.writeFile("./mbler.config.json", JSON.stringify({
|
|
7
|
-
name,
|
|
8
|
-
description: desc,
|
|
9
|
-
script: {
|
|
10
|
-
main: "src/index.js",
|
|
11
|
-
dependencies: {}
|
|
12
|
-
},
|
|
13
|
-
type: "scriptsDes",
|
|
14
|
-
version: "0.0.1",
|
|
15
|
-
mcVersion: [
|
|
16
|
-
"1.21.00",
|
|
17
|
-
"1.21.100"
|
|
18
|
-
]
|
|
19
|
-
}, null, 2))
|
|
1
|
+
exports.main = async function main(content) {
|
|
2
|
+
const name = await MblerApi.input("名称")
|
|
3
|
+
const desc = await MblerApi.input(`描述 `)
|
|
4
|
+
const main = await MblerApi.input(`主脚本 `)
|
|
5
|
+
content.setWorkDir
|
|
6
|
+
.writeFile("./mbler.config.json", JSON.stringify({
|
|
7
|
+
name,
|
|
8
|
+
description: desc,
|
|
9
|
+
script: {
|
|
10
|
+
main: "src/index.js",
|
|
11
|
+
dependencies: {}
|
|
12
|
+
},
|
|
13
|
+
type: "scriptsDes",
|
|
14
|
+
version: "0.0.1",
|
|
15
|
+
mcVersion: [
|
|
16
|
+
"1.21.00",
|
|
17
|
+
"1.21.100"
|
|
18
|
+
]
|
|
19
|
+
}, null, 2))
|
|
20
20
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "",
|
|
3
|
-
"description": "",
|
|
4
|
-
"version": ""
|
|
1
|
+
{
|
|
2
|
+
"name": "",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": ""
|
|
5
5
|
}
|
package/test/des/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "",
|
|
3
|
-
"description": "",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"module": "commjs",
|
|
6
|
-
"main": "./index.js"
|
|
1
|
+
{
|
|
2
|
+
"name": "",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"module": "commjs",
|
|
6
|
+
"main": "./index.js"
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
require("./test.js")
|
|
2
|
-
exports.main = function({
|
|
3
|
-
work
|
|
4
|
-
}) {
|
|
5
|
-
console.log(work)
|
|
1
|
+
require("./test.js")
|
|
2
|
+
exports.main = function({
|
|
3
|
+
work
|
|
4
|
+
}) {
|
|
5
|
+
console.log(work)
|
|
6
6
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "",
|
|
3
|
-
"description": "",
|
|
4
|
-
"version": ""
|
|
1
|
+
{
|
|
2
|
+
"name": "",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": ""
|
|
5
5
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "",
|
|
3
|
-
"description": "",
|
|
4
|
-
"version": "0.0.1",
|
|
5
|
-
"module": "commjs",
|
|
6
|
-
"main": "./index.js"
|
|
1
|
+
{
|
|
2
|
+
"name": "",
|
|
3
|
+
"description": "",
|
|
4
|
+
"version": "0.0.1",
|
|
5
|
+
"module": "commjs",
|
|
6
|
+
"main": "./index.js"
|
|
7
7
|
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"format_version": "1.20.100",
|
|
3
|
-
"minecraft:item": {
|
|
4
|
-
"description": {
|
|
5
|
-
"identifier": "mbler_int:mang_one_int"
|
|
6
|
-
},
|
|
7
|
-
"components": {
|
|
8
|
-
"minecraft:hand_equipped": false,
|
|
9
|
-
"minecraft:foil": true,
|
|
10
|
-
"minecraft:glint": true,
|
|
11
|
-
"allow_off_hand": {
|
|
12
|
-
"value": true
|
|
13
|
-
},
|
|
14
|
-
"minecraft:max_stack_size": 1,
|
|
15
|
-
"minecraft:stacked_by_data": true,
|
|
16
|
-
"minecraft:icon": "iconMangOneIntMbler",
|
|
17
|
-
"minecraft:display_name": {
|
|
18
|
-
"value": "无尽袋子 \n能存入无限的单种物品 右键打开"
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"format_version": "1.20.100",
|
|
3
|
+
"minecraft:item": {
|
|
4
|
+
"description": {
|
|
5
|
+
"identifier": "mbler_int:mang_one_int"
|
|
6
|
+
},
|
|
7
|
+
"components": {
|
|
8
|
+
"minecraft:hand_equipped": false,
|
|
9
|
+
"minecraft:foil": true,
|
|
10
|
+
"minecraft:glint": true,
|
|
11
|
+
"allow_off_hand": {
|
|
12
|
+
"value": true
|
|
13
|
+
},
|
|
14
|
+
"minecraft:max_stack_size": 1,
|
|
15
|
+
"minecraft:stacked_by_data": true,
|
|
16
|
+
"minecraft:icon": "iconMangOneIntMbler",
|
|
17
|
+
"minecraft:display_name": {
|
|
18
|
+
"value": "无尽袋子 \n能存入无限的单种物品 右键打开"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
22
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
GameLib
|
|
3
|
-
} from "gameLib"
|
|
4
|
-
import {
|
|
5
|
-
regEvent
|
|
6
|
-
} from "./lib/event/index"
|
|
7
|
-
const game = new GameLib(true);
|
|
1
|
+
import {
|
|
2
|
+
GameLib
|
|
3
|
+
} from "gameLib"
|
|
4
|
+
import {
|
|
5
|
+
regEvent
|
|
6
|
+
} from "./lib/event/index"
|
|
7
|
+
const game = new GameLib(true);
|
|
8
8
|
regEvent(game);
|