90 enum class Finalization :
int {
91 NeedsInstaticking = 0,
100 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
106 MCNAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8>
const&
sOffsetMap();
114 ::ll::TypedStorage<1, 1, bool> mWasStored;
115 ::ll::TypedStorage<1, 1, bool> mWasGenerated;
116 ::ll::TypedStorage<1, 1, bool> mWasRequestedInsideTickRange;
117 ::ll::TypedStorage<1, 1, bool> mWasLoadedInsideTickRange;
121 using BlockList = ::std::vector<::BlockPos>;
123 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
129 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
130 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
134 using BBorder = bool;
136 enum class DeserializeEntityResult :
int {
137 FailedToLoadActor = 0,
138 FailedToAddToLevel = 1,
145 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mBlockEntityAccessLock;
146 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
147 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
148 ::ll::TypedStorage<4, 12, ::BlockPos> mMin;
149 ::ll::TypedStorage<4, 12, ::BlockPos> mMax;
150 ::ll::TypedStorage<8, 8, ::ChunkPos> mPosition;
151 ::ll::TypedStorage<1, 1, bool> mLightingFixupDone;
152 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mLightingTaskActive;
153 ::ll::TypedStorage<1, 1, bool> mReadOnly;
154 ::ll::TypedStorage<8, 8, ::ChunkSource*> mGenerator;
155 ::ll::TypedStorage<4, 4, ::LevelChunkTicking::Entity> mTmpTickingEntity;
156 ::ll::TypedStorage<1, 2, ::std::optional<::LevelChunkFormat>> mLoadedFormat;
157 ::ll::TypedStorage<8, 32, ::std::string> mSerializedEntitiesBuffer;
158 ::ll::TypedStorage<8, 32, ::std::string> mFailedSerializedEntitiesBuffer;
159 ::ll::TypedStorage<1, 1, bool> mHadSerializedEntities;
160 ::ll::TypedStorage<8, 24, ::std::vector<::ActorLink>> mUnresolvedActorLinks;
161 ::ll::TypedStorage<1, 1, ::std::atomic<::ChunkState>> mLoadState;
162 ::ll::TypedStorage<1, 1, ::ChunkTerrainDataState> mTerrainDataState;
163 ::ll::TypedStorage<1, 1, ::ChunkDebugDisplaySavedState> mDebugDisplaySavedState;
164 ::ll::TypedStorage<1, 1, ::ChunkCachedDataState> mCachedDataState;
165 ::ll::TypedStorage<8, 32, ::SpinLockImpl> mCachedDataStateSpinLock;
166 ::ll::TypedStorage<8, 32, ::SpinLockImpl> mClientRequestHeightmapAdjustSpinLock;
167 ::ll::TypedStorage<8, 8, ::Tick> mLastTick;
168 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mTickQueue;
169 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mRandomTickQueue;
170 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunk>> mSubChunks;
171 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SpinLockImpl>>> mSubChunkSpinLocks;
172 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> mBiomes;
173 ::ll::TypedStorage<2, 512, ::std::array<::BiomeChunkData, 256>> m2DBiomes;
174 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mBiomesMutex;
175 ::ll::TypedStorage<4, 2048, ::std::array<::ColumnCachedData, 256>> mCachedData;
176 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mHeightmap;
177 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRenderHeightmap;
178 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<short>>> mPreWorldGenHeightmap;
179 ::ll::TypedStorage<2, 2, ::ChunkLocalHeight> mNonAirMaxHeight;
180 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BiomeIdType, ::BiomeChunkState>> mBiomeStates;
181 ::ll::TypedStorage<2, 2, ushort> m3dBiomeStackSize;
182 ::ll::TypedStorage<1, 1, bool> mHasCachedTemperatureNoise;
183 ::ll::TypedStorage<1, 256, ::std::array<bool, 256>> mBorderBlockMap;
184 ::ll::TypedStorage<4, 4, int> mCurrentInstatick;
185 ::ll::TypedStorage<4, 4, ::LevelChunk::Finalization> mFinalized;
186 ::ll::TypedStorage<1, 1, bool> mIsRedstoneLoaded;
187 ::ll::TypedStorage<1, 1, bool> mOwnedByTickingThread;
188 ::ll::TypedStorage<1, 1, bool> mUse3DBiomeMaps;
189 ::ll::TypedStorage<1, 1, bool> mLevelChunkHas3dBiomeTag;
190 ::ll::TypedStorage<1, 4, ::LevelChunk::Telemetry> mTelemetry;
191 ::ll::TypedStorage<4, 48, ::DirtyTicksCounter[6]> mFullChunkDirtyTicksCounters;
192 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mChunkActorsDirtyTicksCounter;
193 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRainHeights;
194 ::ll::TypedStorage<8, 24, ::std::vector<::WeakEntityRef>> mEntities;
195 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mRemovedActorStorageKeys;
196 ::ll::TypedStorage<8, 136, ::LevelChunkBlockActorStorage> mBlockEntities;
197 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::BlockActor>>> mPreservedBlockEntities;
198 ::ll::TypedStorage<8, 24, ::std::vector<::WeakRef<::EntityContext>>> mVolumes;
199 ::ll::TypedStorage<1, 2, ::BrightnessPair> mDefaultBrightness;
200 ::ll::TypedStorage<8, 24, ::std::vector<::LevelChunk::SpawningArea>> mSpawningAreas;
201 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastNetworkLightingTime;
202 ::ll::TypedStorage<8, 8, uint64> mLoadedMetaDataHash;
203 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::LevelChunkMetaData>> mMetaData;
204 ::ll::TypedStorage<1, 1, bool> mClientNeedsToRequestSubChunks;
205 ::ll::TypedStorage<1, 1, bool> mLevelChunkHasHadOriginalLighting;
206 ::ll::TypedStorage<4, 16, float[2][2]> mChunkInterpolants;
207 ::ll::TypedStorage<1, 1, bool> mbChunkHasConverterTag;
208 ::ll::TypedStorage<1, 1, ::LevelChunk::Neighbors> mSavedNeighbors;
209 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mGenerationSeed;
210 ::ll::TypedStorage<1, 1, bool> mGeneratedPreCavesAndCliffsBlending;
211 ::ll::TypedStorage<1, 1, bool> mOnChunkLoadedCalled;
212 ::ll::TypedStorage<1, 1, bool> mAllSerializedEntitiesLoaded;
213 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsEntitiesBuffer;
214 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsBlockEntitiesBuffer;
215 ::ll::TypedStorage<1, 1, bool> mSaveNonActorDataIfDirty;
216 ::ll::TypedStorage<1, 1, bool> mSaveIfNeverSaved;
217 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mSnowRandomValue;
218 ::ll::TypedStorage<1, 1, bool> mHasSubChunksToPrune;
219 ::ll::TypedStorage<1, 1, bool> mHaveSubChunksBeenPruned;
220 ::ll::TypedStorage<1, 1, bool> mShouldShiftUpFlatWorldSubChunks;
221 ::ll::TypedStorage<8, 32, ::SpinLockImpl> mSubChunksToPruneLock;
222 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<::SubChunk>>> mSubChunksToPruneOutsideRange;
223 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameEventListenerRegistry>> mGameEventListenerRegistry;
224 ::ll::TypedStorage<1, 1, bool> mIsClientGenerated;
225 ::ll::TypedStorage<1, 1, bool> mWasClientGenerated;
226 ::ll::TypedStorage<1, 1, bool> mIsEmptyClientChunk;
227 ::ll::TypedStorage<1, 1, bool> mActorStorageUpdatedAfterCheckingForReplacementData;
228 ::ll::TypedStorage<8, 856, ::LevelChunkVolumeData> mLevelChunkVolumeData;
244 ::SubChunkInitMode initBlocks,
245 bool initializeMetaData,
246 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
249 MCAPI
void _addEntityToVolumes(::gsl::not_null<::Actor*> actor);
251 MCAPI
void _checkAndInferMetaDataAfterDeserialization();
253 MCAPI ::std::shared_ptr<::BlockActor> _createBlockEntity(
266 MCAPI ::LevelChunk::DeserializeEntityResult
271 MCAPI
void _dispatchBlockBreakEvents(
279 MCAPI
void _fixupCommandBlocksOnTickingQueue(
::BlockSource& tickRegion);
284 MCAPI
void _generateOriginalLighting(
::ChunkViewSource& neighborhood,
bool enforceBorderCheck);
286 MCAPI
void _generateOriginalLightingSubChunk(
::BlockSource& source, uint64 subchunkIdx,
bool);
288 MCAPI ::gsl::not_null<::Biome const*>
const _getDefaultBiome()
const;
290 MCAPI
void _lightingCallbacks(
297 MCAPI
void _makeUniformBiomes(
::Biome const& biome);
299 MCAPI
void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
301 MCAPI
void _placeCallbackIfChunkLoaded(
305 ::gsl::not_null<::Block const*> current
310 MCAPI
void _removeCallbacks(
318 MCAPI
void _replaceBiomeStorage(
319 ushort subChunkIndex,
326 MCAPI
void _setAllBiomesFrom2D(::std::array<::BiomeChunkData, 256>& legacyBiomes);
330 MCAPI
void _setBiome(
332 ushort subChunkIndex,
341 MCAPI
void addHardcodedSpawningArea(
::BoundingBox const& spawnerAABB, ::HardcodedSpawnAreaType type);
347 MCAPI
bool checkSeasonsPostProcessDirty();
349 MCAPI
void clientSubChunkRequestGenerateLightingForSubChunk(
::ChunkViewSource& neighborhood,
short absoluteIndex);
353 MCAPI
void deserializeBlockEntities(
::IDataInput& stream);
355 MCAPI
bool deserializeKey(::std::string_view key, ::std::string_view value);
357 MCAPI
void deserializeMetaDataHash(
::IDataInput& stream);
359 MCAPI
void deserializeSubChunk(
362 ::std::optional<schar> absoluteIndex,
363 ::std::optional<::DeserializationChanges*> deserializationChanges
370 MCAPI
void finalizeDeserialization();
372 MCAPI
void finalizePostProcessing();
374 MCAPI
void finalizeSubChunkDeserialization(
383 MCAPI
bool generateOriginalLighting(
::ChunkViewSource& neighborhood,
bool enforceBorderCheck);
385 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
387 bool iteratePastInitialBlocking,
392 MCAPI
void getActors(
395 ::std::vector<::Actor*>& actors
404 MCAPI ::BrightnessPair getBrightness(
::ChunkBlockPos const& pos)
const;
406 MCAPI
void getEntities(
407 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
409 ::std::vector<::Actor*>& entities,
414 getEntities(::ActorType type,
::AABB const& bb, ::std::vector<::Actor*>& es,
bool ignoreTargetType)
const;
416 MCAPI ::Block
const& getExtraBlock(
::ChunkBlockPos const& localPos)
const;
418 MCAPI
short getHighestNonAirSubChunkIndex()
const;
420 MCAPI ::std::shared_ptr<::LevelChunkMetaData> getMetaDataCopy()
const;
426 MCAPI
bool hasSubChunksToPrune()
const;
428 MCAPI
bool isNonActorDataDirty()
const;
430 MCAPI
void legacyDeserializeBlockExtraData(
::IDataInput& stream);
432 MCAPI
void legacyDeserializeTerrain(
::IDataInput& stream);
436 MCAPI ::LevelChunk& operator=(
::LevelChunk&& otherChunk);
438 MCAPI
void placeCallbacks(
443 ::std::shared_ptr<::BlockActor> blockEntity
446 MCAPI
void populateHeightMapDataForSubChunkPacket(
447 short subChunkAbsoluteIndex,
451 MCAPI
void recomputeHeightMap(
bool resetLighting);
457 MCAPI
void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type);
463 MCAPI
void serializeBlockEntitiesForSubChunk(
469 MCAPI
bool serializeBorderBlocks(
::IDataOutput& stream)
const;
471 MCAPI
void serializeEntities(
473 bool markProcessedOnChunkDisard,
474 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
475 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
476 ::std::function<
void(::std::string
const&)> addSerializedActor
479 MCAPI
void serializeEntityRemovals(::std::function<
void(::std::string
const&)> callback);
485 MCAPI ::Block
const& setBlock(
489 ::std::shared_ptr<::BlockActor> blockEntity,
493 MCAPI
void setBlockVolume(
::BlockVolume const& box, uint yOffset);
498 MCAPI
void setMetaData(::std::shared_ptr<::LevelChunkMetaData> metaData);
500 MCAPI
void setPendingEntities(::std::string entitiesData);
502 MCAPI
void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
504 MCAPI
void setSaved();
506 MCAPI
void setUnsaved();
514 MCAPI
void tickImpl(
::BlockSource& tickRegion,
::Tick const& tick, ::std::function<
void()> spawnerCallback);
518 MCAPI
void validateAndFixBiomeStates();
526 MCAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> deserialize3DBiomes(
529 ushort dimensionHeightInSubchunks,
534 MCAPI
static void serializeEntities(
535 ::std::vector<::WeakEntityRef>
const& entities,
536 ::std::string
const& serializedEntitiesBuffer,
537 ::std::string
const& failedSerializedEntitiesBuffer,
539 bool markProcessedOnChunkDisard,
540 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
541 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
542 ::std::function<
void(::std::string
const&)> addSerializedActor
546 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeChunkData, 256>, ::std::vector<::SubChunk>>
547 staticDeserializeLegacyTerrain(
::IDataInput& stream,
short minY, ushort dimensionSizeInSubchunks);
557 ::SubChunkInitMode initBlocks,
558 bool initializeMetaData,
559 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode