Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ workspace.xml
.vscode
/build/
/scripts_yeah/
/scripts/
/scripts/
package-lock.json
8 changes: 4 additions & 4 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"format_version": 2,
"header": {
"name": "§t1.21.71 v20 §e§lFlash§fFakePlayerPack",
"description": "【指令与GUI增强-构建于1.21.80-支持1.21.7x-1.21.8x】1.21.71 \n开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) 无关QQ群:122957051:",
"name": "§t1.21.71 v30 §e§lFlash§fFakePlayerPack",
"description": "【保存背包状态-构建于1.21.100-支持1.21.7x-1.21.10x】1.21.71 \n开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) \n感谢PuppyOne和kzyqq00-Player做出的长达数月的代码更新",
"uuid": "aa101e99-abb4-448d-b58f-71e9da43064e",
"version": [
1,
21,
730
740
],
"min_engine_version": [
1,
Expand All @@ -20,7 +20,7 @@
"version": [
1,
21,
730
740
],
"type": "script",
"uuid": "10101e99-abc1-5488-ba76-71e9da441300",
Expand Down
43 changes: 28 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
"build": "cd . && tsc && webpack && node packer.js"
},
"devDependencies": {
"@minecraft/server": "2.0.0-beta.1.21.80-stable",
"@minecraft/server-gametest": "1.0.0-beta.1.21.40-preview.25",
"@minecraft/server-ui": "2.0.0-beta.1.21.80-stable",
"@minecraft/server": "2.2.0-beta.1.21.101-stable",
"@minecraft/server-gametest": "1.0.0-beta.1.21.101-stable",
"@minecraft/server-ui": "2.1.0-beta.1.21.101-stable",
"archiver": "latest",
"clean-webpack-plugin": "^4.0.0",
"typescript": "^5.6.3",
"webpack": "^5.95.0",
"webpack-cli": "^5.1.4",
"archiver": "latest"
"webpack-cli": "^5.1.4"
}
}
8 changes: 5 additions & 3 deletions packer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@ const fs = require('fs');
const archiver = require('archiver');


const pack_name = '指令与GUI增强-构建于1.21.80-支持1.21.7x-1.21.8x'
const pack_name = '保存背包状态-构建于1.21.100-支持1.21.7x-1.21.10x'
const pack_version = [1,21,71];
const fix_pack_version = 20
const fix_pack_version = 30
const min_engine_version = [1,21,70]

const printFilePathOnly = process.argv.includes('--print-filepath-only')

// 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
// 选择以 beta+当前游戏版本号结尾的,最新的包版本


pack_version.toString = ()=>pack_version.join('.')
Expand All @@ -23,7 +24,7 @@ const manifest_json = {
"format_version": 2,
"header": {
"name": `§t${pack_version} v${fix_pack_version} §e§lFlash§fFakePlayerPack`,
"description": `【${pack_name}】${pack_version} \u000a开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) 无关QQ群:122957051:`,
"description": `【${pack_name}】${pack_version} \u000a开启实验性游戏内容(测试版 API)-游戏内输入“假人帮助”或“假人创建” 对着假人右键(蹲或不蹲是两个不同的菜单) \u000a感谢PuppyOne和kzyqq00-Player做出的长达数月的代码更新`,
"uuid": "aa101e99-abb4-448d-b58f-71e9da43064e",
"version": full_pack_version,
"min_engine_version": min_engine_version
Expand Down Expand Up @@ -100,6 +101,7 @@ archive.pipe(output1);

// 如果存在e:/temp路径就往那里放一份
// ↑迷惑行为
// ↑因为e盘是我的关机自毁的内存盘,存放活跃的临时文件。在这里放一份便于我关机前随时找到构建的包,嘻嘻。

// const tempPath = 'e:/temp'
// if(fs.existsSync(tempPath)){
Expand Down
6 changes: 0 additions & 6 deletions tscripts/lib/xboyEvents/EventSignal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,3 @@ export default class EventSignal<T> {
this.listeners.forEach((listener) => listener(event))
}
}

// 事件:新歌上市

// 订阅 xx事件- 行为 (去买)

// 触发
4 changes: 2 additions & 2 deletions tscripts/lib/xboyEvents/fishingHookSpawned.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ world.afterEvents.entitySpawn.subscribe(({entity: entity}) => {
// entity.runCommandAsync("tell @a[tag=xboy] ==========================================")
// ) &&

around(entity.location.x - playerFishing.location.x - playerFishing.getVelocity().x, 6)// @ts-ignore
&& around(entity.location.y - playerFishing.location.y - playerFishing.getVelocity().y, ("免你一死", 7))
around(entity.location.x - playerFishing.location.x - playerFishing.getVelocity().x, 6)
&& around(entity.location.y - playerFishing.location.y - playerFishing.getVelocity().y, 7)
&& around(entity.location.z - playerFishing.location.z - playerFishing.getVelocity().z, 6),
)
)
Expand Down
63 changes: 19 additions & 44 deletions tscripts/lib/xboyPackage/Util.ts
Original file line number Diff line number Diff line change
@@ -1,61 +1,36 @@
import type {Block, Dimension, Entity, EntityQueryOptions, Player, Vector3} from '@minecraft/server'
import {SimulatedPlayer} from '@minecraft/server-gametest'
import type { Block, Dimension, Entity, EntityQueryOptions, Player, Vector3 } from '@minecraft/server'
import { SimulatedPlayer } from '@minecraft/server-gametest'
import SIGN from './YumeSignEnum'
import { simulatedPlayers } from '../../xTerrain/main'


// getEntitiesFromViewDirection
export const getSimPlayer = {
// only one
fromView: (e:Entity,maxDistance=16):SimulatedPlayer=>(<SimulatedPlayer><unknown>e.getEntitiesFromViewDirection({maxDistance}).find(({entity}) => entity.hasTag(SIGN.YUME_SIM_SIGN))?.entity),

fromView: (e: Entity, maxDistance = 16): SimulatedPlayer => (<SimulatedPlayer><unknown>e.getEntitiesFromViewDirection({ maxDistance }).find(({ entity }) => entity.hasTag(SIGN.YUME_SIM_SIGN))?.entity),
getAllSimulatedPlayers: () => Object.values(simulatedPlayers).filter(v => typeof v === "number").map(v => <SimulatedPlayer>simulatedPlayers[v]) as SimulatedPlayer[],
getAllSimulatedPlayerPID: () => Object.values(simulatedPlayers).filter(v => typeof v === "number") as number[],
}


// function getEntitiesNear(who:Entity|Block,maxDistance:number,defEntityQueryOptions:EntityQueryOptions){
// const EQO : EntityQueryOptions = {}//new EntityQueryOptions()
// EQO.maxDistance = maxDistance
// EQO.location = who.location
// EQO.excludeTypes= ["minecraft:player","minecraft:arrow","minecraft:xp_orb","minecraft:item"]
// EQO.closest = 1
// Object.assign(EQO,defEntityQueryOptions)
// const entities = who.dimension.getEntities(EQO)
// const targets = []
// for(const entity of entities)targets.push(entity)
// return targets
// }
// function getPlayerNear(who:Entity|Block,maxDistance:number,defEntityQueryOptions:EntityQueryOptions){
// const EQO: EntityQueryOptions = {}//new EntityQueryOptions();
// EQO.maxDistance = maxDistance; ;;"距离";;
// EQO.location = who.location; //new Location(逻辑主体.location.x,逻辑主体.location.y,逻辑主体.location.z); ;;"中心坐标-ri泥god";;
// // EQO.excludeTypes= ["minecraft:arrow","minecraft:xp_orb","minecraft:item"]; ;;"排除掉的实体类型";;
// EQO.closest = 1;
// EQO.excludeTags = [SIGN.YUME_SIM_SIGN]
// Object.assign(EQO,defEntityQueryOptions)
// const entities = who.dimension.getEntities(EQO)
// const targets = []
// for(const entity of entities)targets.push(entity)
// return targets
// }

export function getEntitiesNear(location:Vector3, dimension:Dimension, maxDistance:number, Options={}){
const EntityQueryOption:EntityQueryOptions = {}//new EntityQueryOptions()
export function getEntitiesNear(location: Vector3, dimension: Dimension, maxDistance: number, Options = {}) {
const EntityQueryOption: EntityQueryOptions = {}
EntityQueryOption.maxDistance = maxDistance
EntityQueryOption.location = location
EntityQueryOption.excludeTypes= ["minecraft:player","minecraft:arrow","minecraft:xp_orb","minecraft:item"]
EntityQueryOption.closest = 1
Object.assign(EntityQueryOption,Options)
EntityQueryOption.location = location
EntityQueryOption.excludeTypes = ["minecraft:player", "minecraft:arrow", "minecraft:xp_orb", "minecraft:item"]
EntityQueryOption.closest = 1
Object.assign(EntityQueryOption, Options)
return dimension.getEntities(EntityQueryOption)
}
export function getPlayerNear(who:Entity|Block, maxDistance:number, defEntityQueryOptions:EntityQueryOptions):Player[] {
const EQO: EntityQueryOptions = {}//new EntityQueryOptions()
export function getPlayerNear(who: Entity | Block, maxDistance: number, defEntityQueryOptions: EntityQueryOptions): Player[] {
const EQO: EntityQueryOptions = {}
EQO.maxDistance = maxDistance
EQO.location = who.location
EQO.location = who.location
// EQO.excludeTypes= ["minecraft:arrow","minecraft:xp_orb","minecraft:item"]
EQO.closest = 1
EQO.closest = 1
EQO.excludeTags = [SIGN.YUME_SIM_SIGN]
Object.assign(EQO,defEntityQueryOptions)
Object.assign(EQO, defEntityQueryOptions)
const entities = who.dimension.getPlayers(EQO)
const targets:Player[] = []
for(const entity of entities)targets.push(entity)
const targets: Player[] = []
for (const entity of entities) targets.push(entity)
return targets
}
18 changes: 13 additions & 5 deletions tscripts/xTerrain/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import { world } from '@minecraft/server'
// import './plugins/noFlashDoor' // pig



import './plugins/Backpack2Barrel'
import './plugins/test'
import './plugins/help'

import './plugins/chatSpawn'
Expand All @@ -40,6 +41,9 @@ const tickWaitTimes = 20*60*60*24*365
// all of SimulatedPlayer List
export const simulatedPlayers = {}

// simulatedPlayers[PID] = simulatedPlayer;
// simulatedPlayers[simulatedPlayer.id] = PID;

export let initSucceed = false


Expand All @@ -60,12 +64,14 @@ let doMobSpawning = true
let spawnSimulatedPlayer : (location:Vector3, dimension:Dimension, pid: number )=>SimulatedPlayer
let spawnSimulatedPlayerByNameTag : (location:Vector3, dimension:Dimension, nameTag: string )=>SimulatedPlayer
let testWorldLocation : Vector3
let testWorldDimension : Dimension


if(!world.structureManager.get('xboyMinemcSIM:void'))
world.structureManager.createEmpty('xboyMinemcSIM:void', { x:1, y:1, z:1 }).saveToWorld()

const GetPID = ()=> world.scoreboard.getObjective('##FlashPlayer##').addScore('##currentPID',1)
let currentPID = 0
const GetPID = ()=> ++currentPID


export const initialized : initializedEventSignal = new EventSignal<initializedEvent>()
Expand All @@ -86,7 +92,7 @@ register('我是云梦', '假人', (test:Test) => {
spawnSimulatedPlayerByNameTag = (location:Vector3, dimension:Dimension, nameTag: string ):SimulatedPlayer=>{

const simulatedPlayer = test.spawnSimulatedPlayer({ x:0, y:8, z:0 }, nameTag)
simulatedPlayer.addTag('init')
simulatedPlayer.addTag('Backpack2Barrel_init')
simulatedPlayer.addTag(SIGN.YUME_SIM_SIGN)
simulatedPlayer.addTag(SIGN.AUTO_RESPAWN_SIGN)
try {
Expand Down Expand Up @@ -121,10 +127,12 @@ register('我是云梦', '假人', (test:Test) => {
verify()
verify()

const z = 11451400 + Math.floor(Math.random() * 114514 * 19 )
let z = 11451400 + Math.floor(Math.random() * 114514 * 19 )
z -= z%16
system.run(()=>{
try {
overworld.runCommand('execute positioned 15000000 256 ' + z + ' run gametest run 我是云梦:假人');
testWorldDimension = overworld
} catch (e) {
world.sendMessage('[模拟玩家] 报错了,我也不知道为什么' + e);
}
Expand Down Expand Up @@ -175,5 +183,5 @@ world.beforeEvents.chatSend.subscribe(({message, sender}) => {
});
});

export { spawnSimulatedPlayer,spawnSimulatedPlayerByNameTag,testWorldLocation,GetPID }
export { spawnSimulatedPlayer,spawnSimulatedPlayerByNameTag,testWorldLocation,testWorldDimension,GetPID }

Loading