diff --git a/CHANGELOG.md b/CHANGELOG.md index bc59e36..8cd7d90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1 @@ -## 增加独立的更新日志文件 -## 开始实施自动构建与发布为未来做准备 +## 修复了指定名称召唤时不正确显示名称的问题 \ No newline at end of file diff --git a/tscripts/xTerrain/main.ts b/tscripts/xTerrain/main.ts index a24a9dc..f16a691 100644 --- a/tscripts/xTerrain/main.ts +++ b/tscripts/xTerrain/main.ts @@ -56,6 +56,7 @@ let doMobSpawning = true // ? let spawnSimulatedPlayer : (location:Vector3, dimension:Dimension, pid: number )=>SimulatedPlayer +let spawnSimulatedPlayerByNameTag : (location:Vector3, dimension:Dimension, nameTag: string )=>SimulatedPlayer let testWorldLocation : Vector3 @@ -78,8 +79,11 @@ register('我是云梦', '假人', (test:Test) => { world.gameRules.doMobSpawning = doMobSpawning spawnSimulatedPlayer = (location:Vector3, dimension:Dimension, pid: number ):SimulatedPlayer=>{ + return spawnSimulatedPlayerByNameTag(location, dimension, `工具人-${pid}`) + } + spawnSimulatedPlayerByNameTag = (location:Vector3, dimension:Dimension, nameTag: string ):SimulatedPlayer=>{ - const SimulatedPlayer = test.spawnSimulatedPlayer({ x:0, y:8, z:0 }, `工具人-${pid}`) + const SimulatedPlayer = test.spawnSimulatedPlayer({ x:0, y:8, z:0 }, nameTag) SimulatedPlayer.addTag('init') SimulatedPlayer.addTag(SIGN.YUME_SIM_SIGN) SimulatedPlayer.addTag(SIGN.AUTO_RESPAWN_SIGN) @@ -146,5 +150,5 @@ playerMove.subscribe(()=>{ // // ) -export { spawnSimulatedPlayer,testWorldLocation,GetPID } +export { spawnSimulatedPlayer,spawnSimulatedPlayerByNameTag,testWorldLocation,GetPID } diff --git a/tscripts/xTerrain/plugins/chatSpawn.ts b/tscripts/xTerrain/plugins/chatSpawn.ts index af12fd0..0412904 100644 --- a/tscripts/xTerrain/plugins/chatSpawn.ts +++ b/tscripts/xTerrain/plugins/chatSpawn.ts @@ -1,6 +1,13 @@ import type { SimulatedPlayer } from '@minecraft/server-gametest' -import { spawnSimulatedPlayer, SimulatedPlayerEnum, spawned as spawnedEvent, GetPID, initSucceed } from '../main' +import { + spawnSimulatedPlayer, + spawnSimulatedPlayerByNameTag, + SimulatedPlayerEnum, + spawned as spawnedEvent, + GetPID, + initSucceed +} from '../main' import { commandInfo, CommandRegistry } from '../../lib/yumeCommand/CommandRegistry' import { Dimension, Vector3, world } from '@minecraft/server' const overworld = world.getDimension("overworld"); @@ -134,7 +141,7 @@ const withArgs_xyz_name = ({args,entity}:commandInfo)=>{ const PID = GetPID() const __FlashPlayer__ = world.scoreboard.getObjective('##FlashPlayer##') - const SimulatedPlayer :SimulatedPlayer = spawnSimulatedPlayer(location,dimension ?? entity?.dimension ?? overworld,PID) + const SimulatedPlayer :SimulatedPlayer = spawnSimulatedPlayerByNameTag(location,dimension ?? entity?.dimension ?? overworld,nameTag) SimulatedPlayerEnum[PID]=SimulatedPlayer SimulatedPlayerEnum[SimulatedPlayer.id]=PID