37 enum class LoadMode :
int {
45 ::ll::TypedStorage<4, 4, int> mChunkSide;
46 ::ll::TypedStorage<8, 8, ::Level*> mLevel;
47 ::ll::TypedStorage<8, 8, ::Dimension*> mDimension;
48 ::ll::TypedStorage<8, 8, ::ChunkSource*> mParent;
49 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ChunkSource>> mOwnedParent;
50 ::ll::TypedStorage<8, 8, ::LevelChunkBuilderData*> mLevelChunkBuilderData;
51 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mShuttingDown;
52 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnSaveSubscription;
53 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnLevelStorageAppSuspendSubscription;
63 virtual void shutdown();
66 virtual bool isShutdownDone();
69 virtual ::std::shared_ptr<::LevelChunk> getExistingChunk(
::ChunkPos const&);
72 virtual ::std::shared_ptr<::LevelChunk> getRandomChunk(
::Random& random);
75 virtual bool isChunkKnown(
::ChunkPos const& chunkPos);
78 virtual bool isChunkSaved(
::ChunkPos const& chunkPos);
81 virtual ::std::shared_ptr<::LevelChunk>
82 createNewChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
85 virtual ::std::shared_ptr<::LevelChunk>
86 getOrLoadChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
95 virtual void loadChunk(
::LevelChunk& lc,
bool forceImmediateReplacementDataLoad);
98 virtual void postProcessMobsAt(
::BlockSource& region,
int chunkWestBlock,
int chunkNorthBlock,
::Random& random);
107 virtual void writeEntityChunkTransfer(
::LevelChunk& levelChunk);
110 virtual void writeEntityChunkTransfersToUnloadedChunk(
112 ::std::vector<::ActorUnloadedChunkTransferEntry>
const& transfers
116 virtual void deserializeActorStorageToLevelChunk(
::LevelChunk& levelChunk);
119 virtual void hintDiscardBatchBegin();
122 virtual void hintDiscardBatchEnd();
125 virtual void acquireDiscarded(::std::unique_ptr<::LevelChunk, ::LevelChunkFinalDeleter> ptr);
128 virtual void compact();
131 virtual void flushPendingDiscardedChunkWrites();
134 virtual void flushThreadBatch();
137 virtual bool isWithinWorldLimit(
::ChunkPos const& cp)
const;
140 virtual ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const* getChunkMap();
143 virtual ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const& getStorage()
const;
146 virtual void clearDeletedEntities();
149 virtual bool canCreateViews()
const;
152 virtual ::std::unique_ptr<::BlendingDataProvider> tryGetBlendingDataProvider();
155 virtual ::std::shared_ptr<::LevelChunkMetaDataDictionary> loadLevelChunkMetaDataDictionary();
158 virtual void setLevelChunk(::std::shared_ptr<::LevelChunk>);
161 virtual bool canLaunchTasks()
const;
164 virtual bool chunkPosNeedsBlending(
::ChunkPos const& cp);
170 MCAPI
explicit ChunkSource(::std::unique_ptr<::ChunkSource> parent);
172 MCAPI
bool _checkAndDispatchTaskForLevelChunk(
173 ::std::pair<::ChunkPos, ::ChunkState>
const& chunkPosAndExpectedState,
179 MCAPI
void _checkForUnblockingChunks(
::LevelChunk const& lc);
181 MCAPI
void _checkLevelChunkForNextStage(
184 ::ChunkState stateToCheck
187 MCAPI
void _checkLevelChunkForPostProcessing(
192 MCAPI
bool _chunkAtStage(::std::weak_ptr<::LevelChunk> lcwp, ::ChunkState stateToCheck);
194 MCAPI
void _createOrReplaceGridAreaMap(::std::shared_ptr<::LevelChunk> lc,
bool createNeighbourGridsIfMissing);
196 MCAPI
void _freeChunkGenerationGridMap(
::ChunkPos const& cp,
bool isLevelChunkDeletion);
198 MCAPI
void _launchGenerationTask(::std::shared_ptr<::LevelChunk>
const& lc,
bool areInTask);
200 MCAPI
void _launchLightingTask(
201 ::std::shared_ptr<::LevelChunk>
const& lc,
202 ::std::shared_ptr<::ChunkViewSource>
const& chunks,
206 MCAPI
void _launchPostProcessingTask(
207 ::std::shared_ptr<::LevelChunk>
const& lc,
208 ::std::shared_ptr<::ChunkViewSource>
const& chunks,
212 MCAPI
void _launchReplacementDataTask(
213 ::std::shared_ptr<::LevelChunk>
const& lc,
214 ::std::shared_ptr<::ChunkViewSource>
const& chunks,
218 MCAPI
void _lightingTask(::std::shared_ptr<::LevelChunk>
const& lc,
::ChunkViewSource& chunks);
226 MCAPI
void _spawnChunkGenerationTasks(
int numTasks,
bool calledFromTask);
228 MCAPI
void checkAndLaunchChunkGenerationTasks(
bool calledFromTask);
230 MCAPI ::GridArea<::std::shared_ptr<::LevelChunk>> createEmptyView(
231 ::ChunkSource::LoadMode lm,
234 ::ChunkSourceViewGenerateMode chunkViewGenerateMode,
235 float const* serverBuildRatio
238 MCAPI ::std::shared_ptr<::LevelChunk> getAvailableChunk(
::ChunkPos const& cp);
243 MCAPI
bool shouldServerGeneratePos(
::ChunkPos const& chunkPos,
float serverBuildRatio,
int viewRadius);
249 MCAPI
static bool& gPerfIsClientSide();
255 MCAPI
void* $ctor(::std::unique_ptr<::ChunkSource> parent);
267 MCAPI
void $shutdown();
269 MCAPI
bool $isShutdownDone();
271 MCFOLD ::std::shared_ptr<::LevelChunk> $getExistingChunk(
::ChunkPos const&);
273 MCFOLD ::std::shared_ptr<::LevelChunk> $getRandomChunk(
::Random& random);
275 MCAPI
bool $isChunkKnown(
::ChunkPos const& chunkPos);
277 MCAPI
bool $isChunkSaved(
::ChunkPos const& chunkPos);
279 MCAPI ::std::shared_ptr<::LevelChunk>
280 $createNewChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
282 MCAPI ::std::shared_ptr<::LevelChunk>
283 $getOrLoadChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
289 MCAPI
void $loadChunk(
::LevelChunk& lc,
bool forceImmediateReplacementDataLoad);
291 MCAPI
void $postProcessMobsAt(
::BlockSource& region,
int chunkWestBlock,
int chunkNorthBlock,
::Random& random);
297 MCAPI
void $writeEntityChunkTransfer(
::LevelChunk& levelChunk);
299 MCAPI
void $writeEntityChunkTransfersToUnloadedChunk(
301 ::std::vector<::ActorUnloadedChunkTransferEntry>
const& transfers
304 MCAPI
void $deserializeActorStorageToLevelChunk(
::LevelChunk& levelChunk);
306 MCAPI
void $hintDiscardBatchBegin();
308 MCAPI
void $hintDiscardBatchEnd();
310 MCAPI
void $acquireDiscarded(::std::unique_ptr<::LevelChunk, ::LevelChunkFinalDeleter> ptr);
312 MCAPI
void $compact();
314 MCAPI
void $flushPendingDiscardedChunkWrites();
316 MCAPI
void $flushThreadBatch();
318 MCFOLD
bool $isWithinWorldLimit(
::ChunkPos const& cp)
const;
320 MCFOLD ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const* $getChunkMap();
322 MCAPI ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const& $getStorage()
const;
324 MCFOLD
void $clearDeletedEntities();
326 MCFOLD
bool $canCreateViews()
const;
328 MCAPI ::std::unique_ptr<::BlendingDataProvider> $tryGetBlendingDataProvider();
330 MCAPI ::std::shared_ptr<::LevelChunkMetaDataDictionary> $loadLevelChunkMetaDataDictionary();
332 MCFOLD
void $setLevelChunk(::std::shared_ptr<::LevelChunk>);
334 MCAPI
bool $canLaunchTasks()
const;
336 MCAPI
bool $chunkPosNeedsBlending(
::ChunkPos const& cp);
342 MCAPI
static void** $vftable();