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