51class SimulatedPlayer :
public ::ServerPlayer {
54 create(std::string
const& name,
Vec3 const& pos,
DimensionType dimId = 0,
Vec2 const& rotation = {0, 0});
56 bool simulateSneaking() {
58 return SynchedActorDataAccess::getActorFlag(mEntityContext, ActorFlags::Sneaking);
60 bool simulateStopSneaking() {
62 return !SynchedActorDataAccess::getActorFlag(mEntityContext, ActorFlags::Sneaking);
64 bool simulateUseItem() {
return simulateUseItemInSlot(mInventory->mSelected); }
66 LLAPI
bool simulateDestroyBlock(
BlockPos const&, ScriptModuleMinecraft::ScriptFacing);
67 LLAPI
bool simulateDestroyLookAt(
float handLength = 5.5f);
68 LLAPI
void simulateStopMoving();
69 LLAPI
bool simulateAttack(
Actor* target);
70 LLAPI
void simulateStartBuildInSlot(
int slot);
71 LLAPI
void simulateStopBuild();
72 LLAPI
void simulateStopUsingItem();
73 LLAPI
bool simulateGiveItem(
ItemStack& item,
bool selectSlot);
74 LLAPI
bool simulateSetItem(
ItemStack const& item,
bool selectSlot,
int slot);
75 LLAPI
bool simulateDropSelectedItem();
76 LLAPI
bool simulateInteract(
Actor& actor);
77 LLAPI
void simulateStopInteracting();
78 LLAPI
bool isSimulatingDestroyingBlock();
80 LLAPI
void simulateLookAt(
Actor& actor, sim::LookDuration lookType = sim::LookDuration::Instant);
82 LLAPI
void simulateDisconnect();
83 LLAPI
bool simulateRespawn();
84 LLAPI
void simulateFly();
85 LLAPI
void simulateStopFlying();
86 LLAPI
void simulateWorldMove(
::Vec3 const& worldDirection,
float = 1.0f);
87 LLAPI
void simulateLocalMove(
::Vec3 const& localDirection,
float = 1.0f);
88 LLAPI
void simulateMoveToLocation(
::Vec3 const& position,
float speed,
bool faceTarget);
89 LLAPI
void simulateStopDestroyingBlock();
90 LLAPI
bool simulateInteract(
::BlockPos const& pos, ::ScriptModuleMinecraft::ScriptFacing face);
93 LLAPI static ::SimulatedPlayer* tryGetFromEntity(
::EntityContext& entity,
bool includeRemoved);
98 ::ll::TypedStorage<8, 48, ::sim::MovementIntent> mSimulatedMovement;
99 ::ll::TypedStorage<1, 2, ::sim::BuildIntent> mBuildIntention;
100 ::ll::TypedStorage<8, 40, ::sim::LookAtIntent> mLookAtIntent;
101 ::ll::TypedStorage<4, 16, ::std::optional<::BlockPos>> mDestroyingBlockPos;
102 ::ll::TypedStorage<1, 2, ::std::optional<uchar>> mDestroyingBlockFace;
103 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::gametest::BaseGameTestHelper>> mGameTestHelper;
104 ::ll::TypedStorage<8, 16, ::std::optional<uint64>> mInputCooldownTick;
105 ::ll::TypedStorage<8, 64, ::PlayerMovementSettings> mMovementSettings;
106 ::ll::TypedStorage<4, 4, float> mBaseInputSpeed;
107 ::ll::TypedStorage<8, 32, ::std::string> mXuid;
108 ::ll::TypedStorage<8, 40, ::PlayerSuspendLevelStorageSaveToken const> mPlayerSuspendLevelStorageSaveToken;
121 virtual void aiStep() ;
123 virtual bool isSimulated()
const ;
125 virtual ::std::string getXuid()
const ;
127 virtual ::PlayerMovementSettings
const& getMovementSettings()
const ;
129 virtual void teleportTo(
131 bool shouldStopRiding,
133 int sourceEntityType,
137 virtual int _getSpawnChunkLimit()
const ;
139 virtual ::std::shared_ptr<::ChunkViewSource> _createChunkSource(
::ChunkSource& mainChunkSource) ;
141 virtual void _updateChunkPublisherView(
::Vec3 const& position,
float minDistance) ;
147 MCAPI SimulatedPlayer(
152 ::GameType playerGameType,
155 ::std::function<
void(::ServerPlayer&)> playerLoadedCallback,
157 ::std::string
const& deviceId,
158 ::PlayerAuthenticationType authType,
161 bool enableItemStackNetManager,
165 MCAPI
void _addMoveComponent();
167 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
170 MCAPI
void _updateDestroyBlock();
172 MCAPI
void _updateMovement();
174 MCAPI
void _updateRidingComponents();
176 MCAPI
void postAiStep();
178 MCAPI
void preAiStep();
182 MCAPI
bool simulateAttack();
184 MCAPI
void simulateChat(::std::string
const& message);
186 MCAPI
bool simulateInteract();
188 MCAPI
bool simulateJump();
190 MCAPI
void simulateLookAt(
::BlockPos const& blockPos, ::sim::LookDuration lookType);
192 MCAPI
void simulateLookAt(
::Vec3 const& pos, ::sim::LookDuration lookType = sim::LookDuration::Instant);
194 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult simulateNavigateToEntity(
::Actor& actor,
float speed);
196 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
197 simulateNavigateToLocation(
::Vec3 const& position,
float speed);
199 MCAPI
void simulateNavigateToLocations(::std::vector<::Vec3>&& positions,
float speed);
201 MCAPI
void simulateSetBodyRotation(
float degY);
205 MCAPI
bool simulateUseItemInSlot(
int slot);
207 MCAPI
bool simulateUseItemInSlotOnBlock(
210 ::ScriptModuleMinecraft::ScriptFacing face,
214 MCAPI
bool simulateUseItemOnBlock(
217 ::ScriptModuleMinecraft::ScriptFacing face,
225 MCAPI static ::SimulatedPlayer* create(
226 ::std::string
const& name,
229 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
230 ::std::string
const& xuid,
231 ::std::optional<::ActorUniqueID> idOverride
234 MCAPI static ::SimulatedPlayer* create(
235 ::std::string
const& name,
237 ::Vec3 const& spawnPosDelta,
238 ::Vec2 const& spawnRotation,
239 bool spawnLoadedFromSave,
241 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
242 ::std::string
const& xuid,
243 ::std::optional<::ActorUniqueID> idOverride
255 ::GameType playerGameType,
258 ::std::function<
void(::ServerPlayer&)> playerLoadedCallback,
260 ::std::string
const& deviceId,
261 ::PlayerAuthenticationType authType,
264 bool enableItemStackNetManager,
272 MCAPI
void $initializeComponents(::ActorInitializationMethod method,
::VariantParameterList const& params);
274 MCAPI
void $aiStep();
276 MCFOLD
bool $isSimulated()
const;
278 MCAPI ::std::string $getXuid()
const;
280 MCAPI ::PlayerMovementSettings
const& $getMovementSettings()
const;
283 $teleportTo(
::Vec3 const& pos,
bool shouldStopRiding,
int cause,
int sourceEntityType,
bool keepVelocity);
285 MCFOLD
int $_getSpawnChunkLimit()
const;
287 MCAPI ::std::shared_ptr<::ChunkViewSource> $_createChunkSource(
::ChunkSource& mainChunkSource);
289 MCFOLD
void $_updateChunkPublisherView(
::Vec3 const& position,
float minDistance);
Definition EntityContext.h:15