89 enum class Finalization :
int {
90 NeedsInstaticking = 0,
99 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
105 MCNAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8>
const&
sOffsetMap();
113 ::ll::TypedStorage<1, 1, bool> mWasStored;
114 ::ll::TypedStorage<1, 1, bool> mWasGenerated;
115 ::ll::TypedStorage<1, 1, bool> mWasRequestedInsideTickRange;
116 ::ll::TypedStorage<1, 1, bool> mWasLoadedInsideTickRange;
120 using BlockList = ::std::vector<::BlockPos>;
122 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
128 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
129 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
133 using BBorder = bool;
135 enum class DeserializeEntityResult :
int {
136 FailedToLoadActor = 0,
137 FailedToAddToLevel = 1,
144 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mBlockEntityAccessLock;
145 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
146 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
147 ::ll::TypedStorage<4, 12, ::BlockPos> mMin;
148 ::ll::TypedStorage<4, 12, ::BlockPos> mMax;
149 ::ll::TypedStorage<8, 8, ::ChunkPos> mPosition;
150 ::ll::TypedStorage<1, 1, bool> mLightingFixupDone;
151 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mLightingTaskActive;
152 ::ll::TypedStorage<1, 1, bool> mReadOnly;
153 ::ll::TypedStorage<8, 8, ::ChunkSource*> mGenerator;
154 ::ll::TypedStorage<4, 4, ::LevelChunkTicking::Entity> mTmpTickingEntity;
155 ::ll::TypedStorage<1, 2, ::std::optional<::LevelChunkFormat>> mLoadedFormat;
156 ::ll::TypedStorage<8, 32, ::std::string> mSerializedEntitiesBuffer;
157 ::ll::TypedStorage<8, 32, ::std::string> mFailedSerializedEntitiesBuffer;
158 ::ll::TypedStorage<1, 1, bool> mHadSerializedEntities;
159 ::ll::TypedStorage<8, 24, ::std::vector<::ActorLink>> mUnresolvedActorLinks;
160 ::ll::TypedStorage<1, 1, ::std::atomic<::ChunkState>> mLoadState;
161 ::ll::TypedStorage<1, 1, ::ChunkTerrainDataState> mTerrainDataState;
162 ::ll::TypedStorage<1, 1, ::ChunkDebugDisplaySavedState> mDebugDisplaySavedState;
163 ::ll::TypedStorage<1, 1, ::ChunkCachedDataState> mCachedDataState;
164 ::ll::TypedStorage<8, 32, ::SpinLockImpl> mCachedDataStateSpinLock;
165 ::ll::TypedStorage<8, 32, ::SpinLockImpl> mClientRequestHeightmapAdjustSpinLock;
166 ::ll::TypedStorage<8, 8, ::Tick> mLastTick;
167 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mTickQueue;
168 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mRandomTickQueue;
169 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunk>> mSubChunks;
170 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SpinLockImpl>>> mSubChunkSpinLocks;
171 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> mBiomes;
172 ::ll::TypedStorage<2, 512, ::std::array<::BiomeChunkData, 256>> m2DBiomes;
173 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mBiomesMutex;
174 ::ll::TypedStorage<4, 2048, ::std::array<::ColumnCachedData, 256>> mCachedData;
175 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mHeightmap;
176 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRenderHeightmap;
177 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<short>>> mPreWorldGenHeightmap;
178 ::ll::TypedStorage<2, 2, ::ChunkLocalHeight> mNonAirMaxHeight;
179 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BiomeIdType, ::BiomeChunkState>> mBiomeStates;
180 ::ll::TypedStorage<2, 2, ushort> m3dBiomeStackSize;
181 ::ll::TypedStorage<1, 1, bool> mHasCachedTemperatureNoise;
182 ::ll::TypedStorage<1, 256, ::std::array<bool, 256>> mBorderBlockMap;
183 ::ll::TypedStorage<4, 4, int> mCurrentInstatick;
184 ::ll::TypedStorage<4, 4, ::LevelChunk::Finalization> mFinalized;
185 ::ll::TypedStorage<1, 1, bool> mIsRedstoneLoaded;
186 ::ll::TypedStorage<1, 1, bool> mOwnedByTickingThread;
187 ::ll::TypedStorage<1, 1, bool> mUse3DBiomeMaps;
188 ::ll::TypedStorage<1, 1, bool> mLevelChunkHas3dBiomeTag;
189 ::ll::TypedStorage<1, 4, ::LevelChunk::Telemetry> mTelemetry;
190 ::ll::TypedStorage<4, 48, ::DirtyTicksCounter[6]> mFullChunkDirtyTicksCounters;
191 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mChunkActorsDirtyTicksCounter;
192 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRainHeights;
193 ::ll::TypedStorage<8, 24, ::std::vector<::WeakEntityRef>> mEntities;
194 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mRemovedActorStorageKeys;
195 ::ll::TypedStorage<8, 136, ::LevelChunkBlockActorStorage> mBlockEntities;
196 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::BlockActor>>> mPreservedBlockEntities;
197 ::ll::TypedStorage<8, 24, ::std::vector<::WeakRef<::EntityContext>>> mVolumes;
198 ::ll::TypedStorage<1, 2, ::BrightnessPair> mDefaultBrightness;
199 ::ll::TypedStorage<8, 24, ::std::vector<::LevelChunk::SpawningArea>> mSpawningAreas;
200 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastNetworkLightingTime;
201 ::ll::TypedStorage<8, 8, uint64> mLoadedMetaDataHash;
202 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::LevelChunkMetaData>> mMetaData;
203 ::ll::TypedStorage<1, 1, bool> mClientNeedsToRequestSubChunks;
204 ::ll::TypedStorage<1, 1, bool> mLevelChunkHasHadOriginalLighting;
205 ::ll::TypedStorage<4, 16, float[2][2]> mChunkInterpolants;
206 ::ll::TypedStorage<1, 1, bool> mbChunkHasConverterTag;
207 ::ll::TypedStorage<1, 1, ::LevelChunk::Neighbors> mSavedNeighbors;
208 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mGenerationSeed;
209 ::ll::TypedStorage<1, 1, bool> mGeneratedPreCavesAndCliffsBlending;
210 ::ll::TypedStorage<1, 1, bool> mOnChunkLoadedCalled;
211 ::ll::TypedStorage<1, 1, bool> mAllSerializedEntitiesLoaded;
212 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsEntitiesBuffer;
213 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsBlockEntitiesBuffer;
214 ::ll::TypedStorage<1, 1, bool> mSaveNonActorDataIfDirty;
215 ::ll::TypedStorage<1, 1, bool> mSaveIfNeverSaved;
216 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mSnowRandomValue;
217 ::ll::TypedStorage<1, 1, bool> mHasSubChunksToPrune;
218 ::ll::TypedStorage<1, 1, bool> mHaveSubChunksBeenPruned;
219 ::ll::TypedStorage<1, 1, bool> mShouldShiftUpFlatWorldSubChunks;
220 ::ll::TypedStorage<8, 32, ::SpinLockImpl> mSubChunksToPruneLock;
221 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<::SubChunk>>> mSubChunksToPruneOutsideRange;
222 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameEventListenerRegistry>> mGameEventListenerRegistry;
223 ::ll::TypedStorage<1, 1, bool> mIsClientGenerated;
224 ::ll::TypedStorage<1, 1, bool> mWasClientGenerated;
225 ::ll::TypedStorage<1, 1, bool> mIsEmptyClientChunk;
226 ::ll::TypedStorage<1, 1, bool> mActorStorageUpdatedAfterCheckingForReplacementData;
227 ::ll::TypedStorage<8, 856, ::LevelChunkVolumeData> mLevelChunkVolumeData;
243 ::SubChunkInitMode initBlocks,
244 bool initializeMetaData,
245 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
248 MCAPI
void _addEntityToVolumes(::gsl::not_null<::Actor*> actor);
250 MCAPI
void _checkAndInferMetaDataAfterDeserialization();
252 MCAPI ::std::shared_ptr<::BlockActor> _createBlockEntity(
265 MCAPI ::LevelChunk::DeserializeEntityResult
270 MCAPI
void _fixupCommandBlocksOnTickingQueue(
::BlockSource& tickRegion);
275 MCAPI
void _generateOriginalLighting(
::ChunkViewSource& neighborhood,
bool enforceBorderCheck);
277 MCAPI
void _generateOriginalLightingSubChunk(
::BlockSource& source, uint64 subchunkIdx,
bool);
279 MCAPI
void _lightingCallbacks(
286 MCAPI
void _makeUniformBiomes(
::Biome const& biome);
288 MCAPI
void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
292 MCAPI
void _removeCallbacks(
299 MCAPI
void _replaceBiomeStorage(
300 ushort subChunkIndex,
307 MCAPI
void _setAllBiomesFrom2D(::std::array<::BiomeChunkData, 256>& legacyBiomes);
311 MCAPI
void _setBiome(
313 ushort subChunkIndex,
322 MCAPI
void addHardcodedSpawningArea(
::BoundingBox const& spawnerAABB, ::HardcodedSpawnAreaType type);
328 MCAPI
bool checkSeasonsPostProcessDirty();
330 MCAPI
void clientSubChunkRequestGenerateLightingForSubChunk(
::ChunkViewSource& neighborhood,
short absoluteIndex);
334 MCAPI
void deserializeBlockEntities(
::IDataInput& stream);
336 MCAPI
bool deserializeKey(::std::string_view key, ::std::string_view value);
338 MCAPI
void deserializeMetaDataHash(
::IDataInput& stream);
340 MCAPI
void deserializeSubChunk(
343 ::std::optional<schar> absoluteIndex,
344 ::std::optional<::DeserializationChanges*> deserializationChanges
351 MCAPI
void finalizeDeserialization();
353 MCAPI
void finalizePostProcessing();
355 MCAPI
void finalizeSubChunkDeserialization(
364 MCAPI
bool generateOriginalLighting(
::ChunkViewSource& neighborhood,
bool enforceBorderCheck);
366 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
368 bool iteratePastInitialBlocking,
373 MCAPI
void getActors(
376 ::std::vector<::Actor*>& actors
385 MCAPI ::BrightnessPair getBrightness(
::ChunkBlockPos const& pos)
const;
387 MCAPI
void getEntities(
388 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
390 ::std::vector<::Actor*>& entities,
395 getEntities(::ActorType type,
::AABB const& bb, ::std::vector<::Actor*>& es,
bool ignoreTargetType)
const;
397 MCAPI ::Block
const& getExtraBlock(
::ChunkBlockPos const& localPos)
const;
399 MCAPI
short getHighestNonAirSubChunkIndex()
const;
401 MCAPI ::std::shared_ptr<::LevelChunkMetaData> getMetaDataCopy()
const;
407 MCAPI
bool hasSubChunksToPrune()
const;
409 MCAPI
bool isNonActorDataDirty()
const;
411 MCAPI
void legacyDeserializeBlockExtraData(
::IDataInput& stream);
413 MCAPI
void legacyDeserializeTerrain(
::IDataInput& stream);
417 MCAPI ::LevelChunk& operator=(
::LevelChunk&& otherChunk);
419 MCAPI
void placeCallbacks(
424 ::std::shared_ptr<::BlockActor> blockEntity
427 MCAPI
void populateHeightMapDataForSubChunkPacket(
428 short subChunkAbsoluteIndex,
432 MCAPI
void recomputeHeightMap(
bool resetLighting);
438 MCAPI
void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type);
444 MCAPI
void serializeBlockEntitiesForSubChunk(
450 MCAPI
bool serializeBorderBlocks(
::IDataOutput& stream)
const;
452 MCAPI
void serializeEntities(
454 bool markProcessedOnChunkDisard,
455 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
456 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
457 ::std::function<
void(::std::string
const&)> addSerializedActor
460 MCAPI
void serializeEntityRemovals(::std::function<
void(::std::string
const&)> callback);
466 MCAPI ::Block
const& setBlock(
470 ::std::shared_ptr<::BlockActor> blockEntity
473 MCAPI
void setBlockVolume(
::BlockVolume const& box, uint yOffset);
478 MCAPI
void setMetaData(::std::shared_ptr<::LevelChunkMetaData> metaData);
480 MCAPI
void setPendingEntities(::std::string entitiesData);
482 MCAPI
void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
484 MCAPI
void setSaved();
486 MCAPI
void setUnsaved();
494 MCAPI
void tickImpl(
::BlockSource& tickRegion,
::Tick const& tick, ::std::function<
void()> spawnerCallback);
498 MCAPI
void validateAndFixBiomeStates();
506 MCAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> deserialize3DBiomes(
509 ushort dimensionHeightInSubchunks,
514 MCAPI
static void serializeEntities(
515 ::std::vector<::WeakEntityRef>
const& entities,
516 ::std::string
const& serializedEntitiesBuffer,
517 ::std::string
const& failedSerializedEntitiesBuffer,
519 bool markProcessedOnChunkDisard,
520 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
521 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
522 ::std::function<
void(::std::string
const&)> addSerializedActor
526 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeChunkData, 256>, ::std::vector<::SubChunk>>
527 staticDeserializeLegacyTerrain(
::IDataInput& stream,
short minY, ushort dimensionSizeInSubchunks);
537 ::SubChunkInitMode initBlocks,
538 bool initializeMetaData,
539 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode