Closed
Description
Describe the bug
使用mc.spawnSimulatedPlayer
召唤假人的时候,如果目标pos是主世界,正常;而目标pos是下界、末地时,会在主世界生成而不是在目标维度
When using
mc.spawnSimulatedPlayer
to create a simulated player outside the overworld(End,Nether), it will be spawned in the
OverWorld rather than in the target dimension
To Reproduce
mc.spawnSimulatedPlayer("fk",new FloatPos(68.67,59.50,6.66,2))
//on End
或者,当召唤者处于下界或者末地时
or
mc.spawnSimulatedPlayer("fk",mc.getPlayer("MY_GAME_NAME").pos)
Expected behavior
在目标维度召唤假人
Create a simulated player on the target dimension
Screenshots
Platform
Windows 11
BDS Version
1.20.81.01
LeviLamina Version
0.12.2+916edf645
LegacyScriptEngine Version
legacy-script-engine-quickjs v0.7.6
Additional context
mc.listen("onServerStarted", () => {
const cmd = mc.newCommand(
"manager",
"Command Description",
PermType.GameMasters
);
cmd.setAlias("mgr");
cmd.setEnum("ChangeAction", ["add", "remove"]);
cmd.setEnum("ListAction", ["list"]);
cmd.mandatory("action", ParamType.Enum, "ChangeAction", 1);
cmd.mandatory("action", ParamType.Enum, "ListAction", 1);
cmd.mandatory("name", ParamType.RawText);
cmd.overload(["ChangeAction", "name"]);
cmd.overload(["ListAction"]);
cmd.setCallback((_cmd, _ori, out, res) => {
switch (res.action) {
case "add":
//1.检查是否存在假人
let fakeplayer=mc.getPlayer(res.name);
//2.生成假人
if(fakeplayer==null){
fakeplayer = mc.spawnSimulatedPlayer(
res.name,
new FloatPos(_ori.pos.x, _ori.pos.y, _ori.pos.z, _ori.pos.dimid)
);
}else if(fakeplayer?.isSimulatedPlayer()){
return out.success(`假人 "${res.name}" 已经存在,跳过...`);
}
if (fakeplayer){
return out.success(`添加假人 "${res.name}" 成功`);
}
case "remove":
return out.success(
`假人信息:${JSON.stringify(listPalyerInfo(res.name))}`
);
case "list":
return out.success(`remove "${res.name}"`);
}
});
cmd.setup();
});
function listPalyerInfo(name){
const pl=mc.getPlayer(name)
if(pl){
return {
名称: `${pl.name}`,
坐标:`${pl.pos}`,
};
}
}