53class SimulatedPlayer :
public ::ServerPlayer {
56 create(std::string
const& name,
Vec3 const& pos, DimensionType dimId = 0,
Vec2 const& rotation = {0, 0});
58 bool simulateSneaking() {
60 return SynchedActorDataAccess::getActorFlag(getEntityContext(), ActorFlags::Sneaking);
62 bool simulateStopSneaking() {
64 return !SynchedActorDataAccess::getActorFlag(getEntityContext(), ActorFlags::Sneaking);
66 bool simulateUseItem() {
return simulateUseItemInSlot(getSelectedItemSlot()); }
68 LLAPI
bool simulateDestroyBlock(
BlockPos const&, ScriptModuleMinecraft::ScriptFacing);
69 LLAPI
bool simulateDestroyLookAt(
float handLength = 5.5f);
70 LLAPI
void simulateStopMoving();
71 LLAPI
bool simulateAttack(
Actor* target);
72 LLAPI
void simulateStartBuildInSlot(
int slot);
73 LLAPI
void simulateStopBuild();
74 LLAPI
void simulateStopUsingItem();
75 LLAPI
bool simulateGiveItem(
ItemStack& item,
bool selectSlot);
76 LLAPI
bool simulateSetItem(
ItemStack const& item,
bool selectSlot,
int slot);
77 LLAPI
bool simulateDropSelectedItem();
78 LLAPI
bool simulateInteract(
Actor& actor);
79 LLAPI
void simulateStopInteracting();
80 LLAPI
bool isSimulatingDestroyingBlock();
82 LLAPI
void simulateLookAt(
Actor& actor, sim::LookDuration lookType = sim::LookDuration::Instant);
84 LLAPI
void simulateDisconnect();
85 LLAPI
bool simulateRespawn();
86 LLAPI
void simulateFly();
87 LLAPI
void simulateStopFlying();
88 LLAPI
void simulateWorldMove(
::Vec3 const& worldDirection,
float = 1.0f);
89 LLAPI
void simulateLocalMove(
::Vec3 const& localDirection,
float = 1.0f);
90 LLAPI
void simulateMoveToLocation(
::Vec3 const& position,
float speed,
bool faceTarget);
92 LLAPI static ::SimulatedPlayer* tryGetFromEntity(
::EntityContext& entity,
bool includeRemoved);
97 ::ll::TypedStorage<8, 48, ::sim::MovementIntent> mSimulatedMovement;
98 ::ll::TypedStorage<1, 2, ::sim::BuildIntent> mBuildIntention;
99 ::ll::TypedStorage<8, 40, ::sim::LookAtIntent> mLookAtIntent;
100 ::ll::TypedStorage<4, 16, ::std::optional<::BlockPos>> mDestroyingBlockPos;
101 ::ll::TypedStorage<1, 2, ::std::optional<uchar>> mDestroyingBlockFace;
102 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::gametest::BaseGameTestHelper>> mGameTestHelper;
103 ::ll::TypedStorage<8, 16, ::std::optional<uint64>> mInputCooldownTick;
104 ::ll::TypedStorage<8, 64, ::PlayerMovementSettings> mMovementSettings;
105 ::ll::TypedStorage<4, 4, float> mBaseInputSpeed;
106 ::ll::TypedStorage<8, 32, ::std::string> mXuid;
107 ::ll::TypedStorage<8, 40, ::PlayerSuspendLevelStorageSaveToken const> mPlayerSuspendLevelStorageSaveToken;
120 virtual void aiStep() ;
122 virtual bool isSimulated()
const ;
124 virtual ::std::string getXuid()
const ;
126 virtual ::PlayerMovementSettings
const& getMovementSettings()
const ;
128 virtual void teleportTo(
130 bool shouldStopRiding,
132 int sourceEntityType,
136 virtual int _getSpawnChunkLimit()
const ;
138 virtual ::std::shared_ptr<::ChunkViewSource> _createChunkSource(
::ChunkSource& mainChunkSource) ;
140 virtual void _updateChunkPublisherView(
::Vec3 const& position,
float minDistance) ;
142 virtual ~SimulatedPlayer() ;
148 MCAPI SimulatedPlayer(
153 ::GameType playerGameType,
156 ::std::function<
void(::ServerPlayer&)> playerLoadedCallback,
158 ::std::string
const& deviceId,
159 ::PlayerAuthenticationType authType,
162 bool enableItemStackNetManager,
166 MCAPI
void _addMoveComponent();
168 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
171 MCFOLD ::BlockSource& _getRegion();
173 MCAPI
bool _trySwing(::ActorSwingSource swingSource);
175 MCAPI
void _updateMovement();
177 MCAPI
void _updateRidingComponents();
179 MCAPI
void preAiStep();
183 MCAPI
bool simulateAttack();
185 MCAPI
void simulateChat(::std::string
const& message);
187 MCAPI
bool simulateInteract();
189 MCAPI
bool simulateInteract(
::BlockPos const& pos, ::ScriptModuleMinecraft::ScriptFacing face);
191 MCAPI
bool simulateJump();
193 MCAPI
void simulateLookAt(
::BlockPos const& blockPos, ::sim::LookDuration lookType = sim::LookDuration::Instant);
195 MCAPI
void simulateLookAt(
::Vec3 const& pos, ::sim::LookDuration lookType = sim::LookDuration::Instant);
197 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult simulateNavigateToEntity(
::Actor& actor,
float speed);
199 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
200 simulateNavigateToLocation(
::Vec3 const& position,
float speed);
202 MCAPI
void simulateNavigateToLocations(::std::vector<::Vec3>&& positions,
float speed);
204 MCAPI
void simulateSetBodyRotation(
float degY);
206 MCAPI
void simulateStopDestroyingBlock();
208 MCAPI
bool simulateUseItemInSlot(
int slot);
210 MCAPI
bool simulateUseItemOnBlock(
213 ::ScriptModuleMinecraft::ScriptFacing face,
221 MCAPI static ::SimulatedPlayer* create(
222 ::std::string
const& name,
224 ::Vec3 const& spawnPosDelta,
225 ::Vec2 const& spawnRotation,
226 bool spawnLoadedFromSave,
227 ::DimensionType dimensionId,
228 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
229 ::std::string
const& xuid,
230 ::std::optional<::ActorUniqueID> idOverride
242 ::GameType playerGameType,
245 ::std::function<
void(::ServerPlayer&)> playerLoadedCallback,
247 ::std::string
const& deviceId,
248 ::PlayerAuthenticationType authType,
251 bool enableItemStackNetManager,
265 MCAPI
void $initializeComponents(::ActorInitializationMethod method,
::VariantParameterList const& params);
267 MCAPI
void $aiStep();
269 MCFOLD
bool $isSimulated()
const;
271 MCAPI ::std::string $getXuid()
const;
273 MCAPI ::PlayerMovementSettings
const& $getMovementSettings()
const;
276 $teleportTo(
::Vec3 const& pos,
bool shouldStopRiding,
int cause,
int sourceEntityType,
bool keepVelocity);
278 MCFOLD
int $_getSpawnChunkLimit()
const;
280 MCAPI ::std::shared_ptr<::ChunkViewSource> $_createChunkSource(
::ChunkSource& mainChunkSource);
282 MCFOLD
void $_updateChunkPublisherView(
::Vec3 const& position,
float minDistance);
Definition EntityContext.h:16