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;
31namespace cereal { struct ReflectionCtx; }
32// clang-format on
33
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, ::gsl::not_null<::cereal::ReflectionCtx*>> mCerealContext;
44 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorComponentFactory>> mComponentFactory;
45 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorGoalFactory>> mGoalFactory;
46 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ActorMigratedDefinitionFactory>> mActorMigratedFactory;
47 // NOLINTEND
48
49public:
50 // prevent constructor by default
52
53public:
54 // virtual functions
55 // NOLINTBEGIN
56 // vIndex: 0
57 virtual ~ActorFactory();
58 // NOLINTEND
59
60public:
61 // member functions
62 // NOLINTBEGIN
63 MCAPI ActorFactory(::cereal::ReflectionCtx& ctx, ::Bedrock::NotNullNonOwnerPtr<::Level> level);
64
65 MCAPI void _buildSummonableActorList(
66 ::Experiments const& experiments,
67 ::std::function<void(::std::string const&, ::ActorFactoryData const&)> callback
68 ) const;
69
70 MCAPI ::OwnerPtr<::EntityContext> _constructActor(
71 ::ActorDefinitionIdentifier const& identifier,
72 ::Vec3 const& position,
73 ::Vec2 const& rotation,
74 ::std::vector<::std::string> const* previousDefinitions
75 ) const;
76
77 MCAPI void _loadDefinitionGroups(::ActorDefinitionGroup* group);
78
79 MCAPI void _loadDefinitionsHelper();
80
81 MCAPI bool _validateActorData(
82 ::CompoundTag& tag,
83 ::ActorDefinitionIdentifier& outDefinition,
84 ::Vec3& outPosition,
85 ::LevelChunk const* levelChunk
86 ) const;
87
88 MCAPI void applyEntityInitializer(::std::unique_ptr<::Actor> actor, ::EntityContext& entity) const;
89
90 MCAPI ::std::vector<::std::pair<::std::string, ::ActorDefinitionIdentifier const*>>
91 buildSummonEntityTypeEnum(::Experiments const& experiments) const;
92
93 MCAPI ::OwnerPtr<::EntityContext> clientCreateDisplayActor(
94 ::ActorDefinitionIdentifier const& identifier,
95 ::Actor* spawner,
96 ::Vec3 const& position,
97 ::Vec2 const& rotation
98 );
99
100 MCAPI ::OwnerPtr<::EntityContext> createActor(
101 ::std::string const& method,
102 ::ActorDefinitionIdentifier const& identifier,
103 ::Actor* spawner,
104 ::Vec3 const& position,
105 ::Vec2 const& rotation
106 );
107
108 MCAPI ::OwnerPtr<::EntityContext> createBornActor(::ActorDefinitionIdentifier const& identifier, ::Actor* parent);
109
110 MCAPI ::OwnerPtr<::EntityContext>
111 createBornActor(::ActorDefinitionIdentifier const& identifier, ::BlockPos const& pos);
112
113 MCAPI ::OwnerPtr<::EntityContext> createSpawnedActor(
114 ::ActorDefinitionIdentifier const& identifier,
115 ::Actor* spawner,
116 ::Vec3 const& position,
117 ::Vec2 const& rotation
118 );
119
120 MCAPI ::OwnerPtr<::EntityContext>
121 createTransformedActor(::ActorDefinitionIdentifier const& identifier, ::Actor* from);
122
123 MCAPI void init(::Experiments const& experiments);
124
125 MCAPI ::OwnerPtr<::EntityContext> loadActor(
126 ::CompoundTag* tag,
127 ::DataLoadHelper& dataLoadHelper,
128 ::DimensionHeightRange const& heightRange,
129 ::LevelChunk const* levelChunk
130 );
131
132 MCAPI ::ActorType lookupEntityType(::ActorDefinitionIdentifier const& identifier) const;
133 // NOLINTEND
134
135public:
136 // static functions
137 // NOLINTBEGIN
138 MCAPI static void fillFactoryData(
139 ::ActorDefinitionIdentifier const& identifier,
140 ::ActorDefinitionIdentifier const& baseIdentifier,
141 ::std::unordered_map<::std::string, ::ActorFactoryData> const& factoryFunctions,
143 );
144
145 MCAPI static void registerEntityMapping(
146 ::ActorType const& actorType,
147 bool allowSummon,
148 ::std::unique_ptr<::Actor> (*const& factory)(
152 ),
153 ::std::optional<int> experimentIndex
154 );
155 // NOLINTEND
156
157public:
158 // static variables
159 // NOLINTBEGIN
160 MCAPI static ::std::vector<::VanillaActorData>& builtinEntityMappings();
161 // NOLINTEND
162
163public:
164 // constructor thunks
165 // NOLINTBEGIN
166 MCAPI void* $ctor(::cereal::ReflectionCtx& ctx, ::Bedrock::NotNullNonOwnerPtr<::Level> level);
167 // NOLINTEND
168
169public:
170 // destructor thunk
171 // NOLINTBEGIN
172 MCAPI void $dtor();
173 // NOLINTEND
174
175public:
176 // vftables
177 // NOLINTBEGIN
178 MCNAPI static void** $vftable();
179 // NOLINTEND
180};
Definition ActorComponentFactory.h:13
Definition ActorDefinitionGroup.h:36
Definition ActorFactory.h:34
static MCAPI void ** $vftable()
Definition ActorGoalFactory.h:13
Definition ActorMigratedDefinitionFactory.h:18
Definition Actor.h:103
Definition BlockPos.h:18
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:74
Definition Level.h:239
Definition Vec2.h:5
Definition Vec3.h:10
Definition ActorDefinitionIdentifier.h:15
Definition ActorFactoryData.h:5
Definition VanillaActorData.h:5
Definition ReflectionCtx.h:11
Definition ctx.h:5