LeviLamina
Loading...
Searching...
No Matches
Minecraft.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4#include "mc/deps/ecs/gamerefs_entity/GameRefsEntity.h"
5
6// auto generated inclusion list
7#include "mc/common/SubClientId.h"
8#include "mc/deps/core/utility/NonOwnerPointer.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
18// auto generated forward declare list
19// clang-format off
21class EntityContext;
22class EntityRegistry;
23class EntitySystems;
24class Experiments;
25class FileArchiver;
26class GameCallbacks;
28class GameSession;
31class ITickingSystem;
32class KeyManager;
33class Level;
39class PacketSender;
40class PermissionsFile;
43class Scheduler;
48class Timer;
52struct PackIdVersion;
54namespace Bedrock::PubSub { class Subscription; }
55namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
56class ServerMetrics;
57// clang-format on
58
59class Minecraft : public ::IEntityRegistryOwner {
60public:
61 // Minecraft inner types declare
62 // clang-format off
63 struct Impl;
64 // clang-format on
65
66 // Minecraft inner types define
67 struct Impl {};
68
69public:
70 // member variables
71 // NOLINTBEGIN
72 ::ll::TypedStorage<8, 8, ::GameCallbacks&> mGameCallbacks;
73 ::ll::TypedStorage<8, 8, ::IMinecraftEventing&> mEventing;
74 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackManager>> mResourceLoader;
75 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::StructureManager>> mStructureManager;
76 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameModuleServer>> mGameModuleServer;
77 ::ll::TypedStorage<8, 8, ::PermissionsFile*> mPermissionsFile;
78 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PrivateKeyManager>> mServerKeys;
79 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::MinecraftServiceKeyManager>> mMinecraftServiceKeys;
80 ::ll::TypedStorage<8, 32, ::std::string const> mSaveGamePath;
81 ::ll::TypedStorage<8, 8, ::ServerMetrics*> mServerMetrics;
82 ::ll::TypedStorage<1, 1, bool const> mIsDedicatedServer;
83 ::ll::TypedStorage<1, 1, bool> mCorruptionDetected;
84 ::ll::TypedStorage<1, 1, bool> mFireOnLevelCorrupt;
85 ::ll::TypedStorage<8, 8, double> mFrameDuration;
86 ::ll::TypedStorage<8, 8, double> mLastFrameStart;
87 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mMaxPlayerIdleTime;
88 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DefaultCommandsContextProvider>> mDefaultCommandsContextProvider;
89 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftCommands>> mCommands;
90 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::GameSession>> mGameSession;
91 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::GameTestLevelListener>> mGameTestLevelListener;
92 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftGameTest>> mGameTest;
93 ::ll::TypedStorage<8, 8, ::Timer&> mSimTimer;
94 ::ll::TypedStorage<8, 8, ::Timer&> mRealTimer;
95 ::ll::TypedStorage<8, 16, ::ClientOrServerNetworkSystemRef> mNetwork;
96 ::ll::TypedStorage<8, 8, ::PacketSender&> mPacketSender;
97 ::ll::TypedStorage<1, 1, ::SubClientId> mClientSubId;
98 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::Minecraft::Impl>>> mImpl;
99 ::ll::TypedStorage<8, 16, ::gsl::not_null<::OwnerPtr<::EntityRegistry>>> mEntityRegistry;
100 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ITickingSystem>> mAddMovementTickForCatchup;
101 ::ll::TypedStorage<
102 8,
103 8,
104 ::std::unique_ptr<
106 mLevelSubscribers;
107 ::ll::TypedStorage<8, 64, ::brstd::move_only_function<void() const>> mRequestServerShutdown;
108 ::ll::TypedStorage<
109 8,
110 64,
111 ::brstd::move_only_function<
112 ::std::unique_ptr<::ServerNetworkHandler>(::MinecraftArguments::CreateServerNetworkHandlerArgs&&)>>
113 mCreateServerNetworkHandler;
114 ::ll::TypedStorage<8, 64, ::brstd::move_only_function<::Bedrock::NotNullNonOwnerPtr<::FileArchiver>() const>>
115 mGetFileArchiver;
116 ::ll::TypedStorage<
117 8,
118 64,
119 ::brstd::move_only_function<
120 ::std::unique_ptr<::MinecraftCommands>(::MinecraftArguments::CreateMinecraftCommandsArgs&&) const>>
121 mCreateMinecraftCommands;
122 // NOLINTEND
123
124public:
125 LLAPI Level* getLevel() const;
126
127public:
128 // prevent constructor by default
129 Minecraft& operator=(Minecraft const&);
130 Minecraft(Minecraft const&);
131 Minecraft();
132
133public:
134 // virtual functions
135 // NOLINTBEGIN
136 virtual ~Minecraft() /*override*/ = default;
137
138 virtual void setSimTimePause(bool pause);
139
140 virtual void setSimTimeScale(float scale);
141
142 virtual bool getSimPaused() const;
143
144 virtual bool isOnlineClient() const;
145
146 virtual ::StackRefResult<::EntityRegistry> getEntityRegistry() /*override*/;
147
148 virtual ::StackRefResult<::EntityRegistry const> getEntityRegistry() const /*override*/;
149 // NOLINTEND
150
151public:
152 // member functions
153 // NOLINTBEGIN
154 MCAPI explicit Minecraft(::MinecraftArguments&& args);
155
156 MCAPI void _tryCatchupMovementTicks();
157
158 MCAPI void configureGameTest(::Level& level, ::Experiments const& experiments);
159
160 MCAPI void disconnectClient(::NetworkIdentifier const& id, ::Connection::DisconnectFailReason disconnectReason);
161
162 MCAPI ::Bedrock::NonOwnerPointer<::ServerNetworkHandler> getServerNetworkHandler();
163
164 MCAPI ::Bedrock::NotNullNonOwnerPtr<::StructureManager> getStructureManager();
165
166 MCAPI bool hostMultiplayer(
167 ::std::string const& serverName,
168 ::std::pair<::std::unique_ptr<::Level>, ::OwnerPtr<::EntityContext>> levelEntity,
169 ::KeyManager const& hostPublicKey,
170 int maxChunkRadius,
171 bool shouldAnnounce,
172 ::ConnectionDefinition const& connectionDefinition,
173 ::std::unordered_map<::PackIdVersion, ::std::string> const& packIdToContentKey,
174 ::Scheduler& scheduler,
175 ::TextFilteringProcessor* textFilteringProcessor,
176 ::NetworkServerConfig const& packetHandlerConfig,
177 ::std::shared_ptr<::ScriptPackSettingsCache> packSettingsCache,
178 ::ServerNetworkHandlerDependencies&& serverNetworkOptions
179 );
180
181 MCFOLD void init();
182
183 MCFOLD void initAsDedicatedServer();
184
185 MCAPI void initCommands();
186
187#ifdef LL_PLAT_C
188 MCAPI void onClientCreatedLevel(::std::pair<::std::unique_ptr<::Level>, ::OwnerPtr<::EntityContext>> levelEntity);
189
190 MCAPI ::Bedrock::PubSub::Subscription registerLevelListener(::std::function<void(::Level*)> callback) const;
191
192 MCAPI void resetGameSession();
193
194 MCAPI void startClientGame(::std::unique_ptr<::NetEventCallback> legacyClientNetworkHandler);
195#endif
196
197 MCAPI void startLeaveGame(bool stopNetwork);
198
199 MCAPI bool update();
200 // NOLINTEND
201
202public:
203 // static functions
204 // NOLINTBEGIN
205 MCAPI static void _tryCatchupMovementTicks(
206 ::EntitySystems& entitySystems,
207 ::EntityRegistry& registry,
208 ::std::unique_ptr<::ITickingSystem>& addMovementTickForCatchup
209 );
210 // NOLINTEND
211
212public:
213 // constructor thunks
214 // NOLINTBEGIN
215 MCAPI void* $ctor(::MinecraftArguments&& args);
216 // NOLINTEND
217
218public:
219 // virtual function thunks
220 // NOLINTBEGIN
221 MCAPI void $setSimTimePause(bool pause);
222
223 MCAPI void $setSimTimeScale(float scale);
224
225 MCAPI bool $getSimPaused() const;
226
227 MCAPI bool $isOnlineClient() const;
228
229 MCAPI ::StackRefResult<::EntityRegistry> $getEntityRegistry();
230
231 MCAPI ::StackRefResult<::EntityRegistry const> $getEntityRegistry() const;
232
233
234 // NOLINTEND
235};
Definition Publisher.h:25
Definition Subscription.h:10
Definition DefaultCommandsContextProvider.h:17
Definition EntityContext.h:15
Definition EntityRegistry.h:10
Definition EntitySystems.h:25
Definition Experiments.h:14
Definition FileArchiver.h:36
Definition GameCallbacks.h:5
Definition GameModuleServer.h:27
Definition GameSession.h:22
Definition GameTestLevelListener.h:15
Definition IEntityRegistryOwner.h:14
Definition IMinecraftEventing.h:145
Definition ITickingSystem.h:15
Definition KeyManager.h:8
Definition Level.h:253
Definition MinecraftCommands.h:34
Definition MinecraftGameTest.h:20
Definition MinecraftServiceKeyManager.h:21
Definition NetEventCallback.h:263
Definition NetworkIdentifier.h:10
Definition OwnerPtr.h:7
Definition PacketSender.h:17
Definition PermissionsFile.h:20
Definition PrivateKeyManager.h:9
Definition ResourcePackManager.h:38
Definition Scheduler.h:14
Definition ScriptPackSettingsCache.h:16
Definition ServerMetrics.h:10
Definition ServerNetworkHandler.h:180
Definition StackRefResult.h:7
Definition StructureManager.h:37
Definition TextFilteringProcessor.h:19
Definition Timer.h:5
Definition move_only_function.h:9
STL namespace.
Definition ConnectionDefinition.h:5
Definition MinecraftArguments.h:21
Definition Minecraft.h:67
Definition NetworkServerConfig.h:9
Definition PackIdVersion.h:10
Definition ServerNetworkHandlerDependencies.h:5