LeviLamina
Loading...
Searching...
No Matches
ScriptBlockCustomComponentsRegistry.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/container/EnumSet.h"
7#include "mc/deps/core/string/HashedString.h"
8#include "mc/deps/core/utility/NonOwnerPointer.h"
9#include "mc/deps/core/utility/pub_sub/Subscription.h"
10#include "mc/deps/scripting/Version.h"
11#include "mc/deps/scripting/lifetime_registry/StrongTypedObjectHandle.h"
12#include "mc/deps/scripting/runtime/Result.h"
13#include "mc/scripting/modules/minecraft/ScriptCustomComponentRegistry.h"
14#include "mc/scripting/modules/minecraft/block/IScriptBlockCustomComponentReader.h"
15#include "mc/scripting/modules/minecraft/events/ScriptBlockCustomComponentEventTypes.h"
16#include "mc/scripting/modules/minecraft/events/ScriptBlockCustomComponentInterface.h"
17#include "mc/scripting/modules/minecraft/events/metadata/ScriptCustomComponentAfterEventList.h"
18#include "mc/scripting/modules/minecraft/events/metadata/ScriptCustomComponentEventMetadata.h"
19#include "mc/world/events/ScriptDeferredEventListener.h"
20
21// auto generated forward declare list
22// clang-format off
23class Block;
25class BlockType;
29namespace BlockEvents { class ActorEvent; }
30namespace BlockEvents { class BlockBreakEvent; }
31namespace BlockEvents { class BlockEntityFallOnEvent; }
32namespace BlockEvents { class BlockPlaceEvent; }
33namespace BlockEvents { class BlockPlayerDestroyEvent; }
34namespace BlockEvents { class BlockPlayerInteractEvent; }
35namespace BlockEvents { class BlockPlayerPlacingEvent; }
36namespace BlockEvents { class BlockQueuedTickEvent; }
37namespace BlockEvents { class BlockRandomTickEvent; }
38namespace BlockEvents { class BlockRandomTickLegacyEvent; }
39namespace BlockEvents { class BlockRedstoneUpdateEvent; }
40namespace BlockEvents { class BlockStepOffEvent; }
41namespace BlockEvents { class BlockStepOnEvent; }
42namespace ScriptModuleMinecraft { class ScriptBlockPermutation; }
43namespace ScriptModuleMinecraft { class ScriptCustomComponentParameterCache; }
44namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentAlreadyRegisteredError; }
45namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentReloadNewComponentError; }
46namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentReloadNewEventError; }
47namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentReloadVersionError; }
48namespace ScriptModuleMinecraft { struct ScriptCustomComponentInvalidRegistryError; }
49namespace ScriptModuleMinecraft { struct ScriptCustomComponentParameters; }
50namespace Scripting { class ModuleBindingBuilder; }
51namespace Scripting { class WeakLifetimeScope; }
52namespace cereal { struct ReflectionCtx; }
53// clang-format on
54
55namespace ScriptModuleMinecraft {
56
57class ScriptBlockCustomComponentsRegistry : public ::ScriptModuleMinecraft::IScriptBlockCustomComponentReader,
60public:
61 // ScriptBlockCustomComponentsRegistry inner types declare
62 // clang-format off
64 // clang-format on
65
66 // ScriptBlockCustomComponentsRegistry inner types define
68 public:
69 // member variables
70 // NOLINTBEGIN
71 ::ll::TypedStorage<2, 2, ::Bedrock::EnumSet<::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes, 13>>
72 mEventsUsed;
73 ::ll::TypedStorage<8, 272, ::std::optional<::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface>>
74 mClosures;
75 ::ll::TypedStorage<8, 40, ::Scripting::Version> mVersionBoundWith;
76 ::ll::TypedStorage<1, 1, bool> mInitialized;
77 ::ll::TypedStorage<1, 1, bool> mUsedByBlock;
78 // NOLINTEND
79
80 public:
81 // member functions
82 // NOLINTBEGIN
83 MCAPI void setClosureData(
86 );
87
89 // NOLINTEND
90
91 public:
92 // destructor thunk
93 // NOLINTBEGIN
94 MCAPI void $dtor();
95 // NOLINTEND
96 };
97
98public:
99 // member variables
100 // NOLINTBEGIN
101 ::ll::TypedStorage<8, 8, ::ScriptDeferredEventCoordinator&> mDeferredEventCoordinator;
102 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::cereal::ReflectionCtx>> mCerealContext;
103 ::ll::TypedStorage<8, 24, ::std::vector<::Bedrock::PubSub::Subscription>> mBlockSubscriptions;
104 ::ll::TypedStorage<
105 8,
106 64,
107 ::std::unordered_map<
110 mComponents;
111 ::ll::TypedStorage<8, 24, ::ScriptModuleMinecraft::ScriptCustomComponentAfterEventList> mAsyncEventQueues;
112 ::ll::TypedStorage<2, 2, ::Bedrock::EnumSet<::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes, 13>>
113 mV1EventSubscriptionList;
114 ::ll::TypedStorage<8, 8, ::ScriptModuleMinecraft::ScriptCustomComponentParameterCache&>
115 mCustomComponentParameterCache;
116 // NOLINTEND
117
118public:
119 // prevent constructor by default
120 ScriptBlockCustomComponentsRegistry& operator=(ScriptBlockCustomComponentsRegistry const&);
121 ScriptBlockCustomComponentsRegistry(ScriptBlockCustomComponentsRegistry const&);
122 ScriptBlockCustomComponentsRegistry();
123
124public:
125 // virtual functions
126 // NOLINTBEGIN
127 virtual void onPreFlushAfterEvents() /*override*/;
128
129 virtual void onFlushBlockCustomComponentAfterEvents(::ScriptDeferredFlushTracker& deferredTracker) /*override*/;
130
131 virtual void onPostFlushAfterEvents() /*override*/;
132
133 virtual void _onScriptInitializationComplete() /*override*/;
134
135 virtual void _onReload() /*override*/;
136
137 virtual ~ScriptBlockCustomComponentsRegistry() /*override*/;
138
139 virtual ::std::vector<::std::string_view> getValidComponentsForBlock(
141 ) const /*override*/;
142
143 virtual ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
144 tryGetCustomComponentParametersForBlock(
145 ::Block const& block,
146 ::std::string_view componentName,
148 ) const /*override*/;
149 // NOLINTEND
150
151public:
152 // member functions
153 // NOLINTBEGIN
154 MCAPI ScriptBlockCustomComponentsRegistry(
156 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
158 );
159
160 MCAPI void _bindComponentToCereal(
161 ::HashedString const& compName,
163 );
164
165 MCAPI ::Scripting::Result<
166 void,
172 _componentRegistrationValidators(
173 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
174 ::HashedString const,
176 compIt,
177 ::HashedString const& name
178 );
179
180 MCAPI ::Scripting::Result<
181 void,
187 _componentRegistrationValidatorsCommon(
188 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
189 ::HashedString const,
191 compIt,
192 ::HashedString const& name
193 );
194
195 MCAPI ::Scripting::Result<
196 void,
202 _componentRegistrationValidatorsV1(
203 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
204 ::HashedString const,
206 compIt,
207 ::HashedString const& name,
209 );
210
211 MCAPI ::Scripting::Result<
212 void,
218 _componentReloadRegistrationValidators(
219 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
220 ::HashedString const,
222 compIt,
223 ::HashedString const& name,
225 );
226
227 MCAPI void _registerBlockForEventing(
228 ::BlockType& block,
229 ::std::vector<::gsl::not_null<::BlockCustomComponentsComponent*>> const& comps
230 );
231
232 MCAPI void beforeOnPlayerPlace(::BlockEvents::BlockPlayerPlacingEvent& eventData) const;
233
234 MCAPI bool
235 hasSubscriptionFor(::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes type, ::Block const& block) const;
236
237 MCAPI bool hasSubscriptionFor(
238 ::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes type,
239 ::BlockCustomComponentsComponent const& customComponents
240 ) const;
241
242 MCAPI void onActor(::BlockEvents::ActorEvent const& eventData) const;
243
244 MCAPI void onBreak(::BlockEvents::BlockBreakEvent const& eventData) const;
245
246 MCAPI void onEntityFallOn(::BlockEvents::BlockEntityFallOnEvent& eventData) const;
247
248 MCAPI void onPlace(::BlockEvents::BlockPlaceEvent const& eventData) const;
249
250 MCAPI void onPlayerBreak(::BlockEvents::BlockPlayerDestroyEvent const& eventData) const;
251
252 MCAPI void onPlayerInteract(::BlockEvents::BlockPlayerInteractEvent& eventData) const;
253
254 MCAPI void onQueuedTick(::BlockEvents::BlockQueuedTickEvent const& eventData) const;
255
256 MCAPI void onRandomTick(::BlockEvents::BlockRandomTickEvent const& eventData) const;
257
258 MCAPI void onRandomTickLegacy(::BlockEvents::BlockRandomTickLegacyEvent const& eventData) const;
259
260 MCAPI void onRedstoneUpdate(::BlockEvents::BlockRedstoneUpdateEvent const& eventData) const;
261
262 MCAPI void onStepOff(::BlockEvents::BlockStepOffEvent const& eventData) const;
263
264 MCAPI void onStepOn(::BlockEvents::BlockStepOnEvent const& eventData) const;
265
266 MCAPI ::Scripting::Result<
267 void,
273 tryRegisterCustomComponent(
274 ::HashedString const& name,
277 );
278
279 MCAPI ::Scripting::Result<
280 void,
286 tryRegisterCustomComponentV1(
287 ::HashedString const& name,
290 );
291 // NOLINTEND
292
293public:
294 // static functions
295 // NOLINTBEGIN
296 MCAPI static ::ScriptModuleMinecraft::ScriptCustomComponentEventMetadata<
298 _getEventMetadata();
299
300 MCAPI static void bind(::Scripting::ModuleBindingBuilder& moduleBuilder);
301 // NOLINTEND
302
303public:
304 // constructor thunks
305 // NOLINTBEGIN
306 MCAPI void* $ctor(
308 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
310 );
311 // NOLINTEND
312
313public:
314 // destructor thunk
315 // NOLINTBEGIN
316 MCAPI void $dtor();
317 // NOLINTEND
318
319public:
320 // virtual function thunks
321 // NOLINTBEGIN
322 MCAPI void $onPreFlushAfterEvents();
323
324 MCAPI void $onFlushBlockCustomComponentAfterEvents(::ScriptDeferredFlushTracker& deferredTracker);
325
326 MCAPI void $onPostFlushAfterEvents();
327
328 MCAPI void $_onScriptInitializationComplete();
329
330 MCAPI void $_onReload();
331
332 MCAPI ::std::vector<::std::string_view> $getValidComponentsForBlock(
334 ) const;
335
336 MCAPI ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
337 $tryGetCustomComponentParametersForBlock(
338 ::Block const& block,
339 ::std::string_view componentName,
341 ) const;
342
343
344 // NOLINTEND
345
346public:
347 // vftables
348 // NOLINTBEGIN
350
352
354 // NOLINTEND
355};
356
357} // namespace ScriptModuleMinecraft
Definition BlockCustomComponentsComponent.h:19
Definition ActorEvent.h:16
Definition BlockBreakEvent.h:17
Definition BlockEntityFallOnEvent.h:17
Definition BlockPlaceEvent.h:16
Definition BlockPlayerDestroyEvent.h:17
Definition BlockPlayerInteractEvent.h:17
Definition BlockPlayerPlacingEvent.h:18
Definition BlockQueuedTickEvent.h:16
Definition BlockRandomTickEvent.h:16
Definition BlockRandomTickLegacyEvent.h:16
Definition BlockRedstoneUpdateEvent.h:15
Definition BlockStepOffEvent.h:16
Definition BlockStepOnEvent.h:16
Definition BlockType.h:84
Definition Block.h:43
Definition HashedString.h:5
Definition ScriptDeferredEventCoordinator.h:18
Definition ScriptDeferredEventListener.h:10
Definition ScriptDeferredFlushTracker.h:13
Definition IScriptBlockCustomComponentReader.h:18
Definition ScriptBlockCustomComponentInterface.h:10
Definition ScriptBlockPermutation.h:24
Definition ScriptCustomComponentParameterCache.h:21
Definition ScriptCustomComponentRegistry.h:10
Definition ModuleBindingBuilder.h:27
Definition StrongTypedObjectHandle.h:8
Definition WeakLifetimeScope.h:7
Definition ScriptBlockCustomComponentAlreadyRegisteredError.h:15
Definition ScriptBlockCustomComponentReloadNewComponentError.h:15
Definition ScriptBlockCustomComponentReloadNewEventError.h:15
Definition ScriptBlockCustomComponentReloadVersionError.h:15
Definition ScriptCustomComponentInvalidRegistryError.h:17
Definition ScriptCustomComponentParameters.h:15
Definition ServerScriptManagerEvents.h:13
Definition ReflectionCtx.h:11