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/WorldType.h"
9#include "mc/client/gui/screens/models/interface/IWorldsProvider.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 _fetchTrialAvailability();
222 MCAPI
void _navigateToEditWorldScreen(::LocalWorldInfo const& info);
224 MCAPI
void _populateAdditionalRealmsWorldsInfo();
226 MCAPI
void _populateLocalWorldsFromStorageSource(
227 ::ILevelListCache& levelListCache,
228 ::std::vector<::LocalWorldInfo>& localWorlds,
229 ::std::vector<::LocalWorldInfo>& betaRetailWorlds,
234 MCAPI
void _populateNetworkWorlds();
236 MCAPI
void _populateRealmsWorldsInternal(
bool ofUnpairedParentRealms);
238 MCAPI
void _remove3PServersMismatchingEditorMode();
240 MCAPI
void _requestPendingInviteCount();
242 MCAPI
void _sortRealmsWorlds(::std::
string const currentUserXUID, ::std::vector<::Realms::World>& worlds);
244 MCAPI
void _start3PNetworkWorld(::NetworkWorldInfo& world);
246 MCAPI
void _startFriendNetworkWorld(::NetworkWorldInfo const& world);
248 MCAPI
void _startRemoteNetworkWorld(::NetworkWorldInfo const& world);
250 MCAPI
bool areExternalAndRemoteServerSame(::ExternalServer& externalServer, ::PingedCompatibleServer remoteServer);
252 MCAPI
void convertLegacyWorld(
253 ::LegacyWorldInfo worldInfo,
254 ::std::
string const& newWorldDir,
255 ::std::function<
void(::Legacy::ImportStatus,
float, ::std::shared_ptr<::ImportResult>)> callback
258 MCAPI ::Core::PathBuffer<::std::
string> const createUniquePathForWorld() const;
260 MCAPI
void deleteLegacyWorld(uint legacyWorldIndex);
262 MCAPI
void fetchEduCloudWorlds();
264 MCAPI
void fetchRealmsPlayerCounts();
266 MCAPI
void fetchRealmsWorldsForPlayScreen();
268 MCAPI
void fetchThirdPartyServerWorlds(
bool forceFetch);
270 MCAPI
void fireIgnoredNotificationsEvent(
271 ::IMinecraftEventing::IgnoredNotificationsType notificationType,
272 int notificationCount,
273 ::std::set<::IMinecraftEventing::IgnoredNotificationSource> notificationSources
276 MCAPI ::std::shared_ptr<::FilePickerSettings> generateFilePickerSettingsForImport();
278 MCAPI
bool getFetchingThirdPartyWorldsInProgress() const;
280 MCAPI ::std::vector<::ResourceLocation> getLoadingPacks(::PackType type) const;
282 MCAPI
void handleLegacyWorldConversionComplete(::ImportResult const& result);
284 MCAPI
bool hasLocalWorldWithId(::std::
string const& levelId);
286 MCAPI
void initLegacyWorldImporter();
288 MCAPI
void initializeRealmsWorlds();
290 MCAPI
bool isEditorPlaytestRoundtrip() const;
292 MCAPI
bool isLocalWorldRealmsPlus(::LocalWorldInfo const& world);
294 MCAPI
void navigateToAddEditExternalScreen(
int id);
296 MCAPI
void navigateToEditWorldScreen(
int index, ::std::function<
void(::Core::Path const&)> onErrorCallback);
299 navigateToEditWorldScreen(::LocalWorldInfo* info, ::std::function<
void(::Core::Path const&)> onErrorCallback);
302 navigateToEditWorldScreen(::std::
string const& levelId, ::std::function<
void(::Core::Path const&)> onErrorCallback);
304 MCAPI
void navigateToRealmsSharingLauncherScreen(::std::
string const& realmsInvite);
306 MCAPI
void navigateToWorldSyncModalScreen(
307 ::std::
string const& levelId,
308 ::std::function<
void(::nonstd::expected<
void, ::Bedrock::ErrorInfo<::std::error_code>>)> onCompleteCallback
311 MCAPI ::LocalWorldInfo refreshLocalWorldInfo(::LocalWorldInfo const& worldInfo);
313 MCAPI
void repopulateLocalWorlds();
315 MCAPI
void startNetworkWorld(::NetworkWorldInfo worldInfo, ::NetworkWorldType worldType);
317 MCAPI ::Bedrock::PubSub::Subscription subscribeToBuildGameList();
319 MCAPI
bool supportsEduCloudWorlds() const;
321 MCAPI
void triggerMultiplayerGameRefresh(
bool tryToReconnect);
323 MCAPI
void updateWorldTimestamp(::NetworkWorldInfo const& worldInfo);
325 MCAPI
void uploadLocalWorldFileAtIndex(
326 ::std::
string const& realmID,
329 ::std::function<
void(::UploadState, ::Realms::World)> callbackAfterUpload
336 MCAPI
void* $ctor(::MinecraftScreenModelContext context);
342 MCAPI
int $getWorldCount(::WorldType worldType, ::NetworkWorldType networkType) const;
344 MCAPI ::LocalWorldInfo const* $getLocalWorldAtIndex(
int const index) const;
346 MCAPI ::LocalWorldInfo const* $getLocalWorldById(::std::
string const&
id) const;
348 MCAPI
bool $refresh(::WorldType tabType);
350 MCAPI
void $startLocalWorld(::LocalWorldInfo worldInfo, ::LevelSettings const* settings);
352 MCAPI
bool $isDirty() const;
354 MCFOLD ::IMinecraftEventing& $getMinecraftEventing() const;
Definition FilePickerSettings.h:5
Definition ILevelListCache.h:27
Definition IMinecraftEventing.h:145
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