50class SimulatedPlayer :
public ::ServerPlayer {
53 create(std::string
const& name,
Vec3 const& pos,
DimensionType dimId = 0,
Vec2 const& rotation = {0, 0});
55 bool simulateSneaking() {
57 return SynchedActorDataAccess::getActorFlag(getEntityContext(), ActorFlags::Sneaking);
59 bool simulateStopSneaking() {
61 return !SynchedActorDataAccess::getActorFlag(getEntityContext(), ActorFlags::Sneaking);
63 bool simulateUseItem() {
return simulateUseItemInSlot(getSelectedItemSlot()); }
65 LLAPI
bool simulateDestroyBlock(
BlockPos const&, ScriptModuleMinecraft::ScriptFacing);
66 LLAPI
bool simulateDestroyLookAt(
float handLength = 5.5f);
67 LLAPI
void simulateStopMoving();
68 LLAPI
bool simulateAttack(
Actor* target);
69 LLAPI
void simulateStartBuildInSlot(
int slot);
70 LLAPI
void simulateStopBuild();
71 LLAPI
void simulateStopUsingItem();
72 LLAPI
bool simulateGiveItem(
ItemStack& item,
bool selectSlot);
73 LLAPI
bool simulateSetItem(
ItemStack const& item,
bool selectSlot,
int slot);
74 LLAPI
bool simulateDropSelectedItem();
75 LLAPI
bool simulateInteract(
Actor& actor);
76 LLAPI
void simulateStopInteracting();
77 LLAPI
bool isSimulatingDestroyingBlock();
79 LLAPI
void simulateLookAt(
Actor& actor, sim::LookDuration lookType = sim::LookDuration::Instant);
81 LLAPI
void simulateDisconnect();
82 LLAPI
bool simulateRespawn();
83 LLAPI
void simulateFly();
84 LLAPI
void simulateStopFlying();
85 LLAPI
void simulateWorldMove(
::Vec3 const& worldDirection,
float = 1.0f);
86 LLAPI
void simulateLocalMove(
::Vec3 const& localDirection,
float = 1.0f);
87 LLAPI
void simulateMoveToLocation(
::Vec3 const& position,
float speed,
bool faceTarget);
89 LLAPI static ::SimulatedPlayer* tryGetFromEntity(
::EntityContext& entity,
bool includeRemoved);
94 ::ll::TypedStorage<8, 48, ::sim::MovementIntent> mSimulatedMovement;
95 ::ll::TypedStorage<1, 2, ::sim::BuildIntent> mBuildIntention;
96 ::ll::TypedStorage<8, 40, ::sim::LookAtIntent> mLookAtIntent;
97 ::ll::TypedStorage<4, 16, ::std::optional<::BlockPos>> mDestroyingBlockPos;
98 ::ll::TypedStorage<1, 2, ::std::optional<uchar>> mDestroyingBlockFace;
99 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::gametest::BaseGameTestHelper>> mGameTestHelper;
100 ::ll::TypedStorage<8, 16, ::std::optional<uint64>> mInputCooldownTick;
101 ::ll::TypedStorage<8, 64, ::PlayerMovementSettings> mMovementSettings;
102 ::ll::TypedStorage<4, 4, float> mBaseInputSpeed;
103 ::ll::TypedStorage<8, 32, ::std::string> mXuid;
104 ::ll::TypedStorage<8, 40, ::PlayerSuspendLevelStorageSaveToken const> mPlayerSuspendLevelStorageSaveToken;
117 virtual void aiStep() ;
119 virtual bool isSimulated()
const ;
121 virtual ::std::string getXuid()
const ;
123 virtual ::PlayerMovementSettings
const& getMovementSettings()
const ;
125 virtual void teleportTo(
127 bool shouldStopRiding,
129 int sourceEntityType,
133 virtual int _getSpawnChunkLimit()
const ;
135 virtual ::std::shared_ptr<::ChunkViewSource> _createChunkSource(
::ChunkSource& mainChunkSource) ;
137 virtual void _updateChunkPublisherView(
::Vec3 const& position,
float minDistance) ;
143 MCAPI SimulatedPlayer(
148 ::GameType playerGameType,
151 ::std::function<
void(::ServerPlayer&)> playerLoadedCallback,
153 ::std::string
const& deviceId,
154 ::PlayerAuthenticationType authType,
157 bool enableItemStackNetManager,
161 MCAPI
void _addMoveComponent();
163 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
166 MCAPI
void _updateDestroyBlock();
168 MCAPI
void _updateMovement();
170 MCAPI
void _updateRidingComponents();
172 MCAPI ::Bedrock::NonOwnerPointer<::gametest::BaseGameTestHelper> getGameTestHelper()
const;
174 MCAPI
void postAiStep();
176 MCAPI
void preAiStep();
180 MCAPI
void setXuid(::std::string
const& xuid);
182 MCAPI
bool simulateAttack();
184 MCAPI
void simulateChat(::std::string
const& message);
186 MCAPI
bool simulateInteract();
188 MCAPI
bool simulateInteract(
::BlockPos const& pos, ::ScriptModuleMinecraft::ScriptFacing face);
190 MCAPI
bool simulateJump();
192 MCAPI
void simulateLookAt(
::Vec3 const& pos);
194 MCAPI
void simulateLookAt(
::BlockPos const& blockPos, ::sim::LookDuration lookType = sim::LookDuration::Instant);
196 MCAPI
void simulateLookAt(
::Vec3 const& pos, ::sim::LookDuration lookType = sim::LookDuration::Instant);
198 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult simulateNavigateToEntity(
::Actor& actor,
float speed);
200 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
201 simulateNavigateToLocation(
::Vec3 const& position,
float speed);
203 MCAPI
void simulateNavigateToLocations(::std::vector<::Vec3>&& positions,
float speed);
205 MCAPI
void simulateSetBodyRotation(
float degY);
207 MCAPI
bool simulateSetItem(
::ItemStack& item,
bool selectSlot,
int slot);
209 MCAPI
void simulateStopDestroyingBlock();
213 MCAPI
bool simulateUseItemInSlot(
int slot);
215 MCAPI
bool simulateUseItemInSlotOnBlock(
218 ::ScriptModuleMinecraft::ScriptFacing face,
222 MCAPI
bool simulateUseItemOnBlock(
225 ::ScriptModuleMinecraft::ScriptFacing face,
233 MCAPI static ::SimulatedPlayer* create(
234 ::std::string
const& name,
237 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
238 ::std::string
const& xuid,
239 ::std::optional<::ActorUniqueID> idOverride
242 MCAPI static ::SimulatedPlayer* create(
243 ::std::string
const& name,
245 ::Vec3 const& spawnPosDelta,
246 ::Vec2 const& spawnRotation,
247 bool spawnLoadedFromSave,
249 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
250 ::std::string
const& xuid,
251 ::std::optional<::ActorUniqueID> idOverride
263 ::GameType playerGameType,
266 ::std::function<
void(::ServerPlayer&)> playerLoadedCallback,
268 ::std::string
const& deviceId,
269 ::PlayerAuthenticationType authType,
272 bool enableItemStackNetManager,
280 MCAPI
void $initializeComponents(::ActorInitializationMethod method,
::VariantParameterList const& params);
282 MCAPI
void $aiStep();
284 MCFOLD
bool $isSimulated()
const;
286 MCAPI ::std::string $getXuid()
const;
288 MCAPI ::PlayerMovementSettings
const& $getMovementSettings()
const;
291 $teleportTo(
::Vec3 const& pos,
bool shouldStopRiding,
int cause,
int sourceEntityType,
bool keepVelocity);
293 MCFOLD
int $_getSpawnChunkLimit()
const;
295 MCAPI ::std::shared_ptr<::ChunkViewSource> $_createChunkSource(
::ChunkSource& mainChunkSource);
297 MCFOLD
void $_updateChunkPublisherView(
::Vec3 const& position,
float minDistance);
Definition EntityContext.h:17