40 enum class LoadMode :
int {
48 ::ll::TypedStorage<4, 4, int> mChunkSide;
49 ::ll::TypedStorage<8, 8, ::Level*> mLevel;
50 ::ll::TypedStorage<8, 8, ::Dimension*> mDimension;
51 ::ll::TypedStorage<8, 8, ::ChunkSource*> mParent;
52 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::ChunkSource>> mOwnedParent;
53 ::ll::TypedStorage<8, 8, ::LevelChunkBuilderData*> mLevelChunkBuilderData;
54 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mShuttingDown;
55 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnSaveSubscription;
56 ::ll::TypedStorage<8, 16, ::Bedrock::PubSub::Subscription> mOnLevelStorageAppSuspendSubscription;
66 virtual ~ChunkSource() ;
68 virtual void shutdown();
70 virtual bool isShutdownDone();
72 virtual ::std::shared_ptr<::LevelChunk> getExistingChunk(
::ChunkPos const& pos);
74 virtual ::std::shared_ptr<::LevelChunk> getRandomChunk(
::Random& random);
76 virtual bool isChunkKnown(
::ChunkPos const& chunkPos);
78 virtual bool isChunkSaved(
::ChunkPos const& chunkPos);
80 virtual ::std::shared_ptr<::LevelChunk>
81 createNewChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
83 virtual ::std::shared_ptr<::LevelChunk>
84 getOrLoadChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
92 virtual bool verifyChunkNeedsNeighborAwareUpgrade(
::LevelChunk& lc);
96 virtual void loadChunk(
::LevelChunk& lc,
bool forceImmediateReplacementDataLoad);
98 virtual void postProcessMobsAt(
::BlockSource& region,
int chunkWestBlock,
int chunkNorthBlock,
::Random& random);
102 virtual void deleteAllChunkData(
103 ::std::unordered_set<::ChunkPos> chunksToDelete,
104 ::std::function<
void()> completionCallback,
105 ::std::shared_ptr<::ChunkDeletionMetadata> metadata
108 virtual void deleteStoredChunkData(
109 ::std::unordered_set<::ChunkPos> chunksToDelete,
110 ::std::function<
void()> completionCallback,
111 ::std::shared_ptr<::ChunkDeletionMetadata> metadata
116 virtual void writeEntityChunkTransfer(
::LevelChunk& levelChunk);
118 virtual void writeEntityChunkTransfersToUnloadedChunk(
120 ::std::vector<::ActorUnloadedChunkTransferEntry>
const& transfers
123 virtual void deserializeActorStorageToLevelChunk(
::LevelChunk& levelChunk);
125 virtual void hintDiscardBatchBegin();
127 virtual void hintDiscardBatchEnd();
129 virtual void acquireDiscarded(::std::unique_ptr<::LevelChunk, ::LevelChunkFinalDeleter> ptr);
131 virtual void compact();
133 virtual void flushPendingDiscardedChunkWrites();
135 virtual void flushThreadBatch();
137 virtual bool isWithinWorldLimit(
::ChunkPos const& cp)
const;
139 virtual ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const* getChunkMap()
const;
141 virtual ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const& getStorage()
const;
143 virtual void clearDeletedEntities();
145 virtual bool canCreateViews()
const;
147 virtual ::std::unique_ptr<::BlendingDataProvider> tryGetBlendingDataProvider();
149 virtual ::std::shared_ptr<::LevelChunkMetaDataDictionary> loadLevelChunkMetaDataDictionary();
151 virtual void setLevelChunk(::std::shared_ptr<::LevelChunk> lc);
153 virtual bool canLaunchTasks()
const;
155 virtual bool chunkPosNeedsBlending(
::ChunkPos const& cp);
157 virtual void _clearBlendingCache();
159 virtual ::std::shared_ptr<::br::worldgen::StructureInstance>
166 MCNAPI
explicit ChunkSource(::std::unique_ptr<::ChunkSource> parent);
169 MCNAPI
void _checkForUnblockingChunks(
::ChunkPos cp);
173 MCNAPI
void _checkForUnblockingChunks(
::ChunkPos cp);
177 MCNAPI
void _createOrReplaceGridAreaMap(::std::shared_ptr<::LevelChunk> lc,
bool createNeighbourGridsIfMissing);
183 ::std::string_view taskName,
194 MCNAPI
void addEmptyChunkPosForProcessingNeighbours(::std::shared_ptr<::LevelChunk> lc);
197 MCAPI
void checkAndLaunchChunkGenerationTasks(
bool calledFromTask);
201 ::ChunkSource::LoadMode lm,
203 ::std::function<
void(::gsl::span<::std::shared_ptr<::LevelChunk>>)> add,
204 ::ChunkSourceViewGenerateMode chunkViewGenerateMode,
205 float const* serverBuildRatio
210 LLAPI ::std::shared_ptr<::LevelChunk> getAvailableChunk(
::ChunkPos const& cp);
225 MCNAPI
void*
$ctor(::std::unique_ptr<::ChunkSource> parent);
237 MCAPI
void $shutdown();
239 MCAPI
bool $isShutdownDone();
241 MCFOLD ::std::shared_ptr<::LevelChunk> $getExistingChunk(
::ChunkPos const& pos);
243 MCFOLD ::std::shared_ptr<::LevelChunk> $getRandomChunk(
::Random& random);
245 MCAPI
bool $isChunkKnown(
::ChunkPos const& chunkPos);
247 MCAPI
bool $isChunkSaved(
::ChunkPos const& chunkPos);
249 MCAPI ::std::shared_ptr<::LevelChunk>
250 $createNewChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
252 MCAPI ::std::shared_ptr<::LevelChunk>
253 $getOrLoadChunk(
::ChunkPos const& cp, ::ChunkSource::LoadMode lm,
bool readOnly);
261 MCFOLD
bool $verifyChunkNeedsNeighborAwareUpgrade(
::LevelChunk& lc);
265 MCAPI
void $loadChunk(
::LevelChunk& lc,
bool forceImmediateReplacementDataLoad);
267 MCAPI
void $postProcessMobsAt(
::BlockSource& region,
int chunkWestBlock,
int chunkNorthBlock,
::Random& random);
271 MCAPI
void $deleteAllChunkData(
272 ::std::unordered_set<::ChunkPos> chunksToDelete,
273 ::std::function<
void()> completionCallback,
274 ::std::shared_ptr<::ChunkDeletionMetadata> metadata
277 MCAPI
void $deleteStoredChunkData(
278 ::std::unordered_set<::ChunkPos> chunksToDelete,
279 ::std::function<
void()> completionCallback,
280 ::std::shared_ptr<::ChunkDeletionMetadata> metadata
285 MCAPI
void $writeEntityChunkTransfer(
::LevelChunk& levelChunk);
287 MCAPI
void $writeEntityChunkTransfersToUnloadedChunk(
289 ::std::vector<::ActorUnloadedChunkTransferEntry>
const& transfers
292 MCAPI
void $deserializeActorStorageToLevelChunk(
::LevelChunk& levelChunk);
294 MCAPI
void $hintDiscardBatchBegin();
296 MCAPI
void $hintDiscardBatchEnd();
298 MCAPI
void $acquireDiscarded(::std::unique_ptr<::LevelChunk, ::LevelChunkFinalDeleter> ptr);
300 MCAPI
void $compact();
302 MCAPI
void $flushPendingDiscardedChunkWrites();
304 MCAPI
void $flushThreadBatch();
306 MCFOLD
bool $isWithinWorldLimit(
::ChunkPos const& cp)
const;
308 MCFOLD ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const* $getChunkMap()
const;
310 MCAPI ::std::unordered_map<::ChunkPos, ::std::weak_ptr<::LevelChunk>>
const& $getStorage()
const;
312 MCFOLD
void $clearDeletedEntities();
314 MCFOLD
bool $canCreateViews()
const;
316 MCAPI ::std::unique_ptr<::BlendingDataProvider> $tryGetBlendingDataProvider();
318 MCAPI ::std::shared_ptr<::LevelChunkMetaDataDictionary> $loadLevelChunkMetaDataDictionary();
321 MCAPI
void $setLevelChunk(::std::shared_ptr<::LevelChunk> lc);
323 MCFOLD
void $setLevelChunk(::std::shared_ptr<::LevelChunk> lc);
326 MCAPI
bool $canLaunchTasks()
const;
328 MCAPI
bool $chunkPosNeedsBlending(
::ChunkPos const& cp);
330 MCAPI
void $_clearBlendingCache();
332 MCAPI ::std::shared_ptr<::br::worldgen::StructureInstance>