85 enum class DeserializeEntityResult :
int {
86 FailedToLoadActor = 0,
87 FailedToAddToLevel = 1,
91 enum class Finalization :
int {
92 NeedsInstaticking = 0,
101 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
107 MCAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8>
const& sOffsetMap();
115 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
116 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
124 ::ll::TypedStorage<1, 1, bool> mWasStored;
125 ::ll::TypedStorage<1, 1, bool> mWasGenerated;
126 ::ll::TypedStorage<1, 1, bool> mWasRequestedInsideTickRange;
127 ::ll::TypedStorage<1, 1, bool> mWasLoadedInsideTickRange;
131 using BBorder = bool;
135 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
140 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mBlockEntityAccessLock;
141 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
142 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
143 ::ll::TypedStorage<4, 12, ::BlockPos> mMin;
144 ::ll::TypedStorage<4, 12, ::BlockPos> mMax;
145 ::ll::TypedStorage<8, 8, ::ChunkPos> mPosition;
146 ::ll::TypedStorage<1, 1, bool> mLightingFixupDone;
147 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mLightingTaskActive;
148 ::ll::TypedStorage<1, 1, bool> mReadOnly;
149 ::ll::TypedStorage<8, 8, ::ChunkSource*> mGenerator;
150 ::ll::TypedStorage<4, 4, ::LevelChunkTicking::Entity> mTmpTickingEntity;
151 ::ll::TypedStorage<1, 2, ::std::optional<::LevelChunkFormat>> mLoadedFormat;
152 ::ll::TypedStorage<1, 1, bool> mHadSerializedEntities;
153 ::ll::TypedStorage<8, 32, ::std::string> mSerializedEntitiesBuffer;
154 ::ll::TypedStorage<8, 32, ::std::string> mFailedSerializedEntitiesBuffer;
155 ::ll::TypedStorage<8, 24, ::std::vector<::ActorLink>> mUnresolvedActorLinks;
156 ::ll::TypedStorage<1, 1, ::std::atomic<::ChunkState>> mLoadState;
157 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsCurrentLoadStateIndeterminate;
158 ::ll::TypedStorage<1, 1, ::ChunkTerrainDataState> mTerrainDataState;
159 ::ll::TypedStorage<1, 1, ::ChunkDebugDisplaySavedState> mDebugDisplaySavedState;
160 ::ll::TypedStorage<1, 1, ::ChunkCachedDataState> mCachedDataState;
161 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mCachedDataStateSpinLock;
162 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mClientRequestHeightmapAdjustSpinLock;
163 ::ll::TypedStorage<8, 8, ::Tick> mLastTick;
164 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mTickQueue;
165 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mRandomTickQueue;
166 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunk>> mSubChunks;
167 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SpinLockImpl>>> mSubChunkSpinLocks;
168 ::ll::TypedStorage<8, 552, ::LevelChunkBiomes> mBiomes;
169 ::ll::TypedStorage<4, 2048, ::std::array<::ColumnCachedData, 256>> mCachedData;
170 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mHeightmap;
171 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRenderHeightmap;
172 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<short>>> mPreWorldGenHeightmap;
173 ::ll::TypedStorage<2, 2, ::ChunkLocalHeight> mNonAirMaxHeight;
174 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BiomeIdType, ::BiomeChunkState>> mBiomeStates;
175 ::ll::TypedStorage<1, 1, bool> mHasCachedTemperatureNoise;
176 ::ll::TypedStorage<1, 256, ::std::array<bool, 256>> mBorderBlockMap;
177 ::ll::TypedStorage<1, 1, bool> mIsRedstoneLoaded;
178 ::ll::TypedStorage<1, 1, bool> mOwnedByTickingThread;
179 ::ll::TypedStorage<1, 1, bool> mUse3DBiomeMaps;
180 ::ll::TypedStorage<1, 1, bool> mLevelChunkHas3dBiomeTag;
181 ::ll::TypedStorage<4, 4, int> mCurrentInstatick;
182 ::ll::TypedStorage<4, 4, ::LevelChunk::Finalization> mFinalized;
183 ::ll::TypedStorage<1, 4, ::LevelChunk::Telemetry> mTelemetry;
184 ::ll::TypedStorage<8, 64, ::ChunkGenContext> mChunkGenContext;
185 ::ll::TypedStorage<4, 48, ::DirtyTicksCounter[6]> mFullChunkDirtyTicksCounters;
186 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mChunkActorsDirtyTicksCounter;
187 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRainHeights;
188 ::ll::TypedStorage<8, 24, ::std::vector<::WeakEntityRef>> mEntities;
189 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mRemovedActorStorageKeys;
190 ::ll::TypedStorage<8, 184, ::LevelChunkBlockActorStorage> mBlockEntities;
191 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::BlockActor>>> mPreservedBlockEntities;
192 ::ll::TypedStorage<8, 24, ::std::vector<::WeakRef<::EntityContext>>> mVolumes;
193 ::ll::TypedStorage<1, 2, ::BrightnessPair> mDefaultBrightness;
194 ::ll::TypedStorage<8, 24, ::std::vector<::LevelChunk::SpawningArea>> mSpawningAreas;
195 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastNetworkLightingTime;
196 ::ll::TypedStorage<8, 8, uint64> mLoadedMetaDataHash;
197 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::LevelChunkMetaData>> mMetaData;
198 ::ll::TypedStorage<4, 16, float[2][2]> mChunkInterpolants;
199 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mGenerationSeed;
200 ::ll::TypedStorage<1, 1, bool> mbChunkHasConverterTag;
201 ::ll::TypedStorage<1, 1, ::LevelChunk::Neighbors> mSavedNeighbors;
202 ::ll::TypedStorage<1, 1, bool> mClientNeedsToRequestSubChunks;
203 ::ll::TypedStorage<1, 1, bool> mLevelChunkHasHadOriginalLighting;
204 ::ll::TypedStorage<1, 1, bool> mGeneratedPreCavesAndCliffsBlending;
205 ::ll::TypedStorage<1, 1, bool> mOnChunkLoadedCalled;
206 ::ll::TypedStorage<1, 1, bool> mAllSerializedEntitiesLoaded;
207 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsBlockEntitiesBuffer;
208 ::ll::TypedStorage<1, 1, bool> mSaveNonActorDataIfDirty;
209 ::ll::TypedStorage<1, 1, bool> mSaveIfNeverSaved;
210 ::ll::TypedStorage<1, 1, bool> mHasSubChunksToPrune;
211 ::ll::TypedStorage<1, 1, bool> mHaveSubChunksBeenPruned;
212 ::ll::TypedStorage<1, 1, bool> mShouldShiftUpFlatWorldSubChunks;
213 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mSubChunksToPruneLock;
214 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<::SubChunk>>> mSubChunksToPruneOutsideRange;
215 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::Bedrock::LevelChunkTimings>>> mChunkTimings;
216 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameEventListenerRegistry>> mGameEventListenerRegistry;
217 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mSnowRandomValue;
218 ::ll::TypedStorage<1, 1, bool> mIsClientGenerated;
219 ::ll::TypedStorage<1, 1, bool> mWasClientGenerated;
220 ::ll::TypedStorage<1, 1, bool> mIsEmptyClientChunk;
221 ::ll::TypedStorage<1, 1, bool> mActorStorageUpdatedAfterCheckingForReplacementData;
222 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsTransient;
223 ::ll::TypedStorage<8, 856, ::LevelChunkVolumeData> mLevelChunkVolumeData;
228 LevelChunk& operator=(LevelChunk
const&);
229 LevelChunk(LevelChunk
const&);
239 ::SubChunkInitMode initBlocks,
240 bool initializeMetaData,
241 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
244 MCAPI
void _addEntityToVolumes(::gsl::not_null<::Actor*> actor);
246 MCAPI
void _checkAndInferMetaDataAfterDeserialization();
260 MCAPI
void _fixupCorruptedBlockActors(
265 MCAPI
void _lightingCallbacks(
272 MCAPI
void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
278 MCAPI
void _setAllBiomesFrom2D(::std::array<::BiomeIdType, 256>& legacyBiomes);
284 MCAPI
void addHardcodedSpawningArea(
::BoundingBox const& spawnerAABB, ::HardcodedSpawnAreaType type);
288 MCAPI
bool checkSeasonsPostProcessDirty()
const;
291 MCAPI
void clearBlockEntitiesInSubChunk(
297 MCAPI
void clientSubChunkRequestGenerateLightingForSubChunk(
::ChunkViewSource& neighborhood,
short absoluteIndex);
299 MCAPI
void deserializeBiomes(
::IDataInput& stream,
bool fromNetwork);
302 MCAPI
void deserializeBlockEntities(
::IDataInput& stream);
304 MCAPI
bool deserializeKey(::std::string_view key, ::std::string_view value);
306 MCAPI
void deserializeMetaDataHash(
::IDataInput& stream);
309 MCAPI
void deserializeSubChunk(
312 ::std::optional<::DeserializationChanges*> deserializationChanges
316 MCAPI
void deserializeSubChunk(
319 ::std::optional<schar> absoluteIndex,
320 ::std::optional<::DeserializationChanges*> deserializationChanges
325 MCAPI
void finalizeDeserialization();
327 MCAPI
void finalizePostProcessing();
329 MCAPI
void finalizeSubChunkDeserialization(
334 MCAPI
bool generateOriginalLighting(
::ChunkViewSource& neighborhood,
bool enforceBorderCheck);
336 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
338 bool iteratePastInitialBlocking,
343 MCAPI
void getActors(
346 ::std::vector<::Actor*>& actors
356 MCAPI ::std::array<::ChunkLocalHeight, 256> getEntireLightingHeightMap()
const;
359 MCAPI
void getEntities(
360 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
362 ::std::vector<::Actor*>& entities,
367 getEntities(::ActorType type,
::AABB const& bb, ::std::vector<::Actor*>& es,
bool ignoreTargetType)
const;
369 MCAPI
short getMaxAllocatedY()
const;
371 MCAPI ::std::shared_ptr<::LevelChunkMetaData> getMetaDataCopy()
const;
374 MCAPI ::SubChunk* getSubChunk(
short absoluteIndex);
377 MCAPI
int getSubChunkCountUpToHighestNonAirBlock()
const;
382 MCAPI
void handleHeightmapDataFromSubChunkPacket(
383 short subChunkAbsoluteIndex,
385 ::std::optional<::DeserializationChanges*> deserializationChanges
392 MCAPI
void moveLevelChunk(::LevelChunk&& otherChunk, uint64 subChunkRequestLimit);
395 MCAPI
bool nonActorDataNeedsSaving(
int wait,
int maxWait)
const;
397 MCAPI
void onDiscarded();
399 MCAPI ::LevelChunk& operator=(::LevelChunk&& otherChunk);
401 MCAPI
void placeCallbacks(
406 ::std::shared_ptr<::BlockActor> blockEntity,
410 MCAPI
void pruneBiomesAboveHeightmap();
413 MCAPI
void recalculateChunkSkyLight();
416 MCAPI
void recomputeHeightMap(
bool resetLighting);
418 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(
::BlockPos const& blockPos);
424 MCAPI
void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type);
428 MCAPI
void serializeBlockEntitiesForSubChunk(
434 MCAPI
bool serializeBorderBlocks(
::IDataOutput& stream)
const;
436 MCAPI
void serializeEntities(
438 bool markProcessedOnChunkDisard,
439 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
440 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
441 ::std::function<
void(::std::string
const&)> addSerializedActor
444 MCAPI
void serializeEntityRemovals(::std::function<
void(::std::string
const&)> callback);
446 MCAPI
void serializeRandomTicks(
::IDataOutput& stream)
const;
452 MCAPI ::Block
const& setBlock(
456 ::std::shared_ptr<::BlockActor> blockEntity,
460 MCAPI
void setBlockVolume(
::BlockVolume const& box, uint yOffset);
465 MCAPI
void setClientNeedsToRequestSubchunks(::std::optional<uint64> requestLimit);
473 MCAPI
void setPendingEntities(::std::string entitiesData);
475 MCAPI
void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
479 MCAPI
void tickImpl(
::BlockSource& tickRegion,
::Tick const& tick, ::std::function<
void()> spawnerCallback);
481 MCAPI
bool tryChangeState(::ChunkState from, ::ChunkState to);
483 MCAPI
void validateAndFixBiomeStates();
492 MCAPI static ::std::unique_ptr<::LevelChunk, ::LevelChunkPhase1Deleter> createNew(
496 ::SubChunkInitMode initBlocks,
497 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
500 MCAPI static ::std::unique_ptr<::LevelChunk>
501 createNewNoCustomDeleter(
::Dimension& dimension,
::ChunkPos cp,
bool readOnly, ::SubChunkInitMode initBlocks);
504 MCAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> deserialize3DBiomes(
507 ushort dimensionHeightInSubchunks,
512 MCAPI static ::std::optional<::BlockPos> findExposedLightningRod(
::BlockPos const& pos,
::BlockSource& region);
515 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeIdType, 256>, ::std::vector<::SubChunk>>
516 staticDeserializeLegacyTerrain(
::IDataInput& stream,
short minY, ushort dimensionSizeInSubchunks);
526 ::SubChunkInitMode initBlocks,
527 bool initializeMetaData,
528 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode