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