3#include "mc/_HeaderOutputPredefine.h"
6#include "mc/client/gui/screens/models/LegacyWorldConversionManager.h"
7#include "mc/client/gui/screens/models/MainMenuScreenModel.h"
8#include "mc/client/gui/screens/models/interface/IWorldsProvider.h"
9#include "mc/client/gui/screens/models/interface/WorldType.h"
10#include "mc/client/legacy/ImportStatus.h"
11#include "mc/client/network/realms/GenericStatus.h"
12#include "mc/client/network/realms/RealmId.h"
13#include "mc/client/world/NetworkWorldType.h"
14#include "mc/deps/core/file/PathBuffer.h"
15#include "mc/deps/core/resource/PackType.h"
16#include "mc/deps/core/threading/Async.h"
17#include "mc/deps/core/utility/pub_sub/Subscription.h"
18#include "mc/events/IMinecraftEventing.h"
19#include "mc/platform/ErrorInfo.h"
20#include "mc/platform/Result.h"
21#include "mc/util/CallbackToken.h"
22#include "mc/util/UploadState.h"
23#include "mc/world/level/LevelListCacheObserver.h"
41namespace Core {
class Path; }
44namespace MSGraph::Models {
struct GraphError; }
45namespace Realms {
struct World; }
62 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Social::MultiplayerGameInfo>> server;
63 ::ll::TypedStorage<1, 1, bool> found;
64 ::ll::TypedStorage<8, 8, double> lastFoundTime;
65 ::ll::TypedStorage<1, 1, bool> dead;
73 ::ll::TypedStorage<8, 8, ::PlayScreenModel&> mModel;
78 PlayScreenLevelListCacheObserver& operator=(PlayScreenLevelListCacheObserver
const&);
79 PlayScreenLevelListCacheObserver(PlayScreenLevelListCacheObserver
const&);
80 PlayScreenLevelListCacheObserver();
86 onLevelAdded(::std::string
const& levelId, ::LevelListCacheObserver::LevelAddedType type) ;
88 virtual void onLevelUpdated(::std::string
const& levelId) ;
90 virtual void onLevelDeleted(::std::string
const& levelId) ;
92 virtual void onStorageChanged() ;
98 MCAPI
void $onLevelAdded(::std::string
const& levelId, ::LevelListCacheObserver::LevelAddedType type);
100 MCAPI
void $onLevelUpdated(::std::string
const& levelId);
102 MCAPI
void $onLevelDeleted(::std::string
const& levelId);
104 MCAPI
void $onStorageChanged();
108 using PlayerCountMap = ::std::map<::Realms::RealmId, int>;
110 using RealmFullMap = ::std::map<::Realms::RealmId, bool>;
112 using RealmsWorldList = ::std::vector<::Realms::World>;
114 using StashedNetworkSelection = ::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>;
119 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::pair<::NetworkWorldInfo const, ::NetworkWorldType>>>
120 mLastNetworkSelection;
121 ::ll::TypedStorage<1, 1, bool> mIsDirty;
122 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mLocalWorldList;
123 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mBetaRetailLocalWorldList;
124 ::ll::TypedStorage<8, 24, ::std::vector<::WorldTemplateInfo>> mWorldTemplates;
125 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mFriendsNetworkWorldList;
126 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mCrossPlatformFriendsNetworkWorldList;
127 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mLANNetworkWorldList;
128 ::ll::TypedStorage<8, 24, ::std::vector<::NetworkWorldInfo>> mServerNetworkWorldList;
129 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mRealmWorldList;
130 ::ll::TypedStorage<8, 24, ::std::vector<::RealmsWorldInfo>> mUnpairedParentRealmWorldList;
131 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::NetworkWorldInfo>>> mThirdPartyServerWorldList;
132 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mLegacyWorldList;
133 ::ll::TypedStorage<8, 24, ::std::vector<::LegacyWorldInfo>> mBetaRetailLegacyWorldList;
134 ::ll::TypedStorage<8, 64, ::std::unordered_map<::std::string, ::ResourceLocation>> mNetworkedFriendsGamerpicMap;
135 ::ll::TypedStorage<8, 72, ::std::chrono::steady_clock::time_point[9]> mUpdateTimes;
136 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mWorlds;
137 ::ll::TypedStorage<1, 1, bool> mWorldsFetched;
138 ::ll::TypedStorage<8, 24, ::std::vector<::Realms::World>> mUnpairedParentWorlds;
139 ::ll::TypedStorage<1, 1, bool> mUnpairedWorldsFetched;
140 ::ll::TypedStorage<8, 16, ::std::map<::Realms::RealmId, int>> mUnreadCounts;
141 ::ll::TypedStorage<4, 4, int> mRealmWorldPartitionIndex;
142 ::ll::TypedStorage<4, 24, ::std::array<int, 6>> mSeenUnreadPosts;
143 ::ll::TypedStorage<1, 1, bool> mLocalWorldsPopulated;
144 ::ll::TypedStorage<1, 1, bool> mHasPendingInvites;
145 ::ll::TypedStorage<4, 4, int> mPendingInviteCount;
146 ::ll::TypedStorage<1, 1, bool> mFetchingInvites;
147 ::ll::TypedStorage<1, 1, bool> mFetchingLegacyWorldsInProgress;
148 ::ll::TypedStorage<1, 1, bool> mLegacyWorldsFetched;
149 ::ll::TypedStorage<1, 1, bool> mFoundLegacyWorlds;
150 ::ll::TypedStorage<8, 128, ::LegacyWorldConversionManager> mLegacyWorldConversionManager;
151 ::ll::TypedStorage<8, 24, ::std::vector<::LocalWorldInfo>> mEduCloudWorlds;
152 ::ll::TypedStorage<1, 1, bool> mFetchingEduCloudWorldsInProgress;
153 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsFetched;
154 ::ll::TypedStorage<1, 1, bool> mEduCloudWorldsPopulated;
155 ::ll::TypedStorage<1, 1, bool> mEduCloudFetchFailed;
156 ::ll::TypedStorage<4, 4, int> mEduCloudWorldsFetchRetriesRemaining;
157 ::ll::TypedStorage<8, 32, ::std::string> mEduCloudWorldsFetchNextLinkUrl;
161 ::Bedrock::Threading::Async<
162 ::Bedrock::Result<::MSGraph::Models::DriveItemCollection, ::MSGraph::Models::GraphError>>>
163 mEduCloudWorldsHandle;
164 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mFetchStartTimestamp;
165 ::ll::TypedStorage<8, 32, ::std::string> mFetchCorrelationId;
166 ::ll::TypedStorage<1, 1, bool> mFetchingPlayerCounts;
167 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastRealmsUpdate;
168 ::ll::TypedStorage<1, 1, bool> mJoiningRealm;
169 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastTryJoin;
170 ::ll::TypedStorage<8, 8, ::std::chrono::seconds> mRetryJoinInterval;
171 ::ll::TypedStorage<4, 4, int> mRetryTime;
172 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mPendingInviteCountSubscriber;
173 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::Legacy::WorldImporter>> mLegacyWorldImporter;
174 ::ll::TypedStorage<8, 16, ::CallbackToken> mRetrieveCallbackToken;
175 ::ll::TypedStorage<8, 16, ::CallbackToken> mImportCallbackToken;
176 ::ll::TypedStorage<1, 1, bool> mFirstRealmsFetchComplete;
177 ::ll::TypedStorage<1, 1, bool> mFirstUnpairedParentRealmsFetchComplete;
178 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mRealmsStatus;
179 ::ll::TypedStorage<4, 4, ::Realms::GenericStatus> mUnpairedParentRealmsStatus;
180 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastPlayerCountUpdate;
181 ::ll::TypedStorage<8, 24, ::PlayScreenModel::PlayScreenLevelListCacheObserver> mLevelListCacheObserver;
182 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mTrialModeUpdateSubscription;
183 ::ll::TypedStorage<1, 1, bool> mAreTrialWorldsHidden;
184 ::ll::TypedStorage<1, 1, bool> mIsEditScreenLoading;
185 ::ll::TypedStorage<1, 1, bool> mIsLoadingAdditionalRealmInfo;
186 ::ll::TypedStorage<4, 4, int> mNumRealmsWorldsToQuery;
187 ::ll::TypedStorage<8, 16, ::std::set<::Realms::RealmId>> mWorldsWithDetailedInfo;
188 ::ll::TypedStorage<1, 1, bool> initRequestPendingInvites;
198 virtual ~PlayScreenModel() =
default;
200 virtual int getWorldCount(::WorldType worldType, ::NetworkWorldType networkType)
const ;
202 virtual ::LocalWorldInfo
const* getLocalWorldAtIndex(
int const index)
const ;
204 virtual ::LocalWorldInfo
const* getLocalWorldById(::std::string
const&
id)
const ;
206 virtual bool refresh(::WorldType tabType) ;
208 virtual void startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings
const* settings) ;
210 virtual bool isDirty() const ;
212 virtual ::IMinecraftEventing& getMinecraftEventing() const ;
218 MCAPI explicit PlayScreenModel(::MinecraftScreenModelContext context);
220 MCAPI
void _navigateToEditWorldScreen(::LocalWorldInfo const& info);
222 MCAPI
void _populateAdditionalRealmsWorldsInfo();
224 MCAPI
void _populateLocalWorldsFromStorageSource(
225 ::ILevelListCache& levelListCache,
226 ::std::vector<::LocalWorldInfo>& localWorlds,
227 ::std::vector<::LocalWorldInfo>& betaRetailWorlds,
232 MCAPI
void _populateNetworkWorlds();
234 MCAPI
void _populateRealmsWorldsInternal(
bool ofUnpairedParentRealms);
236 MCAPI
void _remove3PServersMismatchingEditorMode();
238 MCAPI
void _sortRealmsWorlds(::std::
string const currentUserXUID, ::std::vector<::Realms::World>& worlds);
240 MCAPI
void _start3PNetworkWorld(::NetworkWorldInfo& world);
242 MCAPI
void _startFriendNetworkWorld(::NetworkWorldInfo const& world);
244 MCAPI
void _startRemoteNetworkWorld(::NetworkWorldInfo const& world);
246 MCAPI
bool areExternalAndRemoteServerSame(::ExternalServer& externalServer, ::PingedCompatibleServer remoteServer);
248 MCAPI
void convertLegacyWorld(
249 ::LegacyWorldInfo worldInfo,
250 ::std::
string const& newWorldDir,
251 ::std::function<
void(::Legacy::ImportStatus,
float, ::std::shared_ptr<::ImportResult>)> callback
254 MCAPI ::Core::PathBuffer<::std::
string> const createUniquePathForWorld() const;
256 MCAPI
void deleteLegacyWorld(uint legacyWorldIndex);
258 MCAPI
void fetchEduCloudWorlds();
260 MCAPI
void fetchRealmsPlayerCounts();
262 MCAPI
void fetchRealmsWorldsForPlayScreen();
264 MCAPI
void fetchThirdPartyServerWorlds(
bool forceFetch);
266 MCAPI
void fireIgnoredNotificationsEvent(
267 ::IMinecraftEventing::IgnoredNotificationsType notificationType,
268 int notificationCount,
269 ::std::set<::IMinecraftEventing::IgnoredNotificationSource> notificationSources
272 MCAPI ::std::shared_ptr<::FilePickerSettings> generateFilePickerSettingsForImport();
274 MCAPI
bool getFetchingThirdPartyWorldsInProgress() const;
276 MCAPI ::std::vector<::ResourceLocation> getLoadingPacks(::PackType type) const;
278 MCAPI
void handleLegacyWorldConversionComplete(::ImportResult const& result);
280 MCAPI
bool hasLocalWorldWithId(::std::
string const& levelId);
282 MCAPI
void initializeRealmsWorlds();
284 MCAPI
bool isEditorPlaytestRoundtrip() const;
286 MCAPI
bool isLocalWorldRealmsPlus(::LocalWorldInfo const& world);
288 MCAPI
void navigateToAddEditExternalScreen(
int id);
290 MCAPI
void navigateToEditWorldScreen(
int index, ::std::function<
void(::Core::Path const&)> onErrorCallback);
293 navigateToEditWorldScreen(::LocalWorldInfo* info, ::std::function<
void(::Core::Path const&)> onErrorCallback);
296 navigateToEditWorldScreen(::std::
string const& levelId, ::std::function<
void(::Core::Path const&)> onErrorCallback);
298 MCAPI
void navigateToRealmsSharingLauncherScreen(::std::
string const& realmsInvite);
300 MCAPI
void navigateToWorldSyncModalScreen(
301 ::std::
string const& levelId,
302 ::std::function<
void(::nonstd::expected<
void, ::Bedrock::ErrorInfo<::std::error_code>>)> onCompleteCallback
305 MCAPI ::LocalWorldInfo refreshLocalWorldInfo(::LocalWorldInfo const& worldInfo);
307 MCAPI
void repopulateLocalWorlds();
309 MCAPI
void startNetworkWorld(::NetworkWorldInfo worldInfo, ::NetworkWorldType worldType);
311 MCAPI ::Bedrock::PubSub::Subscription subscribeToBuildGameList();
313 MCAPI
bool supportsEduCloudWorlds() const;
315 MCAPI
void triggerMultiplayerGameRefresh(
bool tryToReconnect);
317 MCAPI
void updateWorldTimestamp(::NetworkWorldInfo const& worldInfo);
319 MCAPI
void uploadLocalWorldFileAtIndex(
320 ::std::
string const& realmID,
323 ::std::function<
void(::UploadState, ::Realms::World)> callbackAfterUpload
330 MCAPI
void* $ctor(::MinecraftScreenModelContext context);
336 MCAPI
int $getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const;
338 MCAPI ::LocalWorldInfo const* $getLocalWorldAtIndex(
int const index) const;
340 MCAPI ::LocalWorldInfo const* $getLocalWorldById(::std::
string const&
id) const;
342 MCAPI
bool $refresh(::WorldType tabType);
344 MCAPI
void $startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const* settings);
346 MCAPI
bool $isDirty() const;
348 MCFOLD ::IMinecraftEventing& $getMinecraftEventing() const;
Definition FilePickerSettings.h:5
Definition ILevelListCache.h:27
Definition IMinecraftEventing.h:147
Definition IWorldsProvider.h:5
Definition WorldImporter.h:7
Definition LevelSettings.h:38
Definition MainMenuScreenModel.h:5
Definition PlayScreenModel.h:16
Definition PlayScreenModel.h:5
Definition ResourceLocation.h:15
Definition MultiplayerGameInfo.h:7
Definition ExternalServer.h:5
Definition ImportResult.h:5
Definition LegacyWorldInfo.h:5
Definition LocalWorldInfo.h:5
Definition DriveItemCollection.h:7
Definition GraphError.h:7
Definition MinecraftScreenModelContext.h:5
Definition NetworkWorldInfo.h:5
Definition PingedCompatibleServer.h:5
Definition PlayScreenModel.h:14
Definition RealmsWorldInfo.h:5
Definition WorldTemplateInfo.h:12