LeviLamina
Loading...
Searching...
No Matches
SimulatedPlayer.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/math/Vec2.h"
5#include "mc/deps/core/math/Vec3.h"
6#include "mc/world/actor/provider/SynchedActorDataAccess.h"
7
8// auto generated inclusion list
9#include "mc/common/SubClientId.h"
10#include "mc/deps/core/utility/AutomaticID.h"
11#include "mc/deps/core/utility/NonOwnerPointer.h"
12#include "mc/scripting/modules/minecraft/ScriptFacing.h"
13#include "mc/server/ServerPlayer.h"
14#include "mc/server/sim/BuildIntent.h"
15#include "mc/server/sim/LookAtIntent.h"
16#include "mc/server/sim/MovementIntent.h"
17#include "mc/world/actor/ActorInitializationMethod.h"
18#include "mc/world/actor/player/PlayerMovementSettings.h"
19#include "mc/world/level/BlockPos.h"
20#include "mc/world/level/GameType.h"
21#include "mc/world/level/storage/PlayerSuspendLevelStorageSaveToken.h"
22
23// auto generated forward declare list
24// clang-format off
25class Actor;
26class BlockSource;
27class ChunkSource;
28class ChunkViewSource;
29class Dimension;
30class EntityContext;
31class GameServerToken;
32class ItemStack;
33class Level;
36class PacketSender;
39class Vec2;
40class Vec3;
41struct ActorUniqueID;
43namespace ClientBlobCache::Server { class ActiveTransfersManager; }
44namespace ScriptModuleGameTest { struct ScriptNavigationResult; }
45namespace gametest { class BaseGameTestHelper; }
46namespace mce { class UUID; }
47// clang-format on
48
50public:
52 create(std::string const& name, Vec3 const& pos, DimensionType dimId = 0, Vec2 const& rotation = {0, 0});
53
54 [[nodiscard]] inline bool simulateSneaking() {
55 setSneaking(true);
56 return SynchedActorDataAccess::getActorFlag(getEntityContext(), ActorFlags::Sneaking);
57 }
58 [[nodiscard]] inline bool simulateStopSneaking() {
59 setSneaking(false);
60 return !SynchedActorDataAccess::getActorFlag(getEntityContext(), ActorFlags::Sneaking);
61 }
62 inline bool simulateUseItem() { return simulateUseItemInSlot(getSelectedItemSlot()); }
63
64 LLAPI bool simulateDestroyBlock(BlockPos const&, ScriptModuleMinecraft::ScriptFacing);
65
66 LLAPI bool simulateDestroyLookAt(float handLength = 5.5f);
67
68 LLAPI static ::SimulatedPlayer* tryGetFromEntity(::EntityContext& entity, bool includeRemoved);
69
70public:
71 // member variables
72 // NOLINTBEGIN
73 ::ll::TypedStorage<8, 48, ::sim::MovementIntent> mSimulatedMovement;
74 ::ll::TypedStorage<1, 2, ::sim::BuildIntent> mBuildIntention;
75 ::ll::TypedStorage<8, 40, ::sim::LookAtIntent> mLookAtIntent;
76 ::ll::TypedStorage<4, 16, ::std::optional<::BlockPos>> mDestroyingBlockPos;
77 ::ll::TypedStorage<1, 2, ::std::optional<uchar>> mDestroyingBlockFace;
78 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::gametest::BaseGameTestHelper>> mGameTestHelper;
79 ::ll::TypedStorage<8, 8, uint64> mCooldownTick;
80 ::ll::TypedStorage<8, 88, ::PlayerMovementSettings> mMovementSettings;
81 ::ll::TypedStorage<4, 4, float> mBaseInputSpeed;
82 ::ll::TypedStorage<8, 32, ::std::string> mXuid;
83 ::ll::TypedStorage<8, 40, ::PlayerSuspendLevelStorageSaveToken const> mPlayerSuspendLevelStorageSaveToken;
84 // NOLINTEND
85
86public:
87 // prevent constructor by default
89
90public:
91 // virtual functions
92 // NOLINTBEGIN
93 // vIndex: 4
94 virtual void
95 initializeComponents(::ActorInitializationMethod method, ::VariantParameterList const& params) /*override*/;
96
97 // vIndex: 145
98 virtual void aiStep() /*override*/;
99
100 // vIndex: 232
101 virtual bool isSimulated() const /*override*/;
102
103 // vIndex: 233
104 virtual ::std::string getXuid() const /*override*/;
105
106 // vIndex: 234
107 virtual ::PlayerMovementSettings const& getMovementSettings() const /*override*/;
108
109 // vIndex: 21
110 virtual void teleportTo(
111 ::Vec3 const& pos,
112 bool shouldStopRiding,
113 int cause,
114 int sourceEntityType,
115 bool keepVelocity
116 ) /*override*/;
117
118 // vIndex: 242
119 virtual int _getSpawnChunkLimit() const /*override*/;
120
121 // vIndex: 238
122 virtual ::std::shared_ptr<::ChunkViewSource> _createChunkSource(::ChunkSource& mainChunkSource) /*override*/;
123
124 // vIndex: 243
125 virtual void _updateChunkPublisherView(::Vec3 const& position, float minDistance) /*override*/;
126
127 // vIndex: 0
128 virtual ~SimulatedPlayer() /*override*/;
129 // NOLINTEND
130
131public:
132 // member functions
133 // NOLINTBEGIN
134 MCAPI SimulatedPlayer(
135 ::Level& level,
136 ::PacketSender& packetSender,
137 ::ServerNetworkSystem& network,
139 ::GameType playerGameType,
140 ::NetworkIdentifier const& owner,
141 ::SubClientId subid,
142 ::std::function<void(::ServerPlayer&)> playerLoadedCallback,
143 ::mce::UUID uuid,
144 ::std::string const& deviceId,
145 ::GameServerToken const& token,
146 int maxChunkRadius,
147 bool enableItemStackNetManager,
148 ::EntityContext& entityContext
149 );
150
151 MCAPI void _addMoveComponent();
152
153 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
154 _createNavigationResult(::NavigationComponent* navigation) const;
155
156 MCFOLD ::BlockSource& _getRegion();
157
158 MCAPI bool _trySwing();
159
160 MCAPI void _updateRidingComponents();
161
162 MCAPI void preAiStep();
163
164 MCAPI void setGameTestHelper(::Bedrock::NonOwnerPointer<::gametest::BaseGameTestHelper> gameTestHelper);
165
166 MCAPI bool simulateAttack();
167
168 MCAPI void simulateChat(::std::string const& message);
169
170 MCAPI bool simulateInteract();
171
172 MCAPI bool simulateInteract(::BlockPos const& pos, ::ScriptModuleMinecraft::ScriptFacing face);
173
174 MCAPI bool simulateJump();
175
176 MCAPI void simulateLocalMove(::Vec3 const& localDirection, float);
177
178 MCAPI void simulateMoveToLocation(::Vec3 const& position, float speed, bool faceTarget);
179
180 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult simulateNavigateToEntity(::Actor& actor, float speed);
181
182 MCAPI ::ScriptModuleGameTest::ScriptNavigationResult
183 simulateNavigateToLocation(::Vec3 const& position, float speed);
184
185 MCAPI void simulateNavigateToLocations(::std::vector<::Vec3>&& positions, float speed);
186
187 MCAPI void simulateSetBodyRotation(float degY);
188
189 MCAPI void simulateStopDestroyingBlock();
190
191 MCAPI bool simulateUseItemInSlot(int slot);
192
193 MCAPI bool simulateUseItemOnBlock(
194 ::ItemStack& item,
195 ::BlockPos const& pos,
196 ::ScriptModuleMinecraft::ScriptFacing face,
197 ::Vec3 const& facePos
198 );
199
200 MCAPI void simulateWorldMove(::Vec3 const& worldDirection, float);
201 // NOLINTEND
202
203public:
204 // static functions
205 // NOLINTBEGIN
206 MCAPI static ::SimulatedPlayer* create(
207 ::std::string const& name,
208 ::BlockPos const& spawnPos,
209 ::DimensionType dimensionId,
210 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
211 ::std::string const& xuid,
212 ::std::optional<::ActorUniqueID> idOverride
213 );
214
215 MCAPI static ::SimulatedPlayer* create(
216 ::std::string const& name,
217 ::BlockPos const& spawnPos,
218 ::Vec3 const& spawnPosDelta,
219 ::Vec2 const& spawnRotation,
220 bool spawnLoadedFromSave,
221 ::DimensionType dimensionId,
222 ::Bedrock::NotNullNonOwnerPtr<::ServerNetworkHandler> serverNetworkHandler,
223 ::std::string const& xuid,
224 ::std::optional<::ActorUniqueID> idOverride
225 );
226 // NOLINTEND
227
228public:
229 // constructor thunks
230 // NOLINTBEGIN
231 MCAPI void* $ctor(
232 ::Level& level,
233 ::PacketSender& packetSender,
234 ::ServerNetworkSystem& network,
236 ::GameType playerGameType,
237 ::NetworkIdentifier const& owner,
238 ::SubClientId subid,
239 ::std::function<void(::ServerPlayer&)> playerLoadedCallback,
240 ::mce::UUID uuid,
241 ::std::string const& deviceId,
242 ::GameServerToken const& token,
243 int maxChunkRadius,
244 bool enableItemStackNetManager,
245 ::EntityContext& entityContext
246 );
247 // NOLINTEND
248
249public:
250 // destructor thunk
251 // NOLINTBEGIN
252 MCAPI void $dtor();
253 // NOLINTEND
254
255public:
256 // virtual function thunks
257 // NOLINTBEGIN
258 MCAPI void $initializeComponents(::ActorInitializationMethod method, ::VariantParameterList const& params);
259
260 MCAPI void $aiStep();
261
262 MCFOLD bool $isSimulated() const;
263
264 MCAPI ::std::string $getXuid() const;
265
266 MCAPI ::PlayerMovementSettings const& $getMovementSettings() const;
267
268 MCAPI void
269 $teleportTo(::Vec3 const& pos, bool shouldStopRiding, int cause, int sourceEntityType, bool keepVelocity);
270
271 MCFOLD int $_getSpawnChunkLimit() const;
272
273 MCAPI ::std::shared_ptr<::ChunkViewSource> $_createChunkSource(::ChunkSource& mainChunkSource);
274
275 MCFOLD void $_updateChunkPublisherView(::Vec3 const& position, float minDistance);
276 // NOLINTEND
277
278public:
279 // vftables
280 // NOLINTBEGIN
281 MCNAPI static void** $vftable();
282 // NOLINTEND
283};
Definition Actor.h:103
Definition AutomaticID.h:6
Definition NonOwnerPointer.h:9
Definition BlockPos.h:18
Definition BlockSource.h:67
Definition ChunkSource.h:34
Definition ChunkViewSource.h:22
Definition ActiveTransfersManager.h:16
Definition Dimension.h:83
Definition EntityContext.h:16
Definition GameServerToken.h:12
Definition ItemStack.h:25
Definition Level.h:238
Definition NavigationComponent.h:22
Definition NetworkIdentifier.h:10
Definition PacketSender.h:17
Definition ServerNetworkHandler.h:162
Definition ServerNetworkSystem.h:26
Definition ServerPlayer.h:64
Definition SimulatedPlayer.h:49
static MCAPI void ** $vftable()
Definition Vec2.h:5
Definition Vec3.h:10
Definition UUID.h:7
Definition optional_ref.h:10
Definition ActorUniqueID.h:5
Definition VariantParameterList.h:5