99 enum class DeserializeEntityResult :
int {
100 FailedToLoadActor = 0,
101 FailedToAddToLevel = 1,
105 enum class Finalization :
int {
106 NeedsInstaticking = 0,
115 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
121 MCAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8>
const& sOffsetMap();
129 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
130 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
138 ::ll::TypedStorage<1, 1, bool> mWasStored;
139 ::ll::TypedStorage<1, 1, bool> mWasGenerated;
140 ::ll::TypedStorage<1, 1, bool> mWasRequestedInsideTickRange;
141 ::ll::TypedStorage<1, 1, bool> mWasLoadedInsideTickRange;
145 using BBorder = bool;
149 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
154 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mBlockEntityAccessLock;
155 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
156 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
157 ::ll::TypedStorage<4, 12, ::BlockPos> mMin;
158 ::ll::TypedStorage<4, 12, ::BlockPos> mMax;
159 ::ll::TypedStorage<8, 8, ::ChunkPos> mPosition;
160 ::ll::TypedStorage<1, 1, bool> mLightingFixupDone;
161 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mLightingTaskActive;
162 ::ll::TypedStorage<1, 1, bool> mReadOnly;
163 ::ll::TypedStorage<8, 8, ::ChunkSource*> mGenerator;
164 ::ll::TypedStorage<4, 4, ::LevelChunkTicking::Entity> mTmpTickingEntity;
165 ::ll::TypedStorage<1, 2, ::std::optional<::LevelChunkFormat>> mLoadedFormat;
166 ::ll::TypedStorage<1, 1, bool> mHadSerializedEntities;
167 ::ll::TypedStorage<8, 32, ::std::string> mSerializedEntitiesBuffer;
168 ::ll::TypedStorage<8, 32, ::std::string> mFailedSerializedEntitiesBuffer;
169 ::ll::TypedStorage<8, 24, ::std::vector<::ActorLink>> mUnresolvedActorLinks;
170 ::ll::TypedStorage<1, 1, ::std::atomic<::ChunkState>> mLoadState;
171 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsCurrentLoadStateIndeterminate;
172 ::ll::TypedStorage<1, 1, ::ChunkTerrainDataState> mTerrainDataState;
173 ::ll::TypedStorage<1, 1, ::ChunkDebugDisplaySavedState> mDebugDisplaySavedState;
174 ::ll::TypedStorage<1, 1, ::ChunkCachedDataState> mCachedDataState;
175 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mCachedDataStateSpinLock;
176 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mClientRequestHeightmapAdjustSpinLock;
177 ::ll::TypedStorage<8, 8, ::Tick> mLastTick;
178 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mTickQueue;
179 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mRandomTickQueue;
180 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunk>> mSubChunks;
181 ::ll::TypedStorage<8, 552, ::LevelChunkBiomes> mBiomes;
182 ::ll::TypedStorage<4, 2048, ::std::array<::ColumnCachedData, 256>> mCachedData;
183 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mHeightmap;
184 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRenderHeightmap;
185 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<short>>> mPreWorldGenHeightmap;
186 ::ll::TypedStorage<2, 2, ::ChunkLocalHeight> mNonAirMaxHeight;
187 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BiomeIdType, ::BiomeChunkState>> mBiomeStates;
188 ::ll::TypedStorage<1, 1, bool> mHasCachedTemperatureNoise;
189 ::ll::TypedStorage<1, 256, ::std::array<bool, 256>> mBorderBlockMap;
190 ::ll::TypedStorage<1, 1, bool> mIsRedstoneLoaded;
191 ::ll::TypedStorage<1, 1, bool> mOwnedByTickingThread;
192 ::ll::TypedStorage<1, 1, bool> mUse3DBiomeMaps;
193 ::ll::TypedStorage<1, 1, bool> mLevelChunkHas3dBiomeTag;
194 ::ll::TypedStorage<4, 4, int> mCurrentInstatick;
195 ::ll::TypedStorage<4, 4, ::LevelChunk::Finalization> mFinalized;
196 ::ll::TypedStorage<1, 4, ::LevelChunk::Telemetry> mTelemetry;
197 ::ll::TypedStorage<8, 64, ::ChunkGenContext> mChunkGenContext;
198 ::ll::TypedStorage<4, 48, ::DirtyTicksCounter[6]> mFullChunkDirtyTicksCounters;
199 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mChunkActorsDirtyTicksCounter;
200 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRainHeights;
201 ::ll::TypedStorage<8, 24, ::std::vector<::WeakEntityRef>> mEntities;
202 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mRemovedActorStorageKeys;
203 ::ll::TypedStorage<8, 184, ::LevelChunkBlockActorStorage> mBlockEntities;
204 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::BlockActor>>> mPreservedBlockEntities;
205 ::ll::TypedStorage<8, 24, ::std::vector<::WeakRef<::EntityContext>>> mVolumes;
206 ::ll::TypedStorage<1, 2, ::BrightnessPair> mDefaultBrightness;
207 ::ll::TypedStorage<8, 24, ::std::vector<::LevelChunk::SpawningArea>> mSpawningAreas;
208 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastNetworkLightingTime;
209 ::ll::TypedStorage<8, 8, uint64> mLoadedMetaDataHash;
210 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::LevelChunkMetaData>> mMetaData;
211 ::ll::TypedStorage<4, 16, float[2][2]> mChunkInterpolants;
212 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mGenerationSeed;
213 ::ll::TypedStorage<1, 1, bool> mbChunkHasConverterTag;
214 ::ll::TypedStorage<1, 1, ::LevelChunk::Neighbors> mSavedNeighbors;
215 ::ll::TypedStorage<1, 1, bool> mClientNeedsToRequestSubChunks;
216 ::ll::TypedStorage<1, 1, bool> mLevelChunkHasHadOriginalLighting;
217 ::ll::TypedStorage<1, 1, bool> mGeneratedPreCavesAndCliffsBlending;
218 ::ll::TypedStorage<1, 1, bool> mOnChunkLoadedCalled;
219 ::ll::TypedStorage<1, 1, bool> mAllSerializedEntitiesLoaded;
220 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsBlockEntitiesBuffer;
221 ::ll::TypedStorage<1, 1, bool> mSaveNonActorDataIfDirty;
222 ::ll::TypedStorage<1, 1, bool> mSaveIfNeverSaved;
223 ::ll::TypedStorage<1, 1, bool> mHasSubChunksToPrune;
224 ::ll::TypedStorage<1, 1, bool> mHaveSubChunksBeenPruned;
225 ::ll::TypedStorage<1, 1, bool> mShouldShiftUpFlatWorldSubChunks;
226 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<::SubChunk>>> mSubChunksToPruneOutsideRange;
227 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::Bedrock::LevelChunkTimings>>> mChunkTimings;
228 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameEventListenerRegistry>> mGameEventListenerRegistry;
229 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mSnowRandomValue;
230 ::ll::TypedStorage<1, 1, bool> mIsClientGenerated;
231 ::ll::TypedStorage<1, 1, bool> mWasClientGenerated;
232 ::ll::TypedStorage<1, 1, bool> mIsEmptyClientChunk;
233 ::ll::TypedStorage<1, 1, bool> mActorStorageUpdatedAfterCheckingForReplacementData;
234 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsTransient;
235 ::ll::TypedStorage<1, 1, bool> mDidSaveJigsawStructureBlueprints;
236 ::ll::TypedStorage<8, 856, ::LevelChunkVolumeData> mLevelChunkVolumeData;
241 LevelChunk& operator=(LevelChunk
const&);
242 LevelChunk(LevelChunk
const&);
252 ::SubChunkInitMode initBlocks,
253 bool initializeMetaData,
254 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
257 MCAPI
void _addEntityToVolumes(::gsl::not_null<::Actor*> actor);
259 MCAPI
void _checkAndInferMetaDataAfterDeserialization();
273 MCAPI
void _fixupCorruptedBlockActors(
279 MCAPI
void _handleHeightmapDataFromSubChunkPacketWithDeserializationChanges(
285 MCAPI
void _lightingCallbacks(
292 MCAPI
void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
298 MCAPI
void _setAllBiomesFrom2D(::std::array<::BiomeIdType, 256>& legacyBiomes);
304 MCAPI
void addHardcodedSpawningArea(
::BoundingBox const& spawnerAABB, ::HardcodedSpawnAreaType type);
308 MCAPI
bool checkSeasonsPostProcessDirty()
const;
311 MCAPI
void clearBlockEntitiesInSubChunk(
317 MCAPI
void clientSubChunkRequestGenerateLightingForSubChunk(
::ChunkViewSource& neighborhood,
short absoluteIndex);
319 MCAPI
void deserializeBiomes(
::IDataInput& stream,
bool fromNetwork);
322 MCAPI
void deserializeBlockEntities(
::IDataInput& stream);
324 MCAPI
bool deserializeKey(::std::string_view key, ::std::string_view value);
326 MCAPI
void deserializeMetaDataHash(
::IDataInput& stream);
329 MCAPI
void deserializeSubChunk(
332 ::std::optional<::DeserializationChanges*> deserializationChanges
336 MCAPI
void deserializeSubChunk(
339 ::std::optional<schar> absoluteIndex,
340 ::std::optional<::DeserializationChanges*> deserializationChanges
345 MCAPI
void finalizeDeserialization();
347 MCAPI
void finalizePostProcessing();
349 MCAPI
void finalizeSubChunkDeserialization(
354 MCAPI
bool generateOriginalLighting(
::ChunkViewSource& neighborhood,
bool enforceBorderCheck);
356 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
358 bool iteratePastInitialBlocking,
363 MCAPI
void getActors(
366 ::std::vector<::Actor*>& actors
376 MCAPI ::std::array<::ChunkLocalHeight, 256> getEntireLightingHeightMap()
const;
380 getEntities(::ActorType type,
::AABB const& bb, ::std::vector<::Actor*>& es,
bool ignoreTargetType)
const;
382 MCAPI
void getEntities(
383 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
385 ::std::vector<::Actor*>& entities,
387 ::std::function<
bool(
::Actor*)> selector
390 MCAPI
short getMaxAllocatedY()
const;
392 MCAPI ::std::shared_ptr<::LevelChunkMetaData> getMetaDataCopy()
const;
395 MCAPI ::SubChunk* getSubChunk(
short absoluteIndex);
398 MCAPI
int getSubChunkCountUpToHighestNonAirBlock()
const;
403 MCAPI
void handleHeightmapDataFromSubChunkPacket(
404 short subChunkAbsoluteIndex,
406 ::std::optional<::DeserializationChanges*> deserializationChanges
413 MCAPI
void moveLevelChunk(::LevelChunk&& otherChunk, uint64 subChunkRequestLimit);
416 MCAPI
bool nonActorDataNeedsSaving(
int wait,
int maxWait)
const;
418 MCAPI
void onDiscarded();
420 MCAPI ::LevelChunk& operator=(::LevelChunk&& otherChunk);
422 MCAPI
void placeCallbacks(
427 ::std::shared_ptr<::BlockActor> blockEntity,
431 MCAPI
void populateHeightMapDataForSubChunkPacket(
432 short subChunkAbsoluteIndex,
437 MCAPI
void pruneBiomesAboveHeightmap();
441 MCAPI
void recalculateChunkSkyLight();
444 MCAPI
void recomputeHeightMap(
bool resetLighting);
446 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(
::BlockPos const& blockPos);
452 MCAPI
void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type);
456 MCAPI
void serializeBlockEntitiesForSubChunk(
462 MCAPI
bool serializeBorderBlocks(
::IDataOutput& stream)
const;
464 MCAPI
void serializeEntities(
466 bool markProcessedOnChunkDisard,
467 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
468 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
469 ::std::function<
void(::std::string
const&)> addSerializedActor
472 MCAPI
void serializeEntityRemovals(::std::function<
void(::std::string
const&)> callback);
474 MCAPI
void serializeRandomTicks(
::IDataOutput& stream)
const;
480 MCAPI ::Block
const& setBlock(
484 ::std::shared_ptr<::BlockActor> blockEntity,
488 MCAPI
void setBlockVolume(
::BlockVolume const& box, uint yOffset);
493 MCAPI
void setClientNeedsToRequestSubchunks(::std::optional<uint64> requestLimit);
501 MCAPI
void setPendingEntities(::std::string entitiesData);
503 MCAPI
void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
511 MCAPI
void tickImpl(
::BlockSource& tickRegion,
::Tick const& tick, ::std::function<
void()> spawnerCallback);
513 MCAPI
bool tryChangeState(::ChunkState from, ::ChunkState to);
515 MCAPI
void validateAndFixBiomeStates();
524 MCAPI static ::std::unique_ptr<::LevelChunk, ::LevelChunkPhase1Deleter> createNew(
528 ::SubChunkInitMode initBlocks,
529 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
532 MCAPI static ::std::unique_ptr<::LevelChunk>
533 createNewNoCustomDeleter(
::Dimension& dimension,
::ChunkPos cp,
bool readOnly, ::SubChunkInitMode initBlocks);
536 MCAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> deserialize3DBiomes(
539 ushort dimensionHeightInSubchunks,
544 MCAPI static ::std::optional<::BlockPos> findExposedLightningRod(
::BlockPos const& pos,
::BlockSource& region);
547 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeIdType, 256>, ::std::vector<::SubChunk>>
548 staticDeserializeLegacyTerrain(
::IDataInput& stream,
short minY, ushort dimensionSizeInSubchunks);
558 ::SubChunkInitMode initBlocks,
559 bool initializeMetaData,
560 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode