LeviLamina
Loading...
Searching...
No Matches
ServerScriptManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/core/threading/Scheduler.h"
5#include "mc/deps/scripting/script_engine/DependencyLocator.h"
6#include "mc/scripting/ScriptFormPromiseTracker.h"
7#include "mc/scripting/ScriptPluginManager.h"
8#include "mc/scripting/ScriptPluginResult.h"
9#include "mc/scripting/ScriptPrintLogger.h"
10#include "mc/scripting/ScriptSettings.h"
11#include "mc/scripting/ScriptTickListener.h"
12#include "mc/scripting/debugger/ScriptDebugger.h"
13#include "mc/scripting/debugger/ScriptDebuggerWatchdog.h"
14
15
16// auto generated inclusion list
17#include "mc/deps/core/utility/NonOwnerPointer.h"
18#include "mc/deps/core/utility/optional_ref.h"
19#include "mc/deps/game_refs/OwnerPtr.h"
20#include "mc/scripting/PluginExecutionGroup.h"
21#include "mc/scripting/RegisterDiagnosticsStatsTypes.h"
22#include "mc/scripting/ScriptSettings.h"
23#include "mc/scripting/ServerScriptManagerEvents.h"
24#include "mc/world/events/EventListenerDispatcher.h"
25#include "mc/world/events/EventResult.h"
26#include "mc/world/events/LevelEventListener.h"
27#include "mc/world/events/ServerInstanceEventListener.h"
28
29// auto generated forward declare list
30// clang-format off
34class ItemRegistryRef;
38class PackManifest;
40class Scheduler;
44class ScriptDebugger;
52class ScriptWatchdog;
53class ServerInstance;
54class ServerLevel;
57namespace ScriptModuleMinecraft { class CustomCommandRegistry; }
58namespace ScriptModuleMinecraft { class IScriptItemCustomComponentRegistry; }
59namespace ScriptModuleMinecraft { class ScriptBlockCustomComponentsRegistry; }
60namespace ScriptModuleMinecraft { class ScriptCustomComponentParameterCache; }
61namespace ScriptModuleMinecraft { class ScriptCustomSpawnRulesRegistry; }
62namespace ScriptModuleMinecraft { class ScriptGlobalEventListeners; }
63namespace Scripting { class DependencyLocator; }
64namespace Scripting { class IRuntime; }
65namespace Scripting { class RegistryManager; }
66namespace Scripting { class ScriptEngine; }
67namespace Scripting { class WeakLifetimeScope; }
68namespace Scripting { struct ModuleDescriptor; }
69namespace cereal { struct ReflectionCtx; }
70// clang-format on
71
72class ServerScriptManager : public ::EventListenerDispatcher<::ServerInstanceEventListener>,
73 public ::EventListenerDispatcher<::LevelEventListener> {
74public:
75 // ServerScriptManager inner types define
76 enum class RuntimeVersion : int {
77 V1 = 1,
78 V2 = 2,
79 };
80
81public:
82 // member variables
83 // NOLINTBEGIN
84 ::ll::TypedStorage<8, 144, ::ServerScriptManagerEvents> mScriptStateEvents;
85 ::ll::TypedStorage<8, 704, ::ScriptSettings> mSettings;
86 ::ll::TypedStorage<8, 8, ::ServerLevel&> mServerLevel;
87 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::PackSettingsCache>> mPackSettingsCache;
88 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::Scheduler>> mServerScheduler;
89 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::cereal::ReflectionCtx>> mCerealContext;
90 ::ll::TypedStorage<1, 1, ::RegisterDiagnosticsStatsTypes> mRegisterDiagnosticsStatsTypes;
91 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::IScriptTelemetryLogger>> mTelemetryLogger;
92 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptClientDiagnosticsListener>> mClientDiagnosticsListener;
93 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::LevelEventHandlerRegistrar>> mLevelEventHandlerRegistrar;
94 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptModuleMinecraft::CustomCommandRegistry>> mCustomCommandRegistry;
95 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptModuleMinecraft::ScriptCustomComponentParameterCache>>
96 mCustomComponentParameterCache;
97 ::ll::TypedStorage<8, 16, ::OwnerPtr<::ScriptModuleMinecraft::ScriptBlockCustomComponentsRegistry>>
98 mBlockCustomComponentsRegistry;
99 ::ll::TypedStorage<8, 16, ::OwnerPtr<::ScriptModuleMinecraft::IScriptItemCustomComponentRegistry>>
100 mItemCustomComponentRegistry;
101 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptModuleMinecraft::ScriptCustomSpawnRulesRegistry>>
102 mCustomSpawnRulesRegistry;
103 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptModuleMinecraft::ScriptGlobalEventListeners>>
104 mGlobalEventListeners;
105 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Scripting::ScriptEngine>> mScriptEngine;
106 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptPluginManager>> mScriptPluginManager;
107 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptAsyncJobCoordinator>> mAsyncJobCoordinator;
108 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptFormPromiseTracker>> mFormPromiseTracker;
109 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptDebuggerWatchdog>> mScriptDebuggerWatchdog;
110 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptDebugger>> mScriptDebugger;
111 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptDiagnosticsPublishToFile>> mDiagnosticsPublishToFile;
112 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptDiagnostics>> mScriptDiagnostics;
113 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptTickListener>> mScriptTickListener;
114 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptContentLogEndPoint>> mScriptContentLogEndPoint;
115 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ScriptWatchdog>> mScriptWatchdog;
116 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::AsyncJoinRegistrar>> mAsyncJoinRegistrar;
117 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Scripting::DependencyLocator>> mDependencyLocator;
118 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::Scripting::IRuntime>>> mSharedRuntimes;
119 ::ll::TypedStorage<
120 8,
121 24,
122 ::std::vector<::std::function<bool(
123 ::PackManifest const&,
127 )>>>
128 mModuleFilters;
129 // NOLINTEND
130
131public:
132 // prevent constructor by default
133 ServerScriptManager& operator=(ServerScriptManager const&);
136
137public:
138 // virtual functions
139 // NOLINTBEGIN
140 // vIndex: 13
141 virtual ::EventResult onEvent(::ServerInstanceRequestResourceReload const& reloadEvent) /*override*/;
142
143 // vIndex: 13
144 virtual ::EventResult onEvent(::LevelStartLeaveGameEvent const& levelStartLeaveGameEvent) /*override*/;
145
146 // vIndex: 0
147 virtual ~ServerScriptManager() /*override*/;
148
149 // vIndex: 6
150 virtual ::EventResult onServerUpdateEnd(::ServerInstance& instance) /*override*/;
151
152 // vIndex: 9
153 virtual ::EventResult onServerThreadStarted(::ServerInstance& instance) /*override*/;
154 // NOLINTEND
155
156public:
157 // member functions
158 // NOLINTBEGIN
160 ::ScriptSettings&& settings,
161 ::ServerLevel& serverLevel,
162 ::std::shared_ptr<::PackSettingsCache> packSettingsCache,
164 ::MinecraftCommands& commands,
165 ::IMinecraftEventing& eventing,
166 ::ItemRegistryRef itemRegistry,
167 ::ServerInstance& server,
169 ::std::unique_ptr<::AsyncJoinRegistrar>&& asyncJoinRegistrar
170 );
171
172 MCAPI void _initModules(::ServerInstance& server, ::ServerLevel& serverLevel);
173
174 MCAPI void _loadPlugins(::ServerLevel& serverLevel, bool fromReload);
175
176 MCAPI void _onPreReload(
177 ::ServerInstance& serverInstance,
178 ::ServerLevel& level,
180 );
181
182 MCAPI void _runPlugins(::PluginExecutionGroup exeGroup, ::ServerInstance& serverInstance);
183
184 MCAPI void _sendScriptModuleStartupEvent(::ServerLevel& level) const;
185
186 MCAPI void _sendWorldInitializeEvent(::ServerLevel& level) const;
187 // NOLINTEND
188
189public:
190 // static functions
191 // NOLINTBEGIN
192 MCAPI static void _sendWorldInitializeEventImpl(
193 ::ServerLevel& level,
197 bool lastEventInList
198 );
199 // NOLINTEND
200
201public:
202 // constructor thunks
203 // NOLINTBEGIN
204 MCAPI void* $ctor(
205 ::ScriptSettings&& settings,
206 ::ServerLevel& serverLevel,
207 ::std::shared_ptr<::PackSettingsCache> packSettingsCache,
209 ::MinecraftCommands& commands,
210 ::IMinecraftEventing& eventing,
211 ::ItemRegistryRef itemRegistry,
212 ::ServerInstance& server,
214 ::std::unique_ptr<::AsyncJoinRegistrar>&& asyncJoinRegistrar
215 );
216 // NOLINTEND
217
218public:
219 // destructor thunk
220 // NOLINTBEGIN
221 MCAPI void $dtor();
222 // NOLINTEND
223
224public:
225 // virtual function thunks
226 // NOLINTBEGIN
227 MCAPI ::EventResult $onEvent(::ServerInstanceRequestResourceReload const& reloadEvent);
228
229 MCAPI ::EventResult $onEvent(::LevelStartLeaveGameEvent const& levelStartLeaveGameEvent);
230
231 MCAPI ::EventResult $onServerUpdateEnd(::ServerInstance& instance);
232
233 MCAPI ::EventResult $onServerThreadStarted(::ServerInstance& instance);
234 // NOLINTEND
235
236public:
237 // vftables
238 // NOLINTBEGIN
240
242 // NOLINTEND
243};
Definition AsyncJoinRegistrar.h:19
Definition NonOwnerPointer.h:9
Definition EventListenerDispatcher.h:6
Definition IMinecraftEventing.h:147
Definition IScriptTelemetryLogger.h:10
Definition ItemRegistryRef.h:34
Definition LevelEventHandlerRegistrar.h:10
Definition MinecraftCommands.h:33
Definition MinecraftGameTest.h:21
Definition PackManifest.h:35
Definition PackSettingsCache.h:16
Definition Scheduler.h:13
Definition ScriptAsyncJobCoordinator.h:11
Definition ScriptClientDiagnosticsListener.h:14
Definition ScriptContentLogEndPoint.h:10
Definition ScriptDebuggerWatchdog.h:8
Definition ScriptDebugger.h:25
Definition ScriptDiagnosticsPublishToFile.h:16
Definition ScriptDiagnostics.h:11
Definition ScriptFormPromiseTracker.h:35
Definition IScriptItemCustomComponentRegistry.h:20
Definition ScriptBlockCustomComponentsRegistry.h:51
Definition ScriptPluginManager.h:27
Definition ScriptPluginResult.h:11
Definition ScriptTickListener.h:21
Definition ScriptWatchdog.h:5
Definition RegistryManager.h:12
Definition WeakLifetimeScope.h:7
Definition ServerInstance.h:74
Definition ServerLevel.h:61
Definition ServerScriptManager.h:73
static MCAPI void ** $vftableForEventListenerDispatcherLevelEventListener()
static MCAPI void ** $vftableForEventListenerDispatcherServerInstanceEventListener()
Definition optional_ref.h:10
Definition LevelStartLeaveGameEvent.h:13
Definition ScriptSettings.h:18
Definition ModuleDescriptor.h:7
Definition ServerInstanceRequestResourceReload.h:13