LeviLamina
Loading...
Searching...
No Matches
ActorDefinitionGroup.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/debug/log/LogArea.h"
7#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
8#include "mc/deps/core/utility/NonOwnerPointer.h"
9#include "mc/deps/puv/LoadResult.h"
10#include "mc/deps/puv/puv_load_data/LoadResultWithTiming.h"
11#include "mc/platform/threading/Mutex.h"
12#include "mc/resources/JsonBetaState.h"
13#include "mc/world/actor/ActorDefinitionParseStatus.h"
14#include "mc/world/actor/ActorDefinitionPtr.h"
15#include "mc/world/level/storage/Experiments.h"
16
17// auto generated forward declare list
18// clang-format off
20class ActorDefinition;
23class Level;
25class PackInstance;
27class SemVersion;
28namespace Core { class Path; }
29namespace Json { class Value; }
30namespace Puv { class Input; }
31namespace SharedTypes::v1_21_130 { struct ActorDefinitions; }
32namespace SharedTypes::v1_21_130 { struct ActorDocument; }
33// clang-format on
34
35class ActorDefinitionGroup : public ::Bedrock::EnableNonOwnerReferences {
36public:
37 // ActorDefinitionGroup inner types declare
38 // clang-format off
39 struct EDLWrapper;
40 struct LoadActorResult;
41 // clang-format on
42
43 // ActorDefinitionGroup inner types define
44 enum class LoadStatus : int {
45 Success = 0,
46 FailedToParseIdentifier = 1,
47 InvalidNamespaceInIdentifier = 2,
48 DefinitionAlreadyDefined = 3,
49 FailedToLoadFromJSON = 4,
50 InvalidIdentifier = 5,
51 };
52
53 struct EDLWrapper {
54 public:
55 // member variables
56 // NOLINTBEGIN
57 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::ActorDefinition>>> mList;
58 // NOLINTEND
59 };
60
62 public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<4, 4, ::ActorDefinitionGroup::LoadStatus> mLoadStatus;
66 ::ll::TypedStorage<8, 32, ::std::string> mActorId;
67 ::ll::TypedStorage<1, 1, bool> mIsVanillaOverride;
68 ::ll::TypedStorage<8, 32, ::PuvLoadData::LoadResultWithTiming> mLoadTime;
69 // NOLINTEND
70
71 public:
72 // member functions
73 // NOLINTBEGIN
74 MCAPI ~LoadActorResult();
75 // NOLINTEND
76
77 public:
78 // destructor thunk
79 // NOLINTBEGIN
80 MCFOLD void $dtor();
81 // NOLINTEND
82 };
83
84 using ActorDefinitionList = ::std::unordered_map<::std::string, ::std::unique_ptr<::ActorDefinition>>;
85
86public:
87 // member variables
88 // NOLINTBEGIN
89 ::ll::TypedStorage<8, 64, ::std::unordered_set<::ActorDefinitionPtr*>> mRegisteredPtrs;
90 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::std::unique_ptr<::ActorDefinition>>> mDefinitions;
91 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ActorDefinitionGroup::EDLWrapper>> mTemplateMap;
92 ::ll::TypedStorage<8, 8, ::ResourcePackManager&> mResourcePackManager;
93 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::LinkedAssetValidator>> mLinkedAssetValidator;
94 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mReferenceMutex;
95 ::ll::TypedStorage<8, 8, ::IMinecraftEventing&> mEventing;
96 ::ll::TypedStorage<8, 8, ::ActorComponentFactory*> mComponentFactory;
97 ::ll::TypedStorage<8, 72, ::Experiments> mExperiments;
98 // NOLINTEND
99
100public:
101 // prevent constructor by default
102 ActorDefinitionGroup& operator=(ActorDefinitionGroup const&);
103 ActorDefinitionGroup(ActorDefinitionGroup const&);
104 ActorDefinitionGroup();
105
106public:
107 // virtual functions
108 // NOLINTBEGIN
109 virtual ~ActorDefinitionGroup() /*override*/;
110 // NOLINTEND
111
112public:
113 // member functions
114 // NOLINTBEGIN
115 MCAPI ActorDefinitionGroup(
116 ::Level& level,
117 ::ResourcePackManager& resourcePackManager,
118 ::IMinecraftEventing& eventing,
119 ::Experiments const& experiments,
121 );
122
123 MCAPI void _getResources(::Level& level);
124
125 MCAPI ::Puv::LoadResult<::SharedTypes::v1_21_130::ActorDocument> _initActorDefinition(
126 ::Puv::Input const& input,
127 ::SemVersion const& formatVersion,
128 ::IPackLoadContext& packLoadContext,
129 ::std::string const& relativeResourceFilepath,
130 ::JsonBetaState useBetaFeatures,
131 ::std::string const& identifier,
132 ::Level& level,
133 ::LogArea logArea
134 );
135
136 MCAPI ::ActorDefinitionGroup::LoadActorResult _loadActorDefinition(
137 ::Level& level,
138 ::IPackLoadContext& packLoadContext,
139 ::std::string const& relativeResourceFilepath,
140 ::Json::Value& root,
141 ::std::unordered_set<::std::string>& definitions,
142 ::LogArea logArea
143 );
144
145 MCAPI ::Puv::LoadResult<::SharedTypes::v1_21_130::ActorDocument> _loadDefinitionFromJSON(
146 ::SemVersion const& formatVersion,
147 ::IPackLoadContext& packLoadContext,
148 ::std::string const& relativeResourceFilepath,
149 ::Json::Value minecraftEntityNode,
150 ::JsonBetaState useBetaFeatures,
151 ::std::string const& identifier,
152 ::Level& level,
153 ::LogArea logArea
154 );
155
156 MCAPI ::ActorDefinitionParseStatus _loadTemplates(
157 ::Level& level,
158 ::std::string const& base,
159 ::std::unordered_map<::std::string, ::SharedTypes::v1_21_130::ActorDefinitions>& componentsGroup,
160 ::SemVersion const& formatVersion,
161 ::IPackLoadContext const& packLoadContext,
162 ::JsonBetaState useBetaFeatures
163 );
164
165 MCAPI void _removeRef(::ActorDefinitionPtr& ptr);
166
167 MCAPI void _setupCommonResourceDefinitionMap(::ActorDefinition& def, ::Level& level);
168
169 MCAPI void _setupPropertyGroups(::Level& level, ::ActorDefinition const& def);
170
171 MCAPI ::std::vector<::std::string> buildActorEventList() const;
172
173 MCAPI ::ActorDefinitionPtr tryGetDefinition(::std::string const& definitionId);
174
175 MCAPI ::ActorDefinitionPtr tryGetDefinitionGroup(::std::string const& base, ::std::string const& definitionId);
176 // NOLINTEND
177
178public:
179 // static functions
180 // NOLINTBEGIN
181 MCAPI static void
182 filterBalloonableComponent(::std::string const& idToExclude, ::std::string const& currentId, ::Json::Value& root);
183
184 MCAPI static void forEachComponentOf(
185 ::Json::Value& entityValue,
186 ::std::string const& componentName,
187 ::std::function<void(::Json::Value&, ::Json::Value&)> const& callback
188 );
189
190 MCAPI static bool loadActorDefinitionIdentifier(
191 ::Json::Value const& root,
192 ::SemVersion const& formatVersion,
193 ::std::string& identifier
194 );
195
196 MCAPI static bool loadActorDefinitionRuntimeIdentifier(
197 ::Json::Value const& root,
198 ::SemVersion const& formatVersion,
199 ::std::string& runtimeIdentifier
200 );
201
202 MCAPI static bool
203 tryReadEntityResourceFile(::PackInstance& packInstance, ::Core::Path const& resource, ::Json::Value& outputRoot);
204 // NOLINTEND
205
206public:
207 // constructor thunks
208 // NOLINTBEGIN
209 MCAPI void* $ctor(
210 ::Level& level,
211 ::ResourcePackManager& resourcePackManager,
212 ::IMinecraftEventing& eventing,
213 ::Experiments const& experiments,
215 );
216 // NOLINTEND
217
218public:
219 // destructor thunk
220 // NOLINTBEGIN
221 MCAPI void $dtor();
222 // NOLINTEND
223
224public:
225 // vftables
226 // NOLINTBEGIN
227 MCAPI static void** $vftable();
228 // NOLINTEND
229};
Definition ActorComponentFactory.h:13
Definition ActorDefinitionPtr.h:11
Definition ActorDefinition.h:80
Definition EnableNonOwnerReferences.h:7
static MCAPI void ** $vftable()
Definition NonOwnerPointer.h:9
Definition Path.h:10
Definition Experiments.h:14
Definition IMinecraftEventing.h:137
Definition IPackLoadContext.h:20
Definition Value.h:16
Definition Level.h:249
Definition LinkedAssetValidator.h:8
Definition PackInstance.h:16
Definition Input.h:15
Definition ResourcePackManager.h:29
Definition SemVersion.h:15
Definition ActorDefinitionGroup.h:53
Definition ActorDefinitionGroup.h:61
Definition ActorDefinitions.h:15
Definition ActorDocument.h:16