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