diff --git a/manifest.json b/manifest.json index 74e47e6..606d308 100644 --- a/manifest.json +++ b/manifest.json @@ -1,18 +1,18 @@ { "format_version": 2, "header": { - "name": "§t1.21.20 v1 §e§lFlash§fFakePlayerPack", - "description": "【开摆,等着天上来的天才重构整个项目吧】1.21.20 \n开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) 无关QQ群:122957051:", + "name": "§t1.21.30 v1 §e§lFlash§fFakePlayerPack", + "description": "【开摆,等着天上来的天才重构整个项目吧】1.21.30 \n开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) 无关QQ群:122957051:", "uuid": "aa101e99-abb4-448d-b58f-71e9da43064e", "version": [ 1, 21, - 201 + 301 ], "min_engine_version": [ 1, 21, - 20 + 30 ] }, "modules": [ @@ -20,7 +20,7 @@ "version": [ 1, 21, - 201 + 301 ], "type": "script", "uuid": "10101e99-abc1-5488-ba76-71e9da441300", @@ -31,7 +31,7 @@ "dependencies": [ { "module_name": "@minecraft/server", - "version": "1.14.0-beta" + "version": "1.15.0-beta" }, { "module_name": "@minecraft/server-gametest", @@ -39,7 +39,7 @@ }, { "module_name": "@minecraft/server-ui", - "version": "1.3.0-beta" + "version": "1.4.0-beta" } ] } \ No newline at end of file diff --git a/package.json b/package.json index 779d124..5e17a88 100644 --- a/package.json +++ b/package.json @@ -5,9 +5,9 @@ }, "dependencies": { "@minecraft/common": "^1.1.0", - "@minecraft/server": "^1.13.0-beta.1.21.10-preview.24", - "@minecraft/server-gametest": "^1.0.0-beta.1.21.1-stable", - "@minecraft/server-ui": "^1.3.0-beta.1.21.21-stable", + "@minecraft/server": "^1.15.0-beta.1.21.30-stable", + "@minecraft/server-gametest": "^1.0.0-beta.1.21.30-stable", + "@minecraft/server-ui": "^1.4.0-beta.1.21.30-stable", "@minecraft/vanilla-data": "^1.20.0", "archiver": "^6.0.1" } diff --git a/packer.js b/packer.js index 33493f6..bfbc65e 100644 --- a/packer.js +++ b/packer.js @@ -3,14 +3,14 @@ const archiver = require('archiver'); const pkNew = '开摆,等着天上来的天才重构整个项目吧' -const mcVersion = [1,21,20]; +const mcVersion = [1,21,30]; const pkVersion = 1 - - - +// https://www.npmjs.com/package/@minecraft/server?activeTab=versions +// https://www.npmjs.com/package/@minecraft/server-gametest?activeTab=versions +// https://www.npmjs.com/package/@minecraft/server-ui?activeTab=versions mcVersion.toString = ()=>mcVersion.join('.') @@ -40,7 +40,7 @@ const manifest_json = { "dependencies": [ { "module_name": "@minecraft/server", - "version": "1.14.0-beta" + "version": "1.15.0-beta" }, { "module_name": "@minecraft/server-gametest", @@ -48,7 +48,7 @@ const manifest_json = { }, { "module_name": "@minecraft/server-ui", - "version": "1.3.0-beta" + "version": "1.4.0-beta" } ] } diff --git a/scripts/lib/xboyPackage/scoreBase/verifyDataBase.js b/scripts/lib/xboyPackage/scoreBase/verifyDataBase.js index 3e8a2fc..10b437f 100644 --- a/scripts/lib/xboyPackage/scoreBase/verifyDataBase.js +++ b/scripts/lib/xboyPackage/scoreBase/verifyDataBase.js @@ -4,11 +4,7 @@ let ScoreBaseSnapshot = ScoreBase.GetObject(); const checkScoreObjectExist = (ScoreObjectName) => !!Array.from(ScoreBaseSnapshot).find(ScoreObject => ScoreObjectName === ScoreObject.id); const verify = function () { ScoreBaseSnapshot = ScoreBase.GetObject(); - ['##FlashPlayer##'].forEach(_ => checkScoreObjectExist(_) - ? console.warn('[模拟玩家] 计分板对象数据存在==>', _) - : console.warn('[模拟玩家] 计分板对象数据不存在但已创建==>', ScoreBase.NewObjectAsync(_).displayName)); - world.scoreboard.getObjective('##FlashPlayer##').hasParticipant('##currentPID') - ? console.warn('[模拟玩家] 计分板键值数据存在==>', '##currentPID') - : (ScoreBase.SetPoints('##FlashPlayer##', '##currentPID', 1), console.warn('[模拟玩家] 数据不存在但已创建==>', '##FlashPlayer## * currentUID')); + ['##FlashPlayer##'].forEach(_ => checkScoreObjectExist(_) || ScoreBase.NewObjectAsync(_).displayName); + world.scoreboard.getObjective('##FlashPlayer##').hasParticipant('##currentPID') || ScoreBase.SetPoints('##FlashPlayer##', '##currentPID', 1); }; export default verify; diff --git a/scripts/xTerrain/main.js b/scripts/xTerrain/main.js index 61db849..1bce855 100644 --- a/scripts/xTerrain/main.js +++ b/scripts/xTerrain/main.js @@ -58,19 +58,25 @@ let initCounter = 100; async function init() { if (--initCounter % 20 !== 0) return; + if (initCounter < -200) { + world.sendMessage('[模拟玩家] 初始化失败 10 次,停止尝试'); + console.error('[模拟玩家] 初始化失败 10 次,停止尝试'); + playerMove.unsubscribe(init); + } if (initCounter < 0) { world.sendMessage('[模拟玩家] 初始化失败' + initCounter / 20 + '次,尝试在控制台输入/reload'); console.error('[模拟玩家] 初始化失败' + initCounter / 20 + '次,尝试在控制台输入/reload'); } verify(); verify(); - world.structureManager.get('xboyMinemcSIM:void') ?? world.structureManager.createEmpty('xboyMinemcSIM:void', { x: 1, y: 1, z: 1 }).saveToWorld(); - randomTickSpeed = world.gameRules.randomTickSpeed; - doDayLightCycle = world.gameRules.doDayLightCycle; - doMobSpawning = world.gameRules.doMobSpawning; - const z = Math.floor(Math.random() * 114514); + if (!world.structureManager.get('xboyMinemcSIM:void')) + world.structureManager.createEmpty('xboyMinemcSIM:void', { x: 1, y: 1, z: 1 }).saveToWorld(); + randomTickSpeed = world.gameRules.randomTickSpeed + 1 - 1; + doDayLightCycle = !!world.gameRules.doDayLightCycle; + doMobSpawning = !!world.gameRules.doMobSpawning; + const z = 11451400 + Math.floor(Math.random() * 114514); system.run(() => { - overworld.runCommandAsync('execute positioned 30000000 128 ' + z + ' run gametest run 我是云梦:假人').catch(() => 0); + overworld.runCommandAsync('execute positioned 15000000 256 ' + z + ' run gametest run 我是云梦:假人').catch(() => 0); }); } playerMove.subscribe(init); diff --git a/scripts/xTerrain/plugins/youAreMine.js b/scripts/xTerrain/plugins/youAreMine.js index fbcdd36..3559496 100644 --- a/scripts/xTerrain/plugins/youAreMine.js +++ b/scripts/xTerrain/plugins/youAreMine.js @@ -51,7 +51,7 @@ commandRegistry.registerCommand('假人装备交换', ({ entity, isEntity, sim } const s = SimPlayer.getComponent("minecraft:equippable"); const p = entity.getComponent("minecraft:equippable"); for (const i in EquipmentSlot) { - if (i === EquipmentSlot['Mainhand'] ?? EquipmentSlot['mainhand']) + if (i === EquipmentSlot['Mainhand']) continue; const _ = s.getEquipment(i); const __ = p.getEquipment(i); @@ -70,7 +70,7 @@ const returnResWithoutArgs = ({ entity, isEntity, sim }) => { const equip = SimPlayer.getComponent("minecraft:equippable"); const { location: l, dimension: d } = entity; for (const i in EquipmentSlot) { - if (i === EquipmentSlot['Mainhand'] ?? EquipmentSlot['mainhand']) + if (i === EquipmentSlot['Mainhand']) continue; const item = equip.getEquipment(i); if (!item) diff --git a/tscripts/lib/xboyPackage/scoreBase/rw.ts b/tscripts/lib/xboyPackage/scoreBase/rw.ts index 8b7a45f..1c71f0d 100644 --- a/tscripts/lib/xboyPackage/scoreBase/rw.ts +++ b/tscripts/lib/xboyPackage/scoreBase/rw.ts @@ -55,6 +55,7 @@ const DelScoreObject = (objectiveId: ScoreboardObjective | string)=> world.sc const NewScoreObject = (objectiveId: string, displayName: string=objectiveId)=> GetScoreBoard.addObjective(objectiveId, displayName); //scoreboard objectives setDisplay list ScoreName ascending +//@ts-ignore const DisScoreObject = (displaySlotId:DisplaySlotId, objective: ScoreboardObjective=undefined, sortOrder: ObjectiveSortOrder=('ascending'&&0))=> objective ? world.scoreboard.setObjectiveAtDisplaySlot(displaySlotId, {objective,sortOrder}) : world.scoreboard.clearObjectiveAtDisplaySlot(displaySlotId); // scoreBase diff --git a/tscripts/lib/xboyPackage/scoreBase/verifyDataBase.ts b/tscripts/lib/xboyPackage/scoreBase/verifyDataBase.ts index fc9a44d..f3a81c1 100644 --- a/tscripts/lib/xboyPackage/scoreBase/verifyDataBase.ts +++ b/tscripts/lib/xboyPackage/scoreBase/verifyDataBase.ts @@ -8,14 +8,11 @@ const checkScoreObjectExist = (ScoreObjectName : string) : boolean => !!Array.f const verify = function(){ ScoreBaseSnapshot = ScoreBase.GetObject(); ['##FlashPlayer##'].forEach(_=> - checkScoreObjectExist(_) - ? console.warn('[模拟玩家] 计分板对象数据存在==>',_) - : console.warn('[模拟玩家] 计分板对象数据不存在但已创建==>',ScoreBase.NewObjectAsync(_).displayName) + checkScoreObjectExist(_) || ScoreBase.NewObjectAsync(_).displayName ) - ; world.scoreboard.getObjective('##FlashPlayer##').hasParticipant('##currentPID') - ? console.warn( '[模拟玩家] 计分板键值数据存在==>','##currentPID') - : (ScoreBase.SetPoints('##FlashPlayer##','##currentPID',1),console.warn('[模拟玩家] 数据不存在但已创建==>','##FlashPlayer## * currentUID')) + world.scoreboard.getObjective('##FlashPlayer##').hasParticipant('##currentPID') || ScoreBase.SetPoints('##FlashPlayer##','##currentPID',1) + } diff --git a/tscripts/xTerrain/main.ts b/tscripts/xTerrain/main.ts index 7920150..2a87706 100644 --- a/tscripts/xTerrain/main.ts +++ b/tscripts/xTerrain/main.ts @@ -105,6 +105,15 @@ let initCounter = 100 async function init() { if(--initCounter%20 !== 0)return; + if(initCounter<-200){ + + world.sendMessage('[模拟玩家] 初始化失败 10 次,停止尝试') + console.error('[模拟玩家] 初始化失败 10 次,停止尝试') + + playerMove.unsubscribe(init) + } + + if(initCounter<0){ world.sendMessage('[模拟玩家] 初始化失败'+ initCounter/20 +'次,尝试在控制台输入/reload') console.error('[模拟玩家] 初始化失败'+ initCounter/20 +'次,尝试在控制台输入/reload') @@ -112,15 +121,17 @@ async function init() { // 记分板PID初始化 写的烂 执行两次 verify() verify() - world.structureManager.get('xboyMinemcSIM:void') ?? world.structureManager.createEmpty('xboyMinemcSIM:void', { x:1, y:1, z:1 }).saveToWorld(); - randomTickSpeed = world.gameRules.randomTickSpeed - doDayLightCycle = world.gameRules.doDayLightCycle - doMobSpawning = world.gameRules.doMobSpawning + if(!world.structureManager.get('xboyMinemcSIM:void')) + world.structureManager.createEmpty('xboyMinemcSIM:void', { x:1, y:1, z:1 }).saveToWorld(); + + randomTickSpeed = world.gameRules.randomTickSpeed +1 -1 + doDayLightCycle = !!world.gameRules.doDayLightCycle + doMobSpawning = !!world.gameRules.doMobSpawning - const z = Math.floor(Math.random() * 114514 ) + const z = 11451400 + Math.floor(Math.random() * 114514 ) system.run(()=>{ - overworld.runCommandAsync('execute positioned 30000000 128 '+z+' run gametest run 我是云梦:假人').catch(()=>0) + overworld.runCommandAsync('execute positioned 15000000 256 '+z+' run gametest run 我是云梦:假人').catch(()=>0) }) // TODO 唤醒 从ceyk[init] 重新生成模拟玩家并配置背包与经验值 diff --git a/tscripts/xTerrain/plugins/youAreMine.ts b/tscripts/xTerrain/plugins/youAreMine.ts index 687a15a..d0dd6f2 100644 --- a/tscripts/xTerrain/plugins/youAreMine.ts +++ b/tscripts/xTerrain/plugins/youAreMine.ts @@ -97,7 +97,7 @@ commandRegistry.registerCommand('假人装备交换', ({entity,isEntity,sim}) => const p = entity.getComponent("minecraft:equippable") // player for (const i in EquipmentSlot) { //跳过主手 - if (i === EquipmentSlot['Mainhand'] ?? EquipmentSlot['mainhand']) continue + if (i === EquipmentSlot['Mainhand']) continue // console.error(i) const _ = s.getEquipment(i) const __ = p.getEquipment(i) @@ -122,7 +122,7 @@ const returnResWithoutArgs = ({entity,isEntity,sim}:commandInfo)=>{ for (const i in EquipmentSlot) { //跳过主手 - if (i === EquipmentSlot['Mainhand'] ?? EquipmentSlot['mainhand']) continue + if (i === EquipmentSlot['Mainhand']) continue // 获取 const item = equip.getEquipment(i) if(!item)continue