LeviLamina
Loading...
Searching...
No Matches
ServerPlayer.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/certificates/identity/PlayerAuthenticationType.h"
7#include "mc/common/SubClientId.h"
8#include "mc/deps/core/platform/PlatformType.h"
9#include "mc/deps/core/string/HashedString.h"
10#include "mc/deps/core/utility/AutomaticID.h"
11#include "mc/deps/core/utility/NonOwnerPointer.h"
12#include "mc/deps/input/InputMode.h"
13#include "mc/deps/shared_types/legacy/actor/ArmorSlot.h"
14#include "mc/legacy/ActorUniqueID.h"
15#include "mc/platform/diagnostics/CrashDumpLogStringID.h"
16#include "mc/util/CallbackToken.h"
17#include "mc/util/HudElement.h"
18#include "mc/util/HudVisibility.h"
19#include "mc/world/ContainerID.h"
20#include "mc/world/actor/ActorEvent.h"
21#include "mc/world/actor/ActorInitializationMethod.h"
22#include "mc/world/actor/player/Player.h"
23#include "mc/world/inventory/InventoryMenu.h"
24#include "mc/world/level/GameType.h"
25#include "mc/world/level/Tick.h"
26
27// auto generated forward declare list
28// clang-format off
29class Actor;
31class BlockActor;
32class BlockPos;
33class ChunkSource;
35class CompoundTag;
36class Container;
38class DataLoadHelper;
39class Dimension;
40class EntityContext;
44class ItemStack;
45class Level;
47class Packet;
48class PacketSender;
52class TextObjectRoot;
53class Vec3;
54struct INpcDialogueData;
59namespace ClientBlobCache::Server { class ActiveTransfersManager; }
60namespace Editor { class IEditorManager; }
61namespace Editor { class IEditorPlayer; }
62namespace mce { class UUID; }
63// clang-format on
64
65class ServerPlayer : public ::Player {
66public:
67 // ServerPlayer inner types declare
68 // clang-format off
69 struct NearbyActor;
70 // clang-format on
71
72 // ServerPlayer inner types define
73 using OnPlayerLoadedCallback = ::std::function<void(::ServerPlayer&)>;
74
75 struct NearbyActor {
76 public:
77 // NearbyActor inner types define
78 enum class State : int {
79 Unknown = 0,
80 New = 1,
81 Exist = 2,
82 DidExist = 3,
83 };
84
85 public:
86 // member variables
87 // NOLINTBEGIN
88 ::ll::TypedStorage<1, 1, bool> isAutonomous;
89 ::ll::TypedStorage<4, 4, ::ServerPlayer::NearbyActor::State> state;
90 ::ll::TypedStorage<8, 8, ::Actor*> tempActor;
91 // NOLINTEND
92 };
93
94public:
95 // member variables
96 // NOLINTBEGIN
97 ::ll::TypedStorage<4, 4, ::PlatformType> mPlatformType;
98 ::ll::TypedStorage<8, 8, ::ServerNetworkSystem&> mNetwork;
99 ::ll::TypedStorage<8, 64, ::std::function<void(::ServerPlayer&)>> mOnPlayerLoadedCallback;
100 ::ll::TypedStorage<8, 112, ::InventoryMenu> mInventoryMenu;
101 ::ll::TypedStorage<1, 1, ::ContainerID> mContainerCounter;
102 ::ll::TypedStorage<4, 4, uint> mMaxChunkRadius;
103 ::ll::TypedStorage<1, 1, bool> mIsInitialPlayerLoadHappening;
104 ::ll::TypedStorage<1, 1, bool> mIsTeacher;
105 ::ll::TypedStorage<1, 1, bool> mLocalPlayerInitialized;
106 ::ll::TypedStorage<1, 1, bool> mWaitingForTickingAreasPreload;
107 ::ll::TypedStorage<8, 8, ::Tick> mPrevShieldBlockingTick;
108 ::ll::TypedStorage<4, 4, uint> mClientViewRadius;
109 ::ll::TypedStorage<4, 4, uint> mClientRequestedRadius;
110 ::ll::TypedStorage<1, 1, bool> mIsCompatibleWithClientSideChunkGen;
111 ::ll::TypedStorage<4, 4, int> mRemainingStructureRefreshTicks;
112 ::ll::TypedStorage<8, 48, ::HashedString> mCurrentStructureFeature;
113 ::ll::TypedStorage<8, 64, ::std::unordered_map<::ActorUniqueID, ::ServerPlayer::NearbyActor>> mNearbyActors;
114 ::ll::TypedStorage<8, 16, ::CallbackToken> mCloseContainerToken;
115 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Editor::IEditorPlayer>> mEditorServerPlayer;
116 ::ll::TypedStorage<1, 1, bool> mHasQueuedViewMove;
117 ::ll::TypedStorage<1, 1, bool> mIsPendingDisconnect;
118 ::ll::TypedStorage<4, 52, ::std::array<::HudVisibility, 13>> mHudElementsVisibilityState;
119 // NOLINTEND
120
121public:
122 // prevent constructor by default
123 ServerPlayer& operator=(ServerPlayer const&);
125 ServerPlayer();
126
127public:
128 // virtual functions
129 // NOLINTBEGIN
130 // vIndex: 0
131 virtual ~ServerPlayer() /*override*/;
132
133 // vIndex: 4
134 virtual void
135 initializeComponents(::ActorInitializationMethod method, ::VariantParameterList const& params) /*override*/;
136
137 // vIndex: 145
138 virtual void aiStep() /*override*/;
139
140 // vIndex: 24
141 virtual void normalTick() /*override*/;
142
143 // vIndex: 138
144 virtual void knockback(
145 ::Actor* source,
146 int dmg,
147 float xd,
148 float zd,
149 float horizontalPower,
150 float verticalPower,
151 float heightCap
152 ) /*override*/;
153
154 // vIndex: 123
155 virtual void die(::ActorDamageSource const& source) /*override*/;
156
157 // vIndex: 185
158 virtual void moveView() /*override*/;
159
160 // vIndex: 186
161 virtual void moveSpawnView(::Vec3 const& spawnPosition, ::DimensionType dimensionType) /*override*/;
162
163 // vIndex: 183
164 virtual void frameUpdate(::FrameUpdateContextBase&) /*override*/;
165
166 // vIndex: 52
167 virtual bool isValidTarget(::Actor* attacker) const /*override*/;
168
169 // vIndex: 156
170 virtual void
171 hurtArmorSlots(::ActorDamageSource const& source, int dmg, ::std::bitset<5> const hurtSlots) /*override*/;
172
173 // vIndex: 158
174 virtual void sendArmorDamage(::std::bitset<5> const damagedSlots) /*override*/;
175
176 // vIndex: 159
177 virtual void sendArmor(::std::bitset<5> const armorSlots) /*override*/;
178
179 // vIndex: 157
180 virtual void setDamagedArmor(::SharedTypes::Legacy::ArmorSlot, ::ItemStack const&) /*override*/;
181
182 // vIndex: 165
183 virtual void sendInventory(bool shouldSelectSlot) /*override*/;
184
185 // vIndex: 228
186 virtual void sendInventoryTransaction(::InventoryTransaction const& transaction) const /*override*/;
187
188 // vIndex: 229
189 virtual void sendComplexInventoryTransaction(::std::unique_ptr<::ComplexInventoryTransaction> transaction) const
190 /*override*/;
191
192 // vIndex: 230
193 virtual void sendNetworkPacket(::Packet& packet) const /*override*/;
194
195 // vIndex: 201
196 virtual void displayTextObjectMessage(
197 ::TextObjectRoot const& textObject,
198 ::std::string const& fromXuid,
199 ::std::string const& fromPlatformId
200 ) /*override*/;
201
202 // vIndex: 203
203 virtual void displayTextObjectWhisperMessage(
204 ::ResolvedTextObject const& textObject,
205 ::std::string const& xuid,
206 ::std::string const& platformId
207 ) /*override*/;
208
209 // vIndex: 202
210 virtual void displayTextObjectWhisperMessage(
211 ::std::string const& message,
212 ::std::string const& xuid,
213 ::std::string const& platformId
214 ) /*override*/;
215
216 // vIndex: 204
217 virtual void displayWhisperMessage(
218 ::std::string const& author,
219 ::std::string const& message,
220 ::std::optional<::std::string> const filteredMessage,
221 ::std::string const& xuid,
222 ::std::string const& platformId
223 ) /*override*/;
224
225 // vIndex: 195
226 virtual void openTrading(::ActorUniqueID const& uniqueID, bool useNewScreen) /*override*/;
227
228 // vIndex: 193
229 virtual void openPortfolio() /*override*/;
230
231 // vIndex: 197
232 virtual void openNpcInteractScreen(::std::shared_ptr<::INpcDialogueData> npc) /*override*/;
233
234 // vIndex: 198
235 virtual void openInventory() /*override*/;
236
237 // vIndex: 194
238 virtual void openBook(int, bool, int, ::BlockActor* lectern) /*override*/;
239
240 // vIndex: 208
241 virtual void openSign(::BlockPos const& position, bool isFrontSide) /*override*/;
242
243 // vIndex: 187
244 virtual void checkMovementStats(::Vec3 const& d) /*override*/;
245
246 // vIndex: 188
247 virtual ::HashedString getCurrentStructureFeature() const /*override*/;
248
249 // vIndex: 69
250 virtual void handleEntityEvent(::ActorEvent eventId, int data) /*override*/;
251
252 // vIndex: 220
253 virtual void setContainerData(::IContainerManager& menu, int id, int value) /*override*/;
254
255 // vIndex: 221
256 virtual void slotChanged(
257 ::IContainerManager& menu,
258 ::Container& container,
259 int slot,
260 ::ItemStack const& oldItem,
261 ::ItemStack const& newItem,
262 bool isResultSlot
263 ) /*override*/;
264
265 // vIndex: 222
266 virtual void refreshContainer(::IContainerManager& menu) /*override*/;
267
268 // vIndex: 206
269 virtual void stopSleepInBed(bool forcefulWakeUp, bool updateLevelList) /*override*/;
270
271 // vIndex: 72
272 virtual void setArmor(::SharedTypes::Legacy::ArmorSlot const slot, ::ItemStack const& item) /*override*/;
273
274 // vIndex: 79
275 virtual void setOffhandSlot(::ItemStack const& item) /*override*/;
276
277 // vIndex: 164
278 virtual void clearVanishEnchantedItemsOnDeath() /*override*/;
279
280 // vIndex: 88
281 virtual bool canChangeDimensionsUsingPortal() const /*override*/;
282
283 // vIndex: 90
284 virtual void changeDimension(::DimensionType toId) /*override*/;
285
286 // vIndex: 181
287 virtual void changeDimensionWithCredits(::DimensionType dimension) /*override*/;
288
289 // vIndex: 213
290 virtual void setPlayerGameType(::GameType gameType) /*override*/;
291
292 // vIndex: 177
293 virtual void prepareRegion(::ChunkSource& mainChunkSource) /*override*/;
294
295 // vIndex: 224
296 virtual bool isActorRelevant(::Actor const& actor) /*override*/;
297
298 // vIndex: 91
299 virtual ::ActorUniqueID getControllingPlayer() const /*override*/;
300
301 // vIndex: 178
302 virtual void destroyRegion() /*override*/;
303
304 // vIndex: 226
305 virtual void onSuspension() /*override*/;
306
307 // vIndex: 227
308 virtual void onLinkedSlotsChanged() /*override*/;
309
310 // vIndex: 225
311 virtual bool isTeacher() const /*override*/;
312
313 // vIndex: 210
314 virtual bool isLoading() const /*override*/;
315
316 // vIndex: 82
317 virtual bool load(::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper) /*override*/;
318
319 // vIndex: 211
320 virtual bool isPlayerInitialized() const /*override*/;
321
322 // vIndex: 190
323 virtual void respawn() /*override*/;
324
325 // vIndex: 231
326 virtual ::PlayerEventCoordinator& getPlayerEventCoordinator() /*override*/;
327
328 // vIndex: 241
329 virtual void destroyEditorPlayer() /*override*/;
330
331 // vIndex: 240
332 virtual ::Bedrock::NonOwnerPointer<::Editor::IEditorPlayer> getEditorPlayer() const /*override*/;
333
334 // vIndex: 236
335 virtual uchar getMaxChunkBuildRadius() const /*override*/;
336
337 // vIndex: 242
338 virtual int _getSpawnChunkLimit() const;
339
340 // vIndex: 243
341 virtual void _updateChunkPublisherView(::Vec3 const& position, float minDistance);
342
343 // vIndex: 6
344 virtual void _serverInitItemStackIds() /*override*/;
345 // NOLINTEND
346
347public:
348 // member functions
349 // NOLINTBEGIN
350 MCAPI ServerPlayer(
351 ::Level& level,
352 ::PacketSender& packetSender,
353 ::ServerNetworkSystem& network,
354 ::ClientBlobCache::Server::ActiveTransfersManager& clientCacheMirror,
355 ::GameType playerGameType,
356 bool isHostingPlayer,
357 ::NetworkIdentifier const& owner,
358 ::SubClientId subid,
359 ::std::function<void(::ServerPlayer&)> onPlayerLoadedCallback,
360 ::mce::UUID uuid,
361 ::std::string const& playFabId,
362 ::std::string const& deviceId,
363 ::PlayerAuthenticationType authType,
364 ::PlayerAuthenticationInfo const& authInfo,
365 int maxChunkRadius,
366 bool enableItemStackNetManager,
367 ::EntityContext& entityContext,
368 ::PlatformType platformType,
369 ::InputMode inputMode,
370 ::SyncedClientOptionsComponent clientOptions
371 );
372
373 MCAPI bool _checkForLoadedTickingAreas() const;
374
375 MCAPI void _logCDEvent(
376 ::CrashDumpLogStringID option1,
377 ::CrashDumpLogStringID option2,
378 ::CrashDumpLogStringID option3,
379 ::CrashDumpLogStringID option4
380 );
381
382 MCAPI void _removeNearbyEntities();
383
384 MCAPI void _setContainerManagerModel(::std::shared_ptr<::ContainerManagerModel> menu);
385
386 MCAPI void _updateNearbyActors();
387
388 MCAPI void addActorToReplicationList(::gsl::not_null<::Actor*> actor, bool autonomous);
389
390 MCAPI void createEditorPlayer(::Bedrock::NonOwnerPointer<::Editor::IEditorManager> editorManager);
391
392 MCAPI void disconnect();
393
394 MCAPI void doDeleteContainerManager(bool forceDisconnect);
395
396 MCAPI void doInitialSpawn();
397
398 MCAPI void handleActorPickRequestOnServer(::Actor& target, bool withData, bool isActorAgentAndEduMode);
399
400 MCAPI void handleBlockPickRequestOnServer(::BlockPos const& position, bool withData);
401
402 MCAPI void hideAllExcept(::std::optional<::std::vector<::HudElement>> const& hudElements);
403
404 MCAPI bool isInPickRangeOf(::BlockPos const& pos) const;
405
406 MCAPI ::ContainerID openUnmanagedContainer();
407
408 MCAPI void postReplicationTick(::Tick const& currentTick);
409
410 MCAPI void preReplicationTick(::Tick const& currentTick);
411
412 MCAPI bool selectItem(::ItemStack const& item);
413
414 MCAPI void setClientChunkRadius(uint requestedRadius, uchar clientMaxChunkRadius);
415
416 MCAPI void setHudVisibilityState(
417 ::HudVisibility hudVisibility,
418 ::std::optional<::std::vector<::HudElement>> const& hudElements
419 );
420 // NOLINTEND
421
422public:
423 // static functions
424 // NOLINTBEGIN
425 MCAPI static void initializePlayerTickComponents(::EntityContext& entity, ::PlayerMovementSettings const& settings);
426
427 MCAPI static ::ServerPlayer* tryGetFromEntity(::EntityContext& entity, bool includeRemoved);
428 // NOLINTEND
429
430public:
431 // constructor thunks
432 // NOLINTBEGIN
433 MCAPI void* $ctor(
434 ::Level& level,
435 ::PacketSender& packetSender,
436 ::ServerNetworkSystem& network,
437 ::ClientBlobCache::Server::ActiveTransfersManager& clientCacheMirror,
438 ::GameType playerGameType,
439 bool isHostingPlayer,
440 ::NetworkIdentifier const& owner,
441 ::SubClientId subid,
442 ::std::function<void(::ServerPlayer&)> onPlayerLoadedCallback,
443 ::mce::UUID uuid,
444 ::std::string const& playFabId,
445 ::std::string const& deviceId,
446 ::PlayerAuthenticationType authType,
447 ::PlayerAuthenticationInfo const& authInfo,
448 int maxChunkRadius,
449 bool enableItemStackNetManager,
450 ::EntityContext& entityContext,
451 ::PlatformType platformType,
452 ::InputMode inputMode,
453 ::SyncedClientOptionsComponent clientOptions
454 );
455 // NOLINTEND
456
457public:
458 // destructor thunk
459 // NOLINTBEGIN
460 MCAPI void $dtor();
461 // NOLINTEND
462
463public:
464 // virtual function thunks
465 // NOLINTBEGIN
466 MCAPI void $initializeComponents(::ActorInitializationMethod method, ::VariantParameterList const& params);
467
468 MCAPI void $aiStep();
469
470 MCAPI void $normalTick();
471
472 MCAPI void $knockback(
473 ::Actor* source,
474 int dmg,
475 float xd,
476 float zd,
477 float horizontalPower,
478 float verticalPower,
479 float heightCap
480 );
481
482 MCAPI void $die(::ActorDamageSource const& source);
483
484 MCAPI void $moveView();
485
486 MCAPI void $moveSpawnView(::Vec3 const& spawnPosition, ::DimensionType dimensionType);
487
488 MCFOLD void $frameUpdate(::FrameUpdateContextBase&);
489
490 MCAPI bool $isValidTarget(::Actor* attacker) const;
491
492 MCAPI void $hurtArmorSlots(::ActorDamageSource const& source, int dmg, ::std::bitset<5> const hurtSlots);
493
494 MCAPI void $sendArmorDamage(::std::bitset<5> const damagedSlots);
495
496 MCAPI void $sendArmor(::std::bitset<5> const armorSlots);
497
498 MCAPI void $sendInventory(bool shouldSelectSlot);
499
500 MCAPI void $sendInventoryTransaction(::InventoryTransaction const& transaction) const;
501
502 MCAPI void $sendComplexInventoryTransaction(::std::unique_ptr<::ComplexInventoryTransaction> transaction) const;
503
504 MCAPI void $sendNetworkPacket(::Packet& packet) const;
505
506 MCAPI void $displayTextObjectMessage(
507 ::TextObjectRoot const& textObject,
508 ::std::string const& fromXuid,
509 ::std::string const& fromPlatformId
510 );
511
512 MCAPI void $displayTextObjectWhisperMessage(
513 ::ResolvedTextObject const& textObject,
514 ::std::string const& xuid,
515 ::std::string const& platformId
516 );
517
518 MCAPI void $displayTextObjectWhisperMessage(
519 ::std::string const& message,
520 ::std::string const& xuid,
521 ::std::string const& platformId
522 );
523
524 MCAPI void $displayWhisperMessage(
525 ::std::string const& author,
526 ::std::string const& message,
527 ::std::optional<::std::string> const filteredMessage,
528 ::std::string const& xuid,
529 ::std::string const& platformId
530 );
531
532 MCAPI void $openTrading(::ActorUniqueID const& uniqueID, bool useNewScreen);
533
534 MCFOLD void $openPortfolio();
535
536 MCFOLD void $openNpcInteractScreen(::std::shared_ptr<::INpcDialogueData> npc);
537
538 MCAPI void $openInventory();
539
540 MCAPI void $openBook(int, bool, int, ::BlockActor* lectern);
541
542 MCAPI void $openSign(::BlockPos const& position, bool isFrontSide);
543
544 MCAPI void $checkMovementStats(::Vec3 const& d);
545
546 MCAPI ::HashedString $getCurrentStructureFeature() const;
547
548 MCAPI void $handleEntityEvent(::ActorEvent eventId, int data);
549
550 MCAPI void $setContainerData(::IContainerManager& menu, int id, int value);
551
552 MCAPI void $slotChanged(
553 ::IContainerManager& menu,
554 ::Container& container,
555 int slot,
556 ::ItemStack const& oldItem,
557 ::ItemStack const& newItem,
558 bool isResultSlot
559 );
560
561 MCAPI void $refreshContainer(::IContainerManager& menu);
562
563 MCAPI void $stopSleepInBed(bool forcefulWakeUp, bool updateLevelList);
564
565 MCAPI void $setOffhandSlot(::ItemStack const& item);
566
567 MCAPI void $clearVanishEnchantedItemsOnDeath();
568
569 MCAPI bool $canChangeDimensionsUsingPortal() const;
570
571 MCAPI void $changeDimension(::DimensionType toId);
572
573 MCAPI void $changeDimensionWithCredits(::DimensionType dimension);
574
575 MCAPI void $setPlayerGameType(::GameType gameType);
576
577 MCAPI void $prepareRegion(::ChunkSource& mainChunkSource);
578
579 MCAPI bool $isActorRelevant(::Actor const& actor);
580
581 MCAPI ::ActorUniqueID $getControllingPlayer() const;
582
583 MCAPI void $destroyRegion();
584
585 MCAPI void $onSuspension();
586
587 MCAPI void $onLinkedSlotsChanged();
588
589 MCAPI bool $isTeacher() const;
590
591 MCAPI bool $isLoading() const;
592
593 MCAPI bool $load(::CompoundTag const& tag, ::DataLoadHelper& dataLoadHelper);
594
595 MCAPI bool $isPlayerInitialized() const;
596
597 MCAPI void $respawn();
598
599 MCAPI ::PlayerEventCoordinator& $getPlayerEventCoordinator();
600
601 MCAPI void $destroyEditorPlayer();
602
603 MCAPI ::Bedrock::NonOwnerPointer<::Editor::IEditorPlayer> $getEditorPlayer() const;
604
605 MCAPI uchar $getMaxChunkBuildRadius() const;
606
607 MCAPI int $_getSpawnChunkLimit() const;
608
609 MCAPI void $_updateChunkPublisherView(::Vec3 const& position, float minDistance);
610
611 MCAPI void $_serverInitItemStackIds();
612 // NOLINTEND
613
614public:
615 // vftables
616 // NOLINTBEGIN
617 MCNAPI static void** $vftable();
618 // NOLINTEND
619};
Definition ActorDamageSource.h:18
Definition Actor.h:103
Definition AutomaticID.h:6
Definition BlockActor.h:32
Definition BlockPos.h:18
Definition ChunkSource.h:34
Definition ComplexInventoryTransaction.h:20
Definition CompoundTag.h:13
Definition ContainerManagerModel.h:29
Definition Container.h:30
Definition DataLoadHelper.h:20
Definition Dimension.h:83
Definition EntityContext.h:16
Definition FrameUpdateContextBase.h:5
Definition HashedString.h:5
Definition IContainerManager.h:16
Definition InventoryTransaction.h:21
Definition ItemStack.h:25
Definition Level.h:239
Definition NetworkIdentifier.h:10
Definition PacketSender.h:17
Definition Packet.h:26
Definition PlayerEventCoordinator.h:20
Definition Player.h:120
Definition ResolvedTextObject.h:5
Definition ServerNetworkSystem.h:28
Definition ServerPlayer.h:65
static MCAPI void ** $vftable()
Definition TextObjectRoot.h:14
Definition Vec3.h:10
STL namespace.
Definition ActorUniqueID.h:5
Definition INpcDialogueData.h:12
Definition PlayerAuthenticationInfo.h:5
Definition PlayerMovementSettings.h:9
Definition ServerPlayer.h:75
Definition SyncedClientOptionsComponent.h:10
Definition Tick.h:5
Definition VariantParameterList.h:5