LeviLamina
Loading...
Searching...
No Matches
ScriptItemCustomComponentRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/string/HashedString.h"
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8#include "mc/deps/core/utility/pub_sub/Subscription.h"
9#include "mc/deps/script_core/lifetime_registry/scripting/StrongTypedObjectHandle.h"
10#include "mc/deps/script_core/lifetime_registry/scripting/WeakTypedObjectHandle.h"
11#include "mc/deps/script_core/runtime/scripting/Result.h"
12#include "mc/deps/script_core/scripting/Version.h"
13#include "mc/scripting/modules/minecraft/events/ScriptItemCustomComponentClosureFlags.h"
14#include "mc/scripting/modules/minecraft/items/IScriptItemCustomComponentRegistry.h"
15#include "mc/world/item/registry/ItemRegistryRef.h"
16
17// auto generated forward declare list
18// clang-format off
22namespace ScriptModuleMinecraft { class IScriptItemCustomComponentSignalCollection; }
23namespace ScriptModuleMinecraft { class ScriptCustomComponentParameterCache; }
24namespace ScriptModuleMinecraft { class ScriptItemCustomComponentInterface; }
25namespace ScriptModuleMinecraft { class ScriptItemStack; }
26namespace ScriptModuleMinecraft { struct ScriptCustomComponentInvalidRegistryError; }
27namespace ScriptModuleMinecraft { struct ScriptCustomComponentParameters; }
28namespace ScriptModuleMinecraft { struct ScriptItemCustomComponentAlreadyRegisteredError; }
29namespace ScriptModuleMinecraft { struct ScriptItemCustomComponentReloadNewComponentError; }
30namespace ScriptModuleMinecraft { struct ScriptItemCustomComponentReloadNewEventError; }
31namespace ScriptModuleMinecraft { struct ScriptItemCustomComponentReloadVersionError; }
32namespace Scripting { class WeakLifetimeScope; }
33namespace cereal { struct ReflectionCtx; }
34// clang-format on
35
36namespace ScriptModuleMinecraft {
37
38class ScriptItemCustomComponentRegistry : public ::ScriptModuleMinecraft::IScriptItemCustomComponentRegistry {
39public:
40 // ScriptItemCustomComponentRegistry inner types declare
41 // clang-format off
42 struct ComponentInfo;
43 // clang-format on
44
45 // ScriptItemCustomComponentRegistry inner types define
47 public:
48 // member variables
49 // NOLINTBEGIN
50 ::ll::TypedStorage<1, 1, bool> mRegistered;
51 ::ll::TypedStorage<8, 40, ::Scripting::Version> mClosureFlagsVersion;
52 ::ll::TypedStorage<2, 2, ::ScriptModuleMinecraft::ScriptItemCustomComponentClosureFlags> mClosureFlags;
53 // NOLINTEND
54 };
55
56public:
57 // member variables
58 // NOLINTBEGIN
59 ::ll::TypedStorage<
60 8,
61 64,
62 ::std::unordered_map<::HashedString, ::ScriptModuleMinecraft::ScriptItemCustomComponentRegistry::ComponentInfo>>
63 mKnownComponents;
64 ::ll::TypedStorage<8, 8, ::ScriptDeferredEventCoordinator&> mDeferredEventCoordinator;
65 ::ll::TypedStorage<8, 16, ::ItemRegistryRef const> mItemRegistry;
66 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mItemRegistryInitSubscription;
67 ::ll::TypedStorage<8, 8, ::ScriptModuleMinecraft::ScriptCustomComponentParameterCache&> mParameterCache;
68 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptModuleMinecraft::IScriptItemCustomComponentSignalCollection>>
69 mSignals;
70 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::cereal::ReflectionCtx>> mCerealContext;
71 // NOLINTEND
72
73public:
74 // prevent constructor by default
75 ScriptItemCustomComponentRegistry& operator=(ScriptItemCustomComponentRegistry const&);
76 ScriptItemCustomComponentRegistry(ScriptItemCustomComponentRegistry const&);
77 ScriptItemCustomComponentRegistry();
78
79public:
80 // virtual functions
81 // NOLINTBEGIN
82 virtual ~ScriptItemCustomComponentRegistry() /*override*/ = default;
83
84 virtual ::Scripting::Result<
85 void,
91 tryRegisterComponentV1(
92 ::HashedString const& componentName,
94 ) /*override*/;
95
96 virtual ::Scripting::Result<
97 void,
103 tryRegisterComponent(
104 ::HashedString const& componentName,
106 ) /*override*/;
107
108 virtual ::std::vector<::std::string_view> getValidComponentsForItem(
110 ) const /*override*/;
111
112 virtual ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
113 tryGetCustomComponentParametersForItem(
115 ::std::string_view componentName,
117 ) const /*override*/;
118
119 virtual ::ScriptDeferredEventListener& getEventListener() /*override*/;
120
121 virtual void setCerealContext(::cereal::ReflectionCtx& ctx) /*override*/;
122
123 virtual void _onReload() /*override*/;
124
125 virtual void _onScriptInitializationComplete() /*override*/;
126 // NOLINTEND
127
128public:
129 // member functions
130 // NOLINTBEGIN
131 MCAPI ScriptItemCustomComponentRegistry(
133 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
134 ::ItemRegistryRef itemRegistry,
135 ::std::unique_ptr<::ScriptModuleMinecraft::IScriptItemCustomComponentSignalCollection>&& signals,
137 );
138
139 MCAPI void _subscribeItemsToComponents();
140
141 MCAPI ::Scripting::Result<
142 void,
148 _tryRegisterComponent(
149 ::HashedString const& componentName,
151 );
152 // NOLINTEND
153
154public:
155 // constructor thunks
156 // NOLINTBEGIN
157 MCAPI void* $ctor(
159 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
160 ::ItemRegistryRef itemRegistry,
161 ::std::unique_ptr<::ScriptModuleMinecraft::IScriptItemCustomComponentSignalCollection>&& signals,
163 );
164 // NOLINTEND
165
166public:
167 // virtual function thunks
168 // NOLINTBEGIN
169 MCAPI ::Scripting::Result<
170 void,
176 $tryRegisterComponentV1(
177 ::HashedString const& componentName,
179 );
180
181 MCAPI ::Scripting::Result<
182 void,
188 $tryRegisterComponent(
189 ::HashedString const& componentName,
191 );
192
193 MCAPI ::std::vector<::std::string_view> $getValidComponentsForItem(
195 ) const;
196
197 MCAPI ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
198 $tryGetCustomComponentParametersForItem(
200 ::std::string_view componentName,
202 ) const;
203
204#ifdef LL_PLAT_S
205 MCAPI ::ScriptDeferredEventListener& $getEventListener();
206#else // LL_PLAT_C
207 MCFOLD ::ScriptDeferredEventListener& $getEventListener();
208#endif
209
210 MCAPI void $setCerealContext(::cereal::ReflectionCtx& ctx);
211
212 MCAPI void $_onReload();
213
214 MCAPI void $_onScriptInitializationComplete();
215
216
217 // NOLINTEND
218};
219
220} // namespace ScriptModuleMinecraft
Definition HashedString.h:5
Definition ItemRegistryRef.h:42
Definition ScriptDeferredEventCoordinator.h:18
Definition ScriptDeferredEventListener.h:10
Definition IScriptItemCustomComponentRegistry.h:20
Definition IScriptItemCustomComponentSignalCollection.h:18
Definition ScriptCustomComponentParameterCache.h:21
Definition ScriptItemCustomComponentInterface.h:15
Definition ScriptItemStack.h:31
Definition WeakLifetimeScope.h:7
Definition WeakTypedObjectHandle.h:8
Definition ScriptCustomComponentInvalidRegistryError.h:17
Definition ScriptCustomComponentParameters.h:15
Definition ScriptItemCustomComponentAlreadyRegisteredError.h:15
Definition ScriptItemCustomComponentRegistry.h:46
Definition ScriptItemCustomComponentReloadNewComponentError.h:15
Definition ScriptItemCustomComponentReloadNewEventError.h:15
Definition ScriptItemCustomComponentReloadVersionError.h:16
Definition ServerScriptManagerEvents.h:13
Definition ReflectionCtx.h:11
Definition ctx.h:5