LeviLamina
Loading...
Searching...
No Matches
Minecraft.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/common/SubClientId.h"
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8#include "mc/deps/core/utility/optional_ref.h"
9#include "mc/deps/core/utility/pub_sub/Publisher.h"
10#include "mc/deps/ecs/gamerefs_entity/IEntityRegistryOwner.h"
11#include "mc/deps/game_refs/OwnerPtr.h"
12#include "mc/deps/game_refs/StackRefResult.h"
13#include "mc/network/ClientOrServerNetworkSystemRef.h"
14#include "mc/network/connection/DisconnectFailReason.h"
15#include "mc/platform/brstd/move_only_function.h"
16#include "mc/world/MinecraftArguments.h"
17#include "mc/world/level/GameType.h"
18
19// auto generated forward declare list
20// clang-format off
23class EntityContext;
24class EntityRegistry;
25class EntitySystems;
26class Experiments;
27class FileArchiver;
28class GameCallbacks;
30class GameSession;
33class ITickingSystem;
34class Level;
40class PacketSender;
41class PermissionsFile;
44class Scheduler;
50class Timer;
54struct PackIdVersion;
56namespace Bedrock::PubSub { class Subscription; }
57namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
58class ServerMetrics;
59// clang-format on
60
61class Minecraft : public ::IEntityRegistryOwner {
62public:
63 // member variables
64 // NOLINTBEGIN
65 ::ll::TypedStorage<8, 8, ::GameCallbacks&> mGameCallbacks;
66 ::ll::TypedStorage<8, 8, ::IMinecraftEventing&> mEventing;
67 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackManager>> mResourceLoader;
68 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::StructureManager>> mStructureManager;
69 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameModuleServer>> mGameModuleServer;
70 ::ll::TypedStorage<8, 8, ::PermissionsFile*> mPermissionsFile;
71 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PrivateKeyManager>> mServerKeys;
72 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftServiceKeyManager>> mMinecraftServiceKeys;
73 ::ll::TypedStorage<8, 32, ::std::string const> mSaveGamePath;
74 ::ll::TypedStorage<8, 8, ::ServerMetrics*> mServerMetrics;
75 ::ll::TypedStorage<1, 1, bool const> mIsDedicatedServer;
76 ::ll::TypedStorage<1, 1, bool> mCorruptionDetected;
77 ::ll::TypedStorage<1, 1, bool> mFireOnLevelCorrupt;
78 ::ll::TypedStorage<8, 8, double> mFrameDuration;
79 ::ll::TypedStorage<8, 8, double> mLastFrameStart;
80 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mMaxPlayerIdleTime;
81 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DefaultCommandsContextProvider>> mDefaultCommandsContextProvider;
82 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftCommands>> mCommands;
83 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::GameSession>> mGameSession;
84 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::GameTestLevelListener>> mGameTestLevelListener;
85 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftGameTest>> mGameTest;
86 ::ll::TypedStorage<8, 8, ::Timer&> mSimTimer;
87 ::ll::TypedStorage<8, 8, ::Timer&> mRealTimer;
88 ::ll::TypedStorage<8, 16, ::ClientOrServerNetworkSystemRef> mNetwork;
89 ::ll::TypedStorage<8, 8, ::PacketSender&> mPacketSender;
90 ::ll::TypedStorage<1, 1, ::SubClientId> mClientSubId;
91 ::ll::TypedStorage<8, 16, ::OwnerPtr<::EntityRegistry>> mEntityRegistry;
92 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ITickingSystem>> mAddMovementTickForCatchup;
93 ::ll::TypedStorage<
94 8,
95 8,
96 ::std::unique_ptr<
98 mLevelSubscribers;
99 ::ll::TypedStorage<8, 64, ::brstd::move_only_function<void() const>> mRequestServerShutdown;
100 ::ll::TypedStorage<
101 8,
102 64,
104 ::std::unique_ptr<::ServerNetworkHandler>(::MinecraftArguments::CreateServerNetworkHandlerArgs&&)>>
105 mCreateServerNetworkHandler;
106 ::ll::TypedStorage<8, 64, ::brstd::move_only_function<::Bedrock::NotNullNonOwnerPtr<::FileArchiver>() const>>
107 mGetFileArchiver;
108 ::ll::TypedStorage<
109 8,
110 64,
112 ::std::unique_ptr<::MinecraftCommands>(::MinecraftArguments::CreateMinecraftCommandsArgs&&) const>>
113 mCreateMinecraftCommands;
114 // NOLINTEND
115
116public:
117 // prevent constructor by default
118 Minecraft& operator=(Minecraft const&);
119 Minecraft(Minecraft const&);
120 Minecraft();
121
122public:
123 // virtual functions
124 // NOLINTBEGIN
125 virtual ~Minecraft() /*override*/;
126
127 virtual void setSimTimePause(bool pause);
128
129 virtual void setSimTimeScale(float scale);
130
131 virtual bool getSimPaused() const;
132
133 virtual bool isOnlineClient() const;
134
135 virtual ::StackRefResult<::EntityRegistry> getEntityRegistry() /*override*/;
136
137 virtual ::StackRefResult<::EntityRegistry const> getEntityRegistry() const /*override*/;
138 // NOLINTEND
139
140public:
141 // member functions
142 // NOLINTBEGIN
143 MCAPI explicit Minecraft(::MinecraftArguments&& args);
144
145 MCAPI void _tryCatchupMovementTicks();
146
147 MCAPI void clientReset();
148
149 MCAPI void configureGameTest(::Level& level, ::Experiments const& experiments);
150
151 MCAPI void disconnectClient(::NetworkIdentifier const& id, ::Connection::DisconnectFailReason disconnectReason);
152
153 MCAPI void earlyShutdownMainthread();
154
155 MCAPI ::ClientNetworkSystem& getClientNetworkSystem();
156
157 MCFOLD ::MinecraftCommands& getCommands();
158
159 MCFOLD ::IMinecraftEventing& getEventing() const;
160
161 MCAPI ::Bedrock::NotNullNonOwnerPtr<::FileArchiver> getFileArchiver() const;
162
163 MCFOLD ::GameModuleServer& getGameModuleServer();
164
165 MCAPI ::optional_ref<::MinecraftGameTest> getGameTest();
166
167 MCAPI double getLastTimestep();
168
169 MCAPI ::Level* getLevel() const;
170
171#ifdef LL_PLAT_S
172 MCAPI ::Bedrock::NonOwnerPointer<::MinecraftServiceKeyManager> getMinecraftServiceKeyManager();
173#endif
174
175#ifdef LL_PLAT_C
176 MCAPI ::Bedrock::NonOwnerPointer<::NetEventCallback> getNetEventCallback();
177#endif
178
179 MCFOLD ::ResourcePackManager& getResourceLoader();
180
181 MCAPI ::Bedrock::NonOwnerPointer<::ServerNetworkHandler> getServerNetworkHandler();
182
183 MCAPI ::ServerNetworkSystem& getServerNetworkSystem();
184
185 MCAPI ::Bedrock::NotNullNonOwnerPtr<::StructureManager> getStructureManager();
186
187#ifdef LL_PLAT_C
188 MCFOLD ::Timer const& getTimer();
189#endif
190
191 MCAPI bool hasCommands();
192
193 MCAPI bool hostMultiplayer(
194 ::std::string const& serverName,
195 ::std::pair<::std::unique_ptr<::Level>, ::OwnerPtr<::EntityContext>> levelEntity,
196 ::std::string const& hostPublicKey,
197 ::std::unique_ptr<::NetEventCallback> clientNetworkHandler,
198 int maxChunkRadius,
199 bool shouldAnnounce,
200 ::ConnectionDefinition const& connectionDefinition,
201 ::std::unordered_map<::PackIdVersion, ::std::string> const& packIdToContentKey,
202 ::Scheduler& scheduler,
203 ::TextFilteringProcessor* textFilteringProcessor,
204 ::NetworkServerConfig const& packetHandlerConfig,
205 ::std::shared_ptr<::ScriptPackSettingsCache> packSettingsCache,
206 ::ServerNetworkHandlerDependencies&& serverNetworkOptions
207 );
208
209 MCFOLD void init();
210
211 MCFOLD void initAsDedicatedServer();
212
213 MCAPI void initCommands();
214
215 MCFOLD bool isDedicatedServer() const;
216
217 MCAPI bool isLeaveGameDone() const;
218
219#ifdef LL_PLAT_C
220 MCFOLD bool isModded();
221
222 MCAPI void onClientCreatedLevel(::std::pair<::std::unique_ptr<::Level>, ::OwnerPtr<::EntityContext>> levelEntity);
223
224 MCAPI ::Bedrock::PubSub::Subscription registerLevelListener(::std::function<void(::Level*)> callback) const;
225
226 MCAPI bool requestInGamePause(bool status);
227#endif
228
229 MCAPI void requestResourceReload();
230
231#ifdef LL_PLAT_S
232 MCAPI void requestServerShutdown();
233#endif
234
235 MCAPI void resetGameSession();
236
237#ifdef LL_PLAT_C
238 MCAPI void setGameModeReal(::GameType gameType);
239
240 MCAPI void startClientGame(::std::unique_ptr<::NetEventCallback> legacyClientNetworkHandler);
241#endif
242
243 MCAPI void startLeaveGame(bool stopNetwork);
244
245 MCAPI bool update();
246
247#ifdef LL_PLAT_C
248 MCAPI void updateScreens();
249#endif
250 // NOLINTEND
251
252public:
253 // static functions
254 // NOLINTBEGIN
255 MCAPI static void _tryCatchupMovementTicks(
256 ::EntitySystems& entitySystems,
257 ::EntityRegistry& registry,
258 ::std::unique_ptr<::ITickingSystem>& addMovementTickForCatchup
259 );
260 // NOLINTEND
261
262public:
263 // constructor thunks
264 // NOLINTBEGIN
265 MCAPI void* $ctor(::MinecraftArguments&& args);
266 // NOLINTEND
267
268public:
269 // destructor thunk
270 // NOLINTBEGIN
271 MCAPI void $dtor();
272 // NOLINTEND
273
274public:
275 // virtual function thunks
276 // NOLINTBEGIN
277 MCAPI void $setSimTimePause(bool pause);
278
279 MCAPI void $setSimTimeScale(float scale);
280
281 MCAPI bool $getSimPaused() const;
282
283 MCAPI bool $isOnlineClient() const;
284
285 MCFOLD ::StackRefResult<::EntityRegistry> $getEntityRegistry();
286
287 MCFOLD ::StackRefResult<::EntityRegistry const> $getEntityRegistry() const;
288
289
290 // NOLINTEND
291
292public:
293 // vftables
294 // NOLINTBEGIN
295 MCAPI static void** $vftable();
296 // NOLINTEND
297};
static MCAPI void ** $vftable()
Definition Publisher.h:8
Definition Subscription.h:10
Definition ClientNetworkSystem.h:39
Definition DefaultCommandsContextProvider.h:17
Definition EntityContext.h:17
Definition EntityRegistry.h:11
Definition EntitySystems.h:29
Definition Experiments.h:14
Definition FileArchiver.h:36
Definition GameCallbacks.h:5
Definition GameModuleServer.h:27
Definition GameSession.h:22
Definition GameTestLevelListener.h:16
Definition IEntityRegistryOwner.h:14
Definition IMinecraftEventing.h:138
Definition ITickingSystem.h:15
Definition Level.h:255
Definition MinecraftCommands.h:36
Definition MinecraftGameTest.h:22
Definition MinecraftServiceKeyManager.h:19
Definition NetEventCallback.h:260
Definition NetworkIdentifier.h:10
Definition OwnerPtr.h:7
Definition PacketSender.h:17
Definition PermissionsFile.h:20
Definition PrivateKeyManager.h:9
Definition ResourcePackManager.h:35
Definition Scheduler.h:15
Definition ScriptPackSettingsCache.h:17
Definition ServerMetrics.h:10
Definition ServerNetworkHandler.h:184
Definition ServerNetworkSystem.h:34
Definition StructureManager.h:46
Definition TextFilteringProcessor.h:20
Definition Timer.h:5
Definition move_only_function.h:9
Definition ConnectionDefinition.h:5
Definition MinecraftArguments.h:32
Definition MinecraftArguments.h:46
Definition MinecraftArguments.h:21
Definition NetworkServerConfig.h:9
Definition PackIdVersion.h:10
Definition ServerNetworkHandlerDependencies.h:5