Skip to content

Commit

Permalink
Merge pull request #47 from xBoyMinemc/1.21.30
Browse files Browse the repository at this point in the history
1.21.30
  • Loading branch information
xBoyMinemc authored Sep 24, 2024
2 parents d7dbff1 + ab038d2 commit da66a06
Show file tree
Hide file tree
Showing 10 changed files with 55 additions and 44 deletions.
14 changes: 7 additions & 7 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
{
"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": [
{
"version": [
1,
21,
201
301
],
"type": "script",
"uuid": "10101e99-abc1-5488-ba76-71e9da441300",
Expand All @@ -31,15 +31,15 @@
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.14.0-beta"
"version": "1.15.0-beta"
},
{
"module_name": "@minecraft/server-gametest",
"version": "1.0.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.3.0-beta"
"version": "1.4.0-beta"
}
]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down
12 changes: 6 additions & 6 deletions packer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('.')
Expand Down Expand Up @@ -40,15 +40,15 @@ const manifest_json = {
"dependencies": [
{
"module_name": "@minecraft/server",
"version": "1.14.0-beta"
"version": "1.15.0-beta"
},
{
"module_name": "@minecraft/server-gametest",
"version": "1.0.0-beta"
},
{
"module_name": "@minecraft/server-ui",
"version": "1.3.0-beta"
"version": "1.4.0-beta"
}
]
}
Expand Down
8 changes: 2 additions & 6 deletions scripts/lib/xboyPackage/scoreBase/verifyDataBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
18 changes: 12 additions & 6 deletions scripts/xTerrain/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 2 additions & 2 deletions scripts/xTerrain/plugins/youAreMine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions tscripts/lib/xboyPackage/scoreBase/rw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
9 changes: 3 additions & 6 deletions tscripts/lib/xboyPackage/scoreBase/verifyDataBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,11 @@ const checkScoreObjectExist = (ScoreObjectName : string) : boolean => !!Array.f
const verify = function(){
ScoreBaseSnapshot = <ScoreboardObjective[]>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)


}

Expand Down
23 changes: 17 additions & 6 deletions tscripts/xTerrain/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,22 +105,33 @@ 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')
}
// 记分板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] 重新生成模拟玩家并配置背包与经验值
Expand Down
4 changes: 2 additions & 2 deletions tscripts/xTerrain/plugins/youAreMine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(<EquipmentSlot>i)
const __ = p.getEquipment(<EquipmentSlot>i)
Expand All @@ -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(<EquipmentSlot>i)
if(!item)continue
Expand Down

0 comments on commit da66a06

Please sign in to comment.