Skip to content
LeviMC
English
AutoLightDark
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/script_core/lifetime_registry/scripting/StrongTypedObjectHandle.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/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 BlockNeighborChangedEvent; }
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 BlockStateChangeEvent; }
42namespace BlockEvents { class BlockStepOffEvent; }
43namespace BlockEvents { class BlockStepOnEvent; }
44namespace BlockEvents { class NamedTickEvent; }
45namespace Json { class Value; }
46namespace ScriptModuleMinecraft { class ScriptBlockPermutation; }
47namespace ScriptModuleMinecraft { class ScriptCustomComponentParameterCache; }
48namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentAlreadyRegisteredError; }
49namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentReloadNewComponentError; }
50namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentReloadNewEventError; }
51namespace ScriptModuleMinecraft { struct ScriptBlockCustomComponentReloadVersionError; }
52namespace ScriptModuleMinecraft { struct ScriptCustomComponentInvalidRegistryError; }
53namespace ScriptModuleMinecraft { struct ScriptCustomComponentParameters; }
54namespace Scripting { class ModuleBindingBuilder; }
55namespace Scripting { class WeakLifetimeScope; }
56namespace Scripting { struct ModuleDescriptor; }
57namespace cereal { struct ReflectionCtx; }
58// clang-format on
59
60namespace ScriptModuleMinecraft {
61
62class ScriptBlockCustomComponentsRegistry : public ::ScriptModuleMinecraft::IScriptBlockCustomComponentReader,
65public:
66 // ScriptBlockCustomComponentsRegistry inner types declare
67 // clang-format off
69 // clang-format on
70
71 // ScriptBlockCustomComponentsRegistry inner types define
73 public:
74 // member variables
75 // NOLINTBEGIN
76 ::ll::TypedStorage<2, 2, ::Bedrock::EnumSet<::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes, 16>>
77 mEventsUsed;
78 ::ll::TypedStorage<8, 320, ::std::optional<::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface>>
79 mClosures;
80 ::ll::TypedStorage<8, 40, ::Scripting::Version> mVersionBoundWith;
81 ::ll::TypedStorage<1, 1, bool> mInitialized;
82 ::ll::TypedStorage<1, 1, bool> mUsedByBlock;
83 // NOLINTEND
84
85 public:
86 // member functions
87 // NOLINTBEGIN
88 MCNAPI void setClosureData(
91 );
92 // NOLINTEND
93 };
94
95public:
96 // member variables
97 // NOLINTBEGIN
98 ::ll::TypedStorage<8, 8, ::ScriptDeferredEventCoordinator&> mDeferredEventCoordinator;
99 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::cereal::ReflectionCtx>> mCerealContext;
100 ::ll::TypedStorage<8, 24, ::std::vector<::Bedrock::PubSub::Subscription>> mBlockSubscriptions;
101 ::ll::TypedStorage<
102 8,
103 64,
104 ::std::unordered_map<
107 mComponents;
108 ::ll::TypedStorage<8, 24, ::ScriptModuleMinecraft::ScriptCustomComponentAfterEventList> mAsyncEventQueues;
109 ::ll::TypedStorage<2, 2, ::Bedrock::EnumSet<::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes, 16>>
110 mV1EventSubscriptionList;
111 ::ll::TypedStorage<8, 8, ::ScriptModuleMinecraft::ScriptCustomComponentParameterCache&>
112 mCustomComponentParameterCache;
113 // NOLINTEND
114
115public:
116 // prevent constructor by default
117 ScriptBlockCustomComponentsRegistry& operator=(ScriptBlockCustomComponentsRegistry const&);
118 ScriptBlockCustomComponentsRegistry(ScriptBlockCustomComponentsRegistry const&);
119 ScriptBlockCustomComponentsRegistry();
120
121public:
122 // virtual functions
123 // NOLINTBEGIN
124 virtual void onPreFlushAfterEvents() /*override*/;
125
126 virtual void onFlushBlockCustomComponentAfterEvents(::ScriptDeferredFlushTracker& deferredTracker) /*override*/;
127
128 virtual void onPostFlushAfterEvents() /*override*/;
129
130 virtual void _onScriptInitializationComplete() /*override*/;
131
132 virtual void _onReload() /*override*/;
133
134 virtual ~ScriptBlockCustomComponentsRegistry() /*override*/ = default;
135
136 virtual ::std::vector<::std::string_view> getValidComponentsForBlock(
138 ) const /*override*/;
139
140 virtual ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
141 tryGetCustomComponentParametersForBlock(
142 ::Block const& block,
143 ::std::string_view componentName,
145 ) const /*override*/;
146 // NOLINTEND
147
148public:
149 // member functions
150 // NOLINTBEGIN
153 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
155 );
156
157 MCNAPI ::Scripting::Result<
158 void,
165 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
166 ::HashedString const,
168 compIt,
169 ::HashedString const& name
170 );
171
172 MCNAPI ::Scripting::Result<
173 void,
180 ::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair<
181 ::HashedString const,
183 compIt,
184 ::HashedString const& name,
186 );
187
189 ::BlockType& block,
190 ::std::vector<::gsl::not_null<::BlockCustomComponentsComponent*>> const& comps
191 );
192
194
196 ::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes type,
197 ::BlockCustomComponentsComponent const& customComponents
198 ) const;
199
200 MCNAPI void onActor(::BlockEvents::ActorEvent const& eventData) const;
201
202 MCNAPI void onBlockStateChange(::BlockEvents::BlockStateChangeEvent const& eventData) const;
203
204 MCNAPI void onBreak(::BlockEvents::BlockBreakEvent const& eventData) const;
205
207
208 MCNAPI void onNamedTick(::BlockEvents::NamedTickEvent const& eventData) const;
209
211
212 MCNAPI void onPlace(::BlockEvents::BlockPlaceEvent const& eventData) const;
213
214 MCNAPI void onPlayerBreak(::BlockEvents::BlockPlayerDestroyEvent const& eventData) const;
215
217
218 MCNAPI void onQueuedTick(::BlockEvents::BlockQueuedTickEvent const& eventData) const;
219
220 MCNAPI void onRandomTick(::BlockEvents::BlockRandomTickEvent const& eventData) const;
221
223
225
226 MCNAPI void onStepOff(::BlockEvents::BlockStepOffEvent const& eventData) const;
227
228 MCNAPI void onStepOn(::BlockEvents::BlockStepOnEvent const& eventData) const;
229
230 MCNAPI ::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface const*
232
233 MCNAPI ::Scripting::Result<
234 void,
241 ::HashedString const& name,
244 );
245
246 MCNAPI ::Scripting::Result<
247 void,
254 ::HashedString const& name,
257 );
258 // NOLINTEND
259
260public:
261 // static functions
262 // NOLINTBEGIN
263 MCNAPI static ::ScriptModuleMinecraft::ScriptCustomComponentEventMetadata<
266
267 MCNAPI static void bind(::Scripting::ModuleBindingBuilder& moduleBuilder);
268
270 ::Scripting::ModuleDescriptor const& moduleToDocumentFor,
271 ::Json::Value& eventOrderArray
272 );
273 // NOLINTEND
274
275public:
276 // constructor thunks
277 // NOLINTBEGIN
278 MCNAPI void* $ctor(
280 ::ScriptDeferredEventCoordinator& deferredEventCoordinator,
282 );
283 // NOLINTEND
284
285public:
286 // virtual function thunks
287 // NOLINTBEGIN
289
291
293
295
296 MCNAPI void $_onReload();
297
298 MCNAPI ::std::vector<::std::string_view> $getValidComponentsForBlock(
300 ) const;
301
302 MCNAPI ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters> const&
304 ::Block const& block,
305 ::std::string_view componentName,
307 ) const;
308
309
310 // NOLINTEND
311};
312
313} // namespace ScriptModuleMinecraft
Definition BlockCustomComponentsComponent.h:21
Definition ActorEvent.h:17
Definition BlockBreakEvent.h:17
Definition BlockEntityFallOnEvent.h:17
Definition BlockNeighborChangedEvent.h:18
Definition BlockPlaceEvent.h:16
Definition BlockPlayerDestroyEvent.h:17
Definition BlockPlayerInteractEvent.h:18
Definition BlockPlayerPlacingEvent.h:18
Definition BlockQueuedTickEvent.h:16
Definition BlockRandomTickEvent.h:16
Definition BlockRandomTickLegacyEvent.h:16
Definition BlockRedstoneUpdateEvent.h:15
Definition BlockStateChangeEvent.h:17
Definition BlockStepOffEvent.h:16
Definition BlockStepOnEvent.h:16
Definition NamedTickEvent.h:18
Definition BlockType.h:79
Definition Block.h:42
Definition HashedString.h:5
Definition Value.h:16
Definition ScriptDeferredEventCoordinator.h:18
Definition ScriptDeferredEventListener.h:10
Definition ScriptDeferredFlushTracker.h:13
Definition IScriptBlockCustomComponentReader.h:18
Definition ScriptBlockCustomComponentInterface.h:10
MCAPI ::Scripting::Result< void, ::ScriptModuleMinecraft::ScriptCustomComponentInvalidRegistryError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentAlreadyRegisteredError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadVersionError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewEventError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewComponentError > tryRegisterCustomComponent(::HashedString const &name, ::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface &&closures, ::Scripting::WeakLifetimeScope const &scope)
MCAPI void onPlayerBreak(::BlockEvents::BlockPlayerDestroyEvent const &eventData) const
MCAPI void onStepOff(::BlockEvents::BlockStepOffEvent const &eventData) const
MCAPI void onPlace(::BlockEvents::BlockPlaceEvent const &eventData) const
MCAPI void onEntityFallOn(::BlockEvents::BlockEntityFallOnEvent &eventData) const
MCAPI void onPlayerInteract(::BlockEvents::BlockPlayerInteractEvent &eventData) const
MCAPI void onRandomTickLegacy(::BlockEvents::BlockRandomTickLegacyEvent const &eventData) const
MCAPI ::Scripting::Result< void, ::ScriptModuleMinecraft::ScriptCustomComponentInvalidRegistryError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentAlreadyRegisteredError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadVersionError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewEventError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewComponentError > tryRegisterCustomComponentV1(::HashedString const &name, ::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface &&closures, ::Scripting::WeakLifetimeScope const &scope)
MCAPI ::Scripting::Result< void, ::ScriptModuleMinecraft::ScriptCustomComponentInvalidRegistryError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentAlreadyRegisteredError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadVersionError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewEventError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewComponentError > _componentReloadRegistrationValidators(::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair< ::HashedString const, ::ScriptModuleMinecraft::ScriptBlockCustomComponentsRegistry::ScriptBlockCustomComponentData > > > > const &compIt, ::HashedString const &name, ::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface const &closures)
MCAPI void onQueuedTick(::BlockEvents::BlockQueuedTickEvent const &eventData) const
MCAPI void onActor(::BlockEvents::ActorEvent const &eventData) const
MCAPI void onBreak(::BlockEvents::BlockBreakEvent const &eventData) const
MCAPI bool hasSubscriptionFor(::ScriptModuleMinecraft::ScriptBlockCustomComponentEventTypes type, ::BlockCustomComponentsComponent const &customComponents) const
MCAPI void onRandomTick(::BlockEvents::BlockRandomTickEvent const &eventData) const
MCAPI void $onFlushBlockCustomComponentAfterEvents(::ScriptDeferredFlushTracker &deferredTracker)
MCAPI void _registerBlockForEventing(::BlockType &block, ::std::vector<::gsl::not_null<::BlockCustomComponentsComponent * > > const &comps)
static MCAPI void generateOrderDocumentationForVersion(::Scripting::ModuleDescriptor const &moduleToDocumentFor, ::Json::Value &eventOrderArray)
MCAPI ScriptBlockCustomComponentsRegistry(::ServerScriptManagerEvents &events, ::ScriptDeferredEventCoordinator &deferredEventCoordinator, ::ScriptModuleMinecraft::ScriptCustomComponentParameterCache &parameterCache)
MCAPI void onBlockStateChange(::BlockEvents::BlockStateChangeEvent const &eventData) const
MCAPI void onRedstoneUpdate(::BlockEvents::BlockRedstoneUpdateEvent const &eventData) const
MCAPI ::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptCustomComponentParameters > const & $tryGetCustomComponentParametersForBlock(::Block const &block, ::std::string_view componentName, ::Scripting::WeakLifetimeScope const &scope) const
static MCAPI void bind(::Scripting::ModuleBindingBuilder &moduleBuilder)
MCAPI void * $ctor(::ServerScriptManagerEvents &events, ::ScriptDeferredEventCoordinator &deferredEventCoordinator, ::ScriptModuleMinecraft::ScriptCustomComponentParameterCache &parameterCache)
MCAPI void onStepOn(::BlockEvents::BlockStepOnEvent const &eventData) const
MCAPI::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface const * tryGetRegisteredComponent(::HashedString const &name) const
MCAPI void beforeOnPlayerPlace(::BlockEvents::BlockPlayerPlacingEvent &eventData) const
static MCAPI ::ScriptModuleMinecraft::ScriptCustomComponentEventMetadata< ::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface > const _getEventMetadata()
MCAPI void onNeighborChanged(::BlockEvents::BlockNeighborChangedEvent const &eventData) const
MCAPI ::Scripting::Result< void, ::ScriptModuleMinecraft::ScriptCustomComponentInvalidRegistryError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentAlreadyRegisteredError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadVersionError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewEventError, ::ScriptModuleMinecraft::ScriptBlockCustomComponentReloadNewComponentError > _componentRegistrationValidatorsCommon(::std::_List_iterator<::std::_List_val<::std::_List_simple_types<::std::pair< ::HashedString const, ::ScriptModuleMinecraft::ScriptBlockCustomComponentsRegistry::ScriptBlockCustomComponentData > > > > const &compIt, ::HashedString const &name)
MCAPI void onNamedTick(::BlockEvents::NamedTickEvent const &eventData) const
MCAPI ::std::vector<::std::string_view > $getValidComponentsForBlock(::Scripting::StrongTypedObjectHandle<::ScriptModuleMinecraft::ScriptBlockPermutation > const &permutation) const
Definition ScriptBlockPermutation.h:22
Definition ScriptCustomComponentParameterCache.h:21
Definition ScriptCustomComponentRegistry.h:10
Definition ModuleBindingBuilder.h:22
Definition StrongTypedObjectHandle.h:8
Definition WeakLifetimeScope.h:12
Definition ScriptBlockCustomComponentAlreadyRegisteredError.h:15
Definition ScriptBlockCustomComponentReloadNewComponentError.h:15
Definition ScriptBlockCustomComponentReloadNewEventError.h:15
Definition ScriptBlockCustomComponentReloadVersionError.h:15
MCAPI void setClosureData(::ScriptModuleMinecraft::ScriptBlockCustomComponentInterface &&closures, ::Scripting::WeakLifetimeScope const &scope)
Definition ScriptCustomComponentInvalidRegistryError.h:17
Definition ScriptCustomComponentParameters.h:15
Definition ModuleDescriptor.h:7
Definition ServerScriptManagerEvents.h:13
Definition ReflectionCtx.h:11