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 VanillaActorData;
31// clang-format on
32
34public:
35 // member variables
36 // NOLINTBEGIN
37 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::Level>> mLevel;
38 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::IEntityInitializer>> mEntityInitializer;
39 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::ActorDefinitionGroup>> mDefinitions;
40 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ActorFactoryData>> mFactoryFunctions;
41 ::ll::TypedStorage<8, 16, ::std::set<::std::string>> mExperimentalEntities;
42 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorComponentFactory>> mComponentFactory;
43 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorGoalFactory>> mGoalFactory;
44 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorMigratedDefinitionFactory>> mActorMigratedFactory;
45 // NOLINTEND
46
47public:
48 // prevent constructor by default
50
51public:
52 // virtual functions
53 // NOLINTBEGIN
54 // vIndex: 0
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 void init(::Experiments const& experiments);
125
126 MCAPI ::OwnerPtr<::EntityContext> loadActor(
127 ::CompoundTag* tag,
128 ::DataLoadHelper& dataLoadHelper,
129 ::DimensionHeightRange const& heightRange,
130 ::LevelChunk const* levelChunk
131 );
132
133 MCAPI ::ActorType lookupEntityType(::ActorDefinitionIdentifier const& identifier) const;
134 // NOLINTEND
135
136public:
137 // static functions
138 // NOLINTBEGIN
139 MCAPI static void fillFactoryData(
140 ::ActorDefinitionIdentifier const& identifier,
141 ::ActorDefinitionIdentifier const& baseIdentifier,
142 ::std::unordered_map<::std::string, ::ActorFactoryData> const& factoryFunctions,
144 );
145
146 MCAPI static void registerEntityMapping(
147 ::ActorType const& actorType,
148 bool allowSummon,
149 ::std::unique_ptr<::Actor> (*const& factory)(
153 ),
154 ::std::optional<int> experimentIndex
155 );
156 // NOLINTEND
157
158public:
159 // static variables
160 // NOLINTBEGIN
161 MCAPI static ::std::vector<::VanillaActorData>& builtinEntityMappings();
162 // NOLINTEND
163
164public:
165 // constructor thunks
166 // NOLINTBEGIN
167 MCAPI void* $ctor(::Bedrock::NotNullNonOwnerPtr<::Level> level);
168 // NOLINTEND
169
170public:
171 // destructor thunk
172 // NOLINTBEGIN
173 MCAPI void $dtor();
174 // NOLINTEND
175
176public:
177 // vftables
178 // NOLINTBEGIN
179 MCNAPI static void** $vftable();
180 // NOLINTEND
181};
Definition ActorComponentFactory.h:13
Definition ActorDefinitionGroup.h:32
Definition ActorFactory.h:33
static MCAPI void ** $vftable()
Definition ActorGoalFactory.h:8
Definition ActorMigratedDefinitionFactory.h:27
Definition Actor.h:102
Definition BlockPos.h:17
Definition CompoundTag.h:13
Definition DataLoadHelper.h:20
Definition DimensionHeightRange.h:5
Definition EntityContext.h:16
Definition Experiments.h:14
Definition IEntityInitializer.h:11
Definition LevelChunk.h:77
Definition Level.h:243
Definition Vec2.h:5
Definition Vec3.h:10
Definition ActorDefinitionIdentifier.h:15
Definition ActorFactoryData.h:5
Definition VanillaActorData.h:5