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/utility/NonOwnerPointer.h"
8#include "mc/deps/core/utility/pub_sub/Subscription.h"
9#include "mc/deps/scripting/Version.h"
10#include "mc/deps/scripting/lifetime_registry/StrongTypedObjectHandle.h"
11#include "mc/deps/scripting/runtime/Result.h"
12#include "mc/scripting/modules/minecraft/ScriptCustomComponentRegistry.h"
13#include "mc/scripting/modules/minecraft/block/IScriptBlockCustomComponentReader.h"
14#include "mc/scripting/modules/minecraft/events/ScriptBlockCustomComponentEventTypes.h"
15#include "mc/scripting/modules/minecraft/events/ScriptBlockCustomComponentInterface.h"
16#include "mc/scripting/modules/minecraft/events/metadata/ScriptCustomComponentAfterEventList.h"
17#include "mc/scripting/modules/minecraft/events/metadata/ScriptCustomComponentEventMetadata.h"
18#include "mc/world/events/ScriptDeferredEventListener.h"
19
20// auto generated forward declare list
21// clang-format off
22class Block;
24class BlockPos;
25class BlockType;
26class HashedString;
27class IBlockSource;
31namespace BlockEvents { class BlockBreakEvent; }
32namespace BlockEvents { class BlockEntityFallOnEvent; }
33namespace BlockEvents { class BlockPlaceEvent; }
34namespace BlockEvents { class BlockPlayerDestroyEvent; }
35namespace BlockEvents { class BlockPlayerInteractEvent; }
36namespace BlockEvents { class BlockPlayerPlacingEvent; }
37namespace BlockEvents { class BlockQueuedTickEvent; }
38namespace BlockEvents { class BlockRandomTickEvent; }
39namespace BlockEvents { class BlockRandomTickLegacyEvent; }
40namespace BlockEvents { class BlockRedstoneUpdateEvent; }
41namespace BlockEvents { class BlockStepOffEvent; }
42namespace BlockEvents { class BlockStepOnEvent; }
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, 12>>
72 mEventsUsed;
73 ::ll::TypedStorage<8, 256, ::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, 12>>
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 ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
140 tryGetCustomComponentParametersForItem(
141 ::IBlockSource const& region,
142 ::BlockPos blockPos,
143 ::std::string_view componentName,
145 ) const /*override*/;
146 // NOLINTEND
147
148public:
149 // member functions
150 // NOLINTBEGIN
151 MCAPI ScriptBlockCustomComponentsRegistry(
153 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
155 );
156
157 MCAPI void _bindComponentToCereal(
158 ::HashedString const& compName,
160 );
161
162 MCAPI ::Scripting::Result<
163 void,
169 _componentRegistrationValidators(
170 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
171 ::HashedString const,
173 compIt,
174 ::HashedString const& name
175 );
176
177 MCAPI ::Scripting::Result<
178 void,
184 _componentRegistrationValidatorsCommon(
185 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
186 ::HashedString const,
188 compIt,
189 ::HashedString const& name
190 );
191
192 MCAPI ::Scripting::Result<
193 void,
199 _componentRegistrationValidatorsV1(
200 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
201 ::HashedString const,
203 compIt,
204 ::HashedString const& name,
206 );
207
208 MCAPI ::Scripting::Result<
209 void,
215 _componentReloadRegistrationValidators(
216 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
217 ::HashedString const,
219 compIt,
220 ::HashedString const& name,
222 );
223
224 MCAPI void _registerBlockForEventing(
225 ::BlockType& block,
226 ::std::vector<::gsl::not_null<::BlockCustomComponentsComponent*>> const& comps
227 );
228
229 MCAPI void beforeOnPlayerPlace(::BlockEvents::BlockPlayerPlacingEvent& eventData) const;
230
231 MCAPI bool
232 hasSubscriptionFor(::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes type, ::Block const& block) const;
233
234 MCAPI bool hasSubscriptionFor(
235 ::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes type,
236 ::BlockCustomComponentsComponent const& customComponents
237 ) const;
238
239 MCAPI void onBreak(::BlockEvents::BlockBreakEvent const& eventData) const;
240
241 MCAPI void onEntityFallOn(::BlockEvents::BlockEntityFallOnEvent& eventData) const;
242
243 MCAPI void onPlace(::BlockEvents::BlockPlaceEvent const& eventData) const;
244
245 MCAPI void onPlayerBreak(::BlockEvents::BlockPlayerDestroyEvent const& eventData) const;
246
247 MCAPI void onPlayerInteract(::BlockEvents::BlockPlayerInteractEvent& eventData) const;
248
249 MCAPI void onQueuedTick(::BlockEvents::BlockQueuedTickEvent const& eventData) const;
250
251 MCAPI void onRandomTick(::BlockEvents::BlockRandomTickEvent const& eventData) const;
252
253 MCAPI void onRandomTickLegacy(::BlockEvents::BlockRandomTickLegacyEvent const& eventData) const;
254
255 MCAPI void onRedstoneUpdate(::BlockEvents::BlockRedstoneUpdateEvent const& eventData) const;
256
257 MCAPI void onStepOff(::BlockEvents::BlockStepOffEvent const& eventData) const;
258
259 MCAPI void onStepOn(::BlockEvents::BlockStepOnEvent const& eventData) const;
260
261 MCAPI ::Scripting::Result<
262 void,
268 tryRegisterCustomComponent(
269 ::HashedString const& name,
272 );
273
274 MCAPI ::Scripting::Result<
275 void,
281 tryRegisterCustomComponentV1(
282 ::HashedString const& name,
285 );
286 // NOLINTEND
287
288public:
289 // static functions
290 // NOLINTBEGIN
291 MCAPI static ::ScriptModuleMinecraft::ScriptCustomComponentEventMetadata<
293 _getEventMetadata();
294
295 MCAPI static void bind(::Scripting::ModuleBindingBuilder& moduleBuilder);
296 // NOLINTEND
297
298public:
299 // constructor thunks
300 // NOLINTBEGIN
301 MCAPI void* $ctor(
303 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
305 );
306 // NOLINTEND
307
308public:
309 // destructor thunk
310 // NOLINTBEGIN
311 MCAPI void $dtor();
312 // NOLINTEND
313
314public:
315 // virtual function thunks
316 // NOLINTBEGIN
317 MCAPI void $onPreFlushAfterEvents();
318
319 MCAPI void $onFlushBlockCustomComponentAfterEvents(::ScriptDeferredFlushTracker& deferredTracker);
320
321 MCAPI void $onPostFlushAfterEvents();
322
323 MCAPI void $_onScriptInitializationComplete();
324
325 MCAPI void $_onReload();
326
327 MCAPI ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
328 $tryGetCustomComponentParametersForItem(
329 ::IBlockSource const& region,
330 ::BlockPos blockPos,
331 ::std::string_view componentName,
333 ) const;
334
335
336 // NOLINTEND
337
338public:
339 // vftables
340 // NOLINTBEGIN
342
344
346 // NOLINTEND
347};
348
349} // namespace ScriptModuleMinecraft
Definition BlockCustomComponentsComponent.h:19
Definition BlockBreakEvent.h:17
Definition BlockEntityFallOnEvent.h:16
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 BlockPos.h:19
Definition BlockType.h:84
Definition Block.h:43
Definition HashedString.h:5
Definition IBlockSource.h:37
Definition ScriptDeferredEventCoordinator.h:18
Definition ScriptDeferredEventListener.h:10
Definition ScriptDeferredFlushTracker.h:13
Definition IScriptBlockCustomComponentReader.h:18
Definition ScriptBlockCustomComponentInterface.h:10
Definition ScriptCustomComponentParameterCache.h:21
Definition ScriptCustomComponentRegistry.h:10
Definition ModuleBindingBuilder.h:27
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