|
1 | 1 | #include "api/APIHelp.h" |
2 | 2 | #include "api/BaseAPI.h" |
3 | 3 | #include "api/BlockAPI.h" |
4 | | -#include "api/ContainerAPI.h" |
5 | 4 | #include "api/DeviceAPI.h" |
6 | 5 | #include "api/EntityAPI.h" |
7 | 6 | #include "api/ItemAPI.h" |
8 | 7 | #include "api/McAPI.h" |
9 | | -#include "api/NbtAPI.h" |
10 | 8 | #include "api/PlayerAPI.h" |
11 | 9 | #include "engine/EngineOwnData.h" |
12 | 10 | #include "engine/GlobalShareData.h" |
13 | | -#include "main/SafeGuardRecord.h" |
| 11 | +#include "ll/api/service/Bedrock.h" |
14 | 12 | #include "mc/server/SimulatedPlayer.h" |
15 | 13 |
|
16 | | -#include <algorithm> |
| 14 | +#include <ll/api/utils/RandomUtils.h> |
17 | 15 | #include <mc/external/scripting/gametest/ScriptNavigationResult.h> |
18 | 16 | #include <mc/nbt/CompoundTag.h> |
| 17 | +#include <mc/network/ServerNetworkHandler.h> |
19 | 18 | #include <mc/server/sim/LookDuration.h> |
20 | 19 | #include <mc/world/Container.h> |
| 20 | +#include <mc/world/Minecraft.h> |
21 | 21 | #include <mc/world/SimpleContainer.h> |
22 | 22 | #include <mc/world/actor/Actor.h> |
23 | 23 | #include <mc/world/actor/player/Player.h> |
24 | 24 | #include <mc/world/level/BlockSource.h> |
25 | 25 | #include <mc/world/level/block/Block.h> |
26 | 26 | #include <mc/world/scores/Objective.h> |
27 | 27 | #include <string> |
28 | | -#include <unordered_map> |
29 | 28 | #include <vector> |
30 | 29 |
|
31 | 30 | Local<Value> McClass::spawnSimulatedPlayer(const Arguments& args) { |
@@ -59,7 +58,14 @@ Local<Value> McClass::spawnSimulatedPlayer(const Arguments& args) { |
59 | 58 | } |
60 | 59 | bpos = BlockPos(args[1].toInt(), args[2].toInt(), args[3].toInt()).bottomCenter(); |
61 | 60 | } |
62 | | - if (auto sp = SimulatedPlayer::create(name, bpos, dimid)) return PlayerClass::newPlayer(sp); |
| 61 | + if (auto sp = SimulatedPlayer::create( |
| 62 | + name, |
| 63 | + bpos, |
| 64 | + dimid, |
| 65 | + ll::service::getMinecraft()->getServerNetworkHandler(), |
| 66 | + std::to_string(ll::random_utils::rand<int64>(INT64_MIN, -1)) |
| 67 | + )) |
| 68 | + return PlayerClass::newPlayer(sp); |
63 | 69 | else return Local<Value>(); |
64 | 70 | } |
65 | 71 | CATCH("Fail in " __FUNCTION__ "!") |
|
0 commit comments