diff --git a/manifest.json b/manifest.json index b674462..81504f4 100644 --- a/manifest.json +++ b/manifest.json @@ -1,13 +1,13 @@ { "format_version": 2, "header": { - "name": "§t1.21.30 v16 §e§lFlash§fFakePlayerPack", + "name": "§t1.21.30 v17 §e§lFlash§fFakePlayerPack", "description": "【指定生成坐标-构建于1.21.30-支持1.21.2x-1.21.5x】1.21.30 \n开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) 无关QQ群:122957051:", "uuid": "aa101e99-abb4-448d-b58f-71e9da43064e", "version": [ 1, 21, - 316 + 317 ], "min_engine_version": [ 1, @@ -20,7 +20,7 @@ "version": [ 1, 21, - 316 + 317 ], "type": "script", "uuid": "10101e99-abc1-5488-ba76-71e9da441300", diff --git a/packer.js b/packer.js index 73a0aa2..cebef30 100644 --- a/packer.js +++ b/packer.js @@ -4,7 +4,7 @@ const archiver = require('archiver'); const pack_name = '指定生成坐标-构建于1.21.30-支持1.21.2x-1.21.5x' const pack_version = [1,21,30]; -const fix_pack_version = 16 +const fix_pack_version = 17 const min_engine_version = [1,21,20] // https://www.npmjs.com/package/@minecraft/server?activeTab=versions diff --git a/tscripts/lib/xboyPackage/xyz_dododo.ts b/tscripts/lib/xboyPackage/xyz_dododo.ts index 5228753..c2e2791 100644 --- a/tscripts/lib/xboyPackage/xyz_dododo.ts +++ b/tscripts/lib/xboyPackage/xyz_dododo.ts @@ -8,14 +8,15 @@ ops['+'] = '+' ops['-'] = '-' export function xyz_dododo(xyz:string[],playerLocation=[0,0,0]) : number[] { - // 初始化x, y, z - let new_xyz = [0,0,0] - // 遍历分割后的数组 - xyz.forEach((part, index) => { + return xyz.map((part, index) => { // 否则直接解析为数字 - if (!part.startsWith('~')) - return new_xyz[index] = Number(part); + if (!part.startsWith('~')) { + const data = Number(part); + if (Number.isFinite(data)) + return data; + throw new Error(['x', 'y', 'z'][index] + ' not a number'); + } let data: number|string = part.slice(1) // 去掉~ let op = ops[data[0]] // 存在风险 @@ -27,7 +28,7 @@ export function xyz_dododo(xyz:string[],playerLocation=[0,0,0]) : number[] { } data = Number(data) - if(isNaN(data)) + if(!Number.isFinite(data)) throw new Error(['x','y','z'][index] + ' not a number') @@ -36,10 +37,8 @@ export function xyz_dododo(xyz:string[],playerLocation=[0,0,0]) : number[] { if(op === '-') data -= playerLocation[index] - new_xyz[index] = data + return data }); - - return new_xyz; } function xyz_dododo_test() {