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