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