LeviLamina
Loading...
Searching...
No Matches
ActorFactory.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/game_refs/OwnerPtr.h"
8#include "mc/world/actor/ActorType.h"
9
10// auto generated forward declare list
11// clang-format off
12class Actor;
17class BlockPos;
18class CompoundTag;
19class DataLoadHelper;
21class EntityContext;
22class Experiments;
24class Level;
25class LevelChunk;
26class Vec2;
27class Vec3;
29struct ActorFactoryData;
30struct ActorInfo;
31struct VanillaActorData;
32// clang-format on
33
34class ActorFactory {
35public:
36 // member variables
37 // NOLINTBEGIN
38 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Level>> mLevel;
39 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::IEntityInitializer>> mEntityInitializer;
40 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::ActorDefinitionGroup>> mDefinitions;
41 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ActorFactoryData>> mFactoryFunctions;
42 ::ll::TypedStorage<8, 16, ::std::set<::std::string>> mExperimentalEntities;
43 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorComponentFactory>> mComponentFactory;
44 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorGoalFactory>> mGoalFactory;
45 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorMigratedDefinitionFactory>> mActorMigratedFactory;
46 // NOLINTEND
47
48public:
49 // prevent constructor by default
50 ActorFactory();
51
52public:
53 // virtual functions
54 // NOLINTBEGIN
55 virtual ~ActorFactory();
56 // NOLINTEND
57
58public:
59 // member functions
60 // NOLINTBEGIN
61 MCAPI explicit ActorFactory(::Bedrock::NotNullNonOwnerPtr<::Level> level);
62
63 MCAPI void _buildSummonableActorList(
64 ::Experiments const& experiments,
65 ::std::function<void(::std::string const&, ::ActorFactoryData const&)> callback
66 ) const;
67
68 MCAPI ::OwnerPtr<::EntityContext> _constructActor(
69 ::ActorDefinitionIdentifier const& identifier,
70 ::Vec3 const& position,
71 ::Vec2 const& rotation,
72 ::std::vector<::std::string> const* previousDefinitions
73 ) const;
74
75 MCAPI void _loadDefinitionGroups(::ActorDefinitionGroup* group);
76
77 MCAPI void _loadDefinitionsHelper();
78
79 MCAPI bool _validateActorData(
80 ::CompoundTag& tag,
81 ::ActorDefinitionIdentifier& outDefinition,
82 ::Vec3& outPosition,
83 ::LevelChunk const* levelChunk
84 ) const;
85
86 MCAPI void applyEntityInitializer(::std::unique_ptr<::Actor> actor, ::EntityContext& entity) const;
87
88 MCAPI ::std::vector<::std::pair<::std::string, ::ActorDefinitionIdentifier const*>>
89 buildSummonEntityTypeEnum(::Experiments const& experiments) const;
90
91 MCAPI ::OwnerPtr<::EntityContext> clientCreateDisplayActor(
92 ::ActorDefinitionIdentifier const& identifier,
93 ::Actor* spawner,
94 ::Vec3 const& position,
95 ::Vec2 const& rotation
96 );
97
98 MCAPI ::OwnerPtr<::EntityContext> createActor(
99 ::std::string const& method,
100 ::ActorDefinitionIdentifier const& identifier,
101 ::Actor* spawner,
102 ::Vec3 const& position,
103 ::Vec2 const& rotation
104 );
105
106 MCAPI ::OwnerPtr<::EntityContext> createBornActor(::ActorDefinitionIdentifier const& identifier, ::Actor* parent);
107
108 MCAPI ::OwnerPtr<::EntityContext>
109 createBornActor(::ActorDefinitionIdentifier const& identifier, ::BlockPos const& pos);
110
111 MCAPI ::OwnerPtr<::EntityContext> createSpawnedActor(
112 ::ActorDefinitionIdentifier const& identifier,
113 ::Actor* spawner,
114 ::Vec3 const& position,
115 ::Vec2 const& rotation
116 );
117
118 MCAPI ::OwnerPtr<::EntityContext>
119 createSummonedActor(::ActorDefinitionIdentifier const& identifier, ::Actor* spawner, ::Vec3 const& position);
120
121 MCAPI ::OwnerPtr<::EntityContext>
122 createTransformedActor(::ActorDefinitionIdentifier const& identifier, ::Actor* from);
123
124 MCAPI_C void digestIdentifierListFromServer(::std::vector<::ActorInfo> const& identifierList);
125
126 MCAPI ::ActorComponentFactory& getComponentFactory() const;
127
128 MCAPI void init(::Experiments const& experiments);
129
130 MCAPI ::OwnerPtr<::EntityContext> loadActor(
131 ::CompoundTag* tag,
132 ::DataLoadHelper& dataLoadHelper,
133 ::DimensionHeightRange const& heightRange,
134 ::LevelChunk const* levelChunk
135 );
136
137 MCAPI ::ActorType lookupEntityType(::ActorDefinitionIdentifier const& identifier) const;
138
139 MCAPI_C void setEntityInitializer(::std::shared_ptr<::IEntityInitializer> entityInitializer);
140 // NOLINTEND
141
142public:
143 // static functions
144 // NOLINTBEGIN
145 MCAPI static void fillFactoryData(
146 ::ActorDefinitionIdentifier const& identifier,
147 ::ActorDefinitionIdentifier const& baseIdentifier,
148 ::std::unordered_map<::std::string, ::ActorFactoryData> const& factoryFunctions,
150 );
151
152 MCAPI static void registerEntityMapping(
153 ::ActorType const& actorType,
154 bool allowSummon,
155 ::std::unique_ptr<::Actor> (*const& factory)(
159 ),
160 ::std::optional<int> experimentIndex
161 );
162 // NOLINTEND
163
164public:
165 // static variables
166 // NOLINTBEGIN
167 MCAPI static ::std::vector<::VanillaActorData>& builtinEntityMappings();
168 // NOLINTEND
169
170public:
171 // constructor thunks
172 // NOLINTBEGIN
173 MCAPI void* $ctor(::Bedrock::NotNullNonOwnerPtr<::Level> level);
174 // NOLINTEND
175
176public:
177 // destructor thunk
178 // NOLINTBEGIN
179 MCAPI void $dtor();
180 // NOLINTEND
181
182public:
183 // vftables
184 // NOLINTBEGIN
185 MCNAPI static void** $vftable();
186 // NOLINTEND
187};
Definition ActorComponentFactory.h:13
Definition ActorDefinitionGroup.h:35
static MCAPI void ** $vftable()
Definition ActorGoalFactory.h:8
Definition ActorMigratedDefinitionFactory.h:32
Definition Actor.h:105
Definition BlockPos.h:19
Definition CompoundTag.h:23
Definition DataLoadHelper.h:20
Definition DimensionHeightRange.h:5
Definition EntityContext.h:16
Definition Experiments.h:14
Definition IEntityInitializer.h:11
Definition LevelChunk.h:79
Definition Level.h:249
Definition Vec2.h:5
Definition Vec3.h:10
Definition ActorDefinitionIdentifier.h:15
Definition ActorFactoryData.h:16
Definition ActorInfo.h:13
Definition VanillaActorData.h:16