LeviLamina
Loading...
Searching...
No Matches
ActorManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/utility/NonOwnerPointer.h"
7#include "mc/deps/core/utility/pub_sub/Connector.h"
8#include "mc/deps/core/utility/pub_sub/Publisher.h"
9#include "mc/deps/core/utility/pub_sub/Subscription.h"
10#include "mc/deps/game_refs/OwnerPtr.h"
11#include "mc/platform/Result.h"
12#include "mc/world/actor/ActorInitializationMethod.h"
13#include "mc/world/level/ActorValidationError.h"
14#include "mc/world/level/IActorManagerConnector.h"
15
16// auto generated forward declare list
17// clang-format off
18class Actor;
20class Dimension;
21class EntityContext;
25class LevelChunk;
26class WeakEntityRef;
27namespace Bedrock::PubSub::ThreadModel { struct MultiThreaded; }
28// clang-format on
29
30class ActorManager : public ::IActorManagerConnector {
31public:
32 // member variables
33 // NOLINTBEGIN
34 ::ll::TypedStorage<8, 24, ::std::vector<::OwnerPtr<::EntityContext>>> mEntities;
35 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::IActorManagerProxy>>> mActorManagerProxy;
36 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::ActorGarbageCollector>> mActorGarbageCollector;
37 ::ll::TypedStorage<
38 8,
39 128,
41 mOnActorEntityAdded;
42 ::ll::TypedStorage<
43 8,
44 128,
45 ::Bedrock::PubSub::
46 Publisher<void(::Actor&, ::ActorInitializationMethod), ::Bedrock::PubSub::ThreadModel::MultiThreaded, 0>>
47 mPostReloadActor;
48 ::ll::TypedStorage<
49 8,
50 128,
52 mOnRemoveActorEntityReferences;
53 ::ll::TypedStorage<1, 1, bool> mIsLevelTearingDown;
54 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnChunkDiscarded;
55 // NOLINTEND
56
57public:
58 // prevent constructor by default
59 ActorManager();
60
61public:
62 // virtual functions
63 // NOLINTBEGIN
64 virtual ~ActorManager() = default;
65
66 virtual ::Bedrock::PubSub::Connector<void(::Actor&)>& getRegisterEntityAddedConnector() /*override*/;
67
68 virtual ::Bedrock::PubSub::Connector<void(::Actor&, ::ActorInitializationMethod)>&
69 getRegisterPostReloadActorConnector() /*override*/;
70
71 virtual ::Bedrock::PubSub::Connector<void(::Actor&)>&
72 getRegisterOnRemoveActorEntityReferenceConnector() /*override*/;
73 // NOLINTEND
74
75public:
76 // member functions
77 // NOLINTBEGIN
78 MCAPI ActorManager(
79 ::std::unique_ptr<::IActorManagerProxy> actorManagerProxy,
80 ::Bedrock::NotNullNonOwnerPtr<::ActorGarbageCollector> actorGarbageCollector
81 );
82
83 MCAPI void _onChunkDiscarded(::LevelChunk& levelChunk);
84
85 MCAPI ::Bedrock::Result<::Actor*, ::ActorValidationError>
86 addActorEntity(::IAddActorEntityProxy& addActorEntityProxy, ::OwnerPtr<::EntityContext> entity);
87
88 MCAPI ::Bedrock::Result<::Actor*, ::ActorValidationError>
89 addActorEntity(::Dimension& dimension, ::OwnerPtr<::EntityContext> entity);
90
91 MCAPI ::Bedrock::Result<::Actor*, ::ActorValidationError>
92 addGlobalActorEntity(::IAddActorEntityProxy& addActorEntityProxy, ::OwnerPtr<::EntityContext> entity);
93
94 MCAPI ::Bedrock::Result<::Actor*, ::ActorValidationError>
95 addGlobalActorEntity(::Dimension& dimension, ::OwnerPtr<::EntityContext> entity);
96
97 MCAPI void cleanupActorEntityReferencesGarbageCollect(::OwnerPtr<::EntityContext> entity);
98
99 MCAPI ::OwnerPtr<::EntityContext> deleteActorEntityFromWorldAndTakeEntity(::WeakEntityRef entityRef);
100
101 MCAPI void forceRemoveActor(::Actor& actor);
102
103 MCAPI void forceRemoveActorFromWorld(::Actor& actor);
104
105 MCAPI void registerForLevelChunkEvents(::ILevelChunkEventManagerConnector& levelChunkEventManagerConnector);
106
107 MCAPI ::OwnerPtr<::EntityContext> removeActorEntityAndTakeEntity(::WeakEntityRef entityRef);
108
109#ifdef LL_PLAT_C
110 MCAPI void removeActorEntityReferencesForDeletion(::Actor& actor);
111#endif
112
113 MCAPI ::OwnerPtr<::EntityContext> removeEntity(::WeakEntityRef entityRef);
114
115#ifdef LL_PLAT_C
116 MCAPI void shutdown();
117#endif
118
119 MCAPI ::OwnerPtr<::EntityContext> takeEntity(::WeakEntityRef entityRef, ::LevelChunk& levelChunk);
120 // NOLINTEND
121
122public:
123 // constructor thunks
124 // NOLINTBEGIN
125 MCAPI void* $ctor(
126 ::std::unique_ptr<::IActorManagerProxy> actorManagerProxy,
127 ::Bedrock::NotNullNonOwnerPtr<::ActorGarbageCollector> actorGarbageCollector
128 );
129 // NOLINTEND
130
131public:
132 // virtual function thunks
133 // NOLINTBEGIN
134 MCFOLD ::Bedrock::PubSub::Connector<void(::Actor&)>& $getRegisterEntityAddedConnector();
135
136 MCFOLD ::Bedrock::PubSub::Connector<void(::Actor&, ::ActorInitializationMethod)>&
137 $getRegisterPostReloadActorConnector();
138
139 MCFOLD ::Bedrock::PubSub::Connector<void(::Actor&)>& $getRegisterOnRemoveActorEntityReferenceConnector();
140
141
142 // NOLINTEND
143};
Definition ActorGarbageCollector.h:13
Definition Actor.h:113
Definition Publisher.h:25
Definition Dimension.h:86
Definition EntityContext.h:15
Definition IActorManagerConnector.h:14
Definition IActorManagerProxy.h:14
Definition IAddActorEntityProxy.h:10
Definition ILevelChunkEventManagerConnector.h:14
Definition LevelChunk.h:77
Definition OwnerPtr.h:7
Definition WeakEntityRef.h:14