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
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 Level;
38class PacketSender;
39class PermissionsFile;
42class Scheduler;
44class ServerMetrics;
49class Timer;
53struct PackIdVersion;
55namespace Bedrock::PubSub { class Subscription; }
56namespace Bedrock::PubSub::ThreadModel { struct SingleThreaded; }
57// clang-format on
58
59class Minecraft : public ::IEntityRegistryOwner {
60public:
61 // member variables
62 // NOLINTBEGIN
63 ::ll::TypedStorage<8, 8, ::GameCallbacks&> mGameCallbacks;
64 ::ll::TypedStorage<8, 8, ::IMinecraftEventing&> mEventing;
65 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ResourcePackManager>> mResourceLoader;
66 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::StructureManager>> mStructureManager;
67 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameModuleServer>> mGameModuleServer;
68 ::ll::TypedStorage<8, 8, ::PermissionsFile*> mPermissionsFile;
69 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::PrivateKeyManager>> mServerKeys;
70 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftServiceKeyManager>> mMinecraftServiceKeys;
71 ::ll::TypedStorage<8, 32, ::std::string const> mSaveGamePath;
72 ::ll::TypedStorage<8, 8, ::ServerMetrics*> mServerMetrics;
73 ::ll::TypedStorage<1, 1, bool const> mIsDedicatedServer;
74 ::ll::TypedStorage<1, 1, bool> mCorruptionDetected;
75 ::ll::TypedStorage<1, 1, bool> mFireOnLevelCorrupt;
76 ::ll::TypedStorage<8, 8, double> mFrameDuration;
77 ::ll::TypedStorage<8, 8, double> mLastFrameStart;
78 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mMaxPlayerIdleTime;
79 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::DefaultCommandsContextProvider>> mDefaultCommandsContextProvider;
80 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftCommands>> mCommands;
81 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::GameSession>> mGameSession;
82 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::GameTestLevelListener>> mGameTestLevelListener;
83 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::MinecraftGameTest>> mGameTest;
84 ::ll::TypedStorage<8, 8, ::Timer&> mSimTimer;
85 ::ll::TypedStorage<8, 8, ::Timer&> mRealTimer;
86 ::ll::TypedStorage<8, 16, ::ClientOrServerNetworkSystemRef> mNetwork;
87 ::ll::TypedStorage<8, 8, ::PacketSender&> mPacketSender;
88 ::ll::TypedStorage<1, 1, ::SubClientId> mClientSubId;
89 ::ll::TypedStorage<8, 16, ::OwnerPtr<::EntityRegistry>> mEntityRegistry;
90 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ITickingSystem>> mAddMovementTickForCatchup;
91 ::ll::TypedStorage<
92 8,
93 8,
94 ::std::unique_ptr<
96 mLevelSubscribers;
97 ::ll::TypedStorage<8, 64, ::brstd::move_only_function<void() const>> mRequestServerShutdown;
98 ::ll::TypedStorage<
99 8,
100 64,
102 ::std::unique_ptr<::ServerNetworkHandler>(::MinecraftArguments::CreateServerNetworkHandlerArgs&&)>>
103 mCreateServerNetworkHandler;
104 ::ll::TypedStorage<8, 64, ::brstd::move_only_function<::Bedrock::NotNullNonOwnerPtr<::FileArchiver>() const>>
105 mGetFileArchiver;
106 ::ll::TypedStorage<
107 8,
108 64,
110 ::std::unique_ptr<::MinecraftCommands>(::MinecraftArguments::CreateMinecraftCommandsArgs&&) const>>
111 mCreateMinecraftCommands;
112 // NOLINTEND
113
114public:
115 // prevent constructor by default
116 Minecraft& operator=(Minecraft const&);
117 Minecraft(Minecraft const&);
118 Minecraft();
119
120public:
121 // virtual functions
122 // NOLINTBEGIN
123 virtual ~Minecraft() /*override*/;
124
125 virtual void setSimTimePause(bool pause);
126
127 virtual void setSimTimeScale(float scale);
128
129 virtual bool getSimPaused() const;
130
131 virtual bool isOnlineClient() const;
132
133 virtual ::StackRefResult<::EntityRegistry> getEntityRegistry() /*override*/;
134
135 virtual ::StackRefResult<::EntityRegistry const> getEntityRegistry() const /*override*/;
136 // NOLINTEND
137
138public:
139 // member functions
140 // NOLINTBEGIN
141 MCAPI explicit Minecraft(::MinecraftArguments&& args);
142
143 MCAPI void _tryCatchupMovementTicks();
144
145 MCAPI void configureGameTest(::Level& level, ::Experiments const& experiments);
146
147 MCAPI void disconnectClient(::NetworkIdentifier const& id, ::Connection::DisconnectFailReason disconnectReason);
148
149#ifdef LL_PLAT_S
150 MCAPI ::optional_ref<::MinecraftGameTest> getGameTest();
151#endif
152
153 MCAPI ::Level* getLevel() const;
154
155#ifdef LL_PLAT_C
156 MCAPI ::Bedrock::NonOwnerPointer<::NetEventCallback> getNetEventCallback();
157#endif
158
159 MCAPI ::Bedrock::NonOwnerPointer<::ServerNetworkHandler> getServerNetworkHandler();
160
161#ifdef LL_PLAT_C
162 MCAPI ::ServerNetworkSystem& getServerNetworkSystem();
163#endif
164
165 MCAPI ::Bedrock::NotNullNonOwnerPtr<::StructureManager> getStructureManager();
166
167 MCAPI bool hostMultiplayer(
168 ::std::string const& serverName,
169 ::std::pair<::std::unique_ptr<::Level>, ::OwnerPtr<::EntityContext>> levelEntity,
170 ::std::string const& hostPublicKey,
171 ::std::unique_ptr<::NetEventCallback> clientNetworkHandler,
172 int maxChunkRadius,
173 bool shouldAnnounce,
174 ::ConnectionDefinition const& connectionDefinition,
175 ::std::unordered_map<::PackIdVersion, ::std::string> const& packIdToContentKey,
176 ::Scheduler& scheduler,
177 ::TextFilteringProcessor* textFilteringProcessor,
178 ::NetworkServerConfig const& packetHandlerConfig,
179 ::std::shared_ptr<::ScriptPackSettingsCache> packSettingsCache,
180 ::ServerNetworkHandlerDependencies&& serverNetworkOptions
181 );
182
183 MCAPI void init();
184
185#ifdef LL_PLAT_C
186 MCAPI void initCommands();
187
188 MCAPI ::Bedrock::PubSub::Subscription registerLevelListener(::std::function<void(::Level*)> callback) const;
189
190 MCAPI bool requestInGamePause(bool status);
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 void tickSimtime(int nTick, int maxTick);
200
201 MCAPI bool update();
202 // NOLINTEND
203
204public:
205 // static functions
206 // NOLINTBEGIN
207 MCAPI static void _tryCatchupMovementTicks(
208 ::EntitySystems& entitySystems,
209 ::EntityRegistry& registry,
210 ::std::unique_ptr<::ITickingSystem>& addMovementTickForCatchup
211 );
212 // NOLINTEND
213
214public:
215 // constructor thunks
216 // NOLINTBEGIN
217 MCAPI void* $ctor(::MinecraftArguments&& args);
218 // NOLINTEND
219
220public:
221 // destructor thunk
222 // NOLINTBEGIN
223 MCAPI void $dtor();
224 // NOLINTEND
225
226public:
227 // virtual function thunks
228 // NOLINTBEGIN
229 MCAPI void $setSimTimePause(bool pause);
230
231 MCAPI void $setSimTimeScale(float scale);
232
233 MCAPI bool $getSimPaused() const;
234
235 MCAPI bool $isOnlineClient() const;
236
237 MCFOLD ::StackRefResult<::EntityRegistry> $getEntityRegistry();
238
239 MCFOLD ::StackRefResult<::EntityRegistry const> $getEntityRegistry() const;
240
241
242 // NOLINTEND
243
244public:
245 // vftables
246 // NOLINTBEGIN
247 MCAPI static void** $vftable();
248 // NOLINTEND
249};
static MCAPI void ** $vftable()
Definition Publisher.h:8
Definition Subscription.h:10
Definition DefaultCommandsContextProvider.h:17
Definition EntityContext.h:16
Definition EntityRegistry.h:10
Definition EntitySystems.h:26
Definition Experiments.h:14
Definition FileArchiver.h:36
Definition GameCallbacks.h:5
Definition GameModuleServer.h:27
Definition GameSession.h:21
Definition GameTestLevelListener.h:15
Definition IEntityRegistryOwner.h:14
Definition IMinecraftEventing.h:134
Definition ITickingSystem.h:15
Definition Level.h:250
Definition MinecraftCommands.h:34
Definition MinecraftGameTest.h:20
Definition MinecraftServiceKeyManager.h:19
Definition NetEventCallback.h:258
Definition NetworkIdentifier.h:10
Definition OwnerPtr.h:7
Definition PacketSender.h:17
Definition PermissionsFile.h:17
Definition PrivateKeyManager.h:9
Definition ResourcePackManager.h:30
Definition Scheduler.h:14
Definition ScriptPackSettingsCache.h:17
Definition ServerMetrics.h:10
Definition ServerNetworkHandler.h:177
Definition ServerNetworkSystem.h:34
Definition StructureManager.h:45
Definition TextFilteringProcessor.h:18
Definition Timer.h:5
Definition move_only_function.h:9
Definition ConnectionDefinition.h:5
Definition MinecraftArguments.h:29
Definition MinecraftArguments.h:43
Definition MinecraftArguments.h:18
Definition NetworkServerConfig.h:9
Definition PackIdVersion.h:10
Definition ServerNetworkHandlerDependencies.h:5