91 LLAPI
void deserializeBorderBlocks(
::IDataInput& stream);
102 enum class DeserializeEntityResult :
int {
103 FailedToLoadActor = 0,
104 FailedToAddToLevel = 1,
108 enum class Finalization :
int {
109 NeedsInstaticking = 0,
118 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
124 MCNAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8>
const&
sOffsetMap();
132 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
133 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
141 ::ll::TypedStorage<1, 1, bool> mWasStored;
142 ::ll::TypedStorage<1, 1, bool> mWasGenerated;
143 ::ll::TypedStorage<1, 1, bool> mWasRequestedInsideTickRange;
144 ::ll::TypedStorage<1, 1, bool> mWasLoadedInsideTickRange;
148 using BBorder = bool;
152 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
154 using MoveLock = ::std::lock_guard<::SpinLockImpl>;
161 ::ll::TypedStorage<8, 80, ::std::mutex> mBlockEntityAccessLock;
162 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
163 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
164 ::ll::TypedStorage<4, 12, ::BlockPos> mMin;
165 ::ll::TypedStorage<4, 12, ::BlockPos> mMax;
166 ::ll::TypedStorage<8, 8, ::ChunkPos> mPosition;
167 ::ll::TypedStorage<1, 1, bool> mLightingFixupDone;
168 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mLightingTaskActive;
169 ::ll::TypedStorage<1, 1, bool> mReadOnly;
170 ::ll::TypedStorage<8, 8, ::ChunkSource*> mGenerator;
171 ::ll::TypedStorage<4, 4, ::LevelChunkTicking::Entity> mTmpTickingEntity;
172 ::ll::TypedStorage<1, 2, ::std::optional<::LevelChunkFormat>> mLoadedFormat;
173 ::ll::TypedStorage<1, 1, bool> mHadSerializedEntities;
174 ::ll::TypedStorage<8, 32, ::std::string> mSerializedEntitiesBuffer;
175 ::ll::TypedStorage<8, 32, ::std::string> mFailedSerializedEntitiesBuffer;
176 ::ll::TypedStorage<8, 24, ::std::vector<::ActorLink>> mUnresolvedActorLinks;
177 ::ll::TypedStorage<1, 1, ::std::atomic<::ChunkState>> mLoadState;
178 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsCurrentLoadStateIndeterminate;
179 ::ll::TypedStorage<1, 1, ::ChunkTerrainDataState> mTerrainDataState;
180 ::ll::TypedStorage<1, 1, ::ChunkDebugDisplaySavedState> mDebugDisplaySavedState;
181 ::ll::TypedStorage<1, 1, ::ChunkCachedDataState> mCachedDataState;
182 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mCachedDataStateSpinLock;
183 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mClientRequestHeightmapAdjustSpinLock;
184 ::ll::TypedStorage<8, 8, ::Tick> mLastTick;
185 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mTickQueue;
186 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mRandomTickQueue;
187 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockNamedTickEventManager>> mBlockNamedTickEventManager;
188 ::ll::TypedStorage<8, 128, ::NeighborChangedQueue> mNeighborChangedQueue;
189 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunk>> mSubChunks;
190 ::ll::TypedStorage<8, 552, ::LevelChunkBiomes> mBiomes;
191 ::ll::TypedStorage<4, 2048, ::std::array<::ColumnCachedData, 256>> mCachedData;
192 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mHeightmap;
193 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRenderHeightmap;
194 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<short>>> mPreWorldGenHeightmap;
195 ::ll::TypedStorage<2, 2, ::ChunkLocalHeight> mNonAirMaxHeight;
196 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BiomeIdType, ::BiomeChunkState>> mBiomeStates;
197 ::ll::TypedStorage<1, 1, bool> mHasCachedTemperatureNoise;
198 ::ll::TypedStorage<1, 256, ::std::array<bool, 256>> mBorderBlockMap;
199 ::ll::TypedStorage<1, 1, bool> mIsRedstoneLoaded;
200 ::ll::TypedStorage<1, 1, bool> mOwnedByTickingThread;
201 ::ll::TypedStorage<1, 1, bool> mUse3DBiomeMaps;
202 ::ll::TypedStorage<1, 1, bool> mLevelChunkHas3dBiomeTag;
203 ::ll::TypedStorage<4, 4, int> mCurrentInstatick;
204 ::ll::TypedStorage<4, 4, ::LevelChunk::Finalization> mFinalized;
205 ::ll::TypedStorage<1, 4, ::LevelChunk::Telemetry> mTelemetry;
206 ::ll::TypedStorage<8, 64, ::ChunkGenContext> mChunkGenContext;
207 ::ll::TypedStorage<4, 64, ::DirtyTicksCounter[8]> mFullChunkDirtyTicksCounters;
208 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mChunkActorsDirtyTicksCounter;
209 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRainHeights;
210 ::ll::TypedStorage<8, 24, ::std::vector<::WeakEntityRef>> mEntities;
211 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mRemovedActorStorageKeys;
212 ::ll::TypedStorage<8, 184, ::LevelChunkBlockActorStorage> mBlockEntities;
213 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::BlockActor>>> mPreservedBlockEntities;
214 ::ll::TypedStorage<8, 8, ::Tick> mPreservedBlockEntitiesTick;
215 ::ll::TypedStorage<8, 24, ::std::vector<::WeakRef<::EntityContext>>> mVolumes;
216 ::ll::TypedStorage<1, 2, ::BrightnessPair> mDefaultBrightness;
217 ::ll::TypedStorage<8, 24, ::std::vector<::LevelChunk::SpawningArea>> mSpawningAreas;
218 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastNetworkLightingTime;
219 ::ll::TypedStorage<8, 8, uint64> mLoadedMetaDataHash;
220 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::LevelChunkMetaData>> mMetaData;
221 ::ll::TypedStorage<4, 16, float[2][2]> mChunkInterpolants;
222 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mGenerationSeed;
223 ::ll::TypedStorage<1, 1, bool> mbChunkHasConverterTag;
224 ::ll::TypedStorage<1, 1, ::LevelChunk::Neighbors> mSavedNeighbors;
225 ::ll::TypedStorage<1, 1, bool> mClientNeedsToRequestSubChunks;
226 ::ll::TypedStorage<1, 1, bool> mLevelChunkHasHadOriginalLighting;
227 ::ll::TypedStorage<1, 1, bool> mGeneratedPreCavesAndCliffsBlending;
228 ::ll::TypedStorage<1, 1, bool> mOnChunkLoadedCalled;
229 ::ll::TypedStorage<1, 1, bool> mAllSerializedEntitiesLoaded;
230 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsBlockEntitiesBuffer;
231 ::ll::TypedStorage<1, 1, bool> mSaveNonActorDataIfDirty;
232 ::ll::TypedStorage<1, 1, bool> mSaveIfNeverSaved;
233 ::ll::TypedStorage<1, 1, bool> mHasSubChunksToPrune;
234 ::ll::TypedStorage<1, 1, bool> mHaveSubChunksBeenPruned;
235 ::ll::TypedStorage<1, 1, bool> mShouldShiftUpFlatWorldSubChunks;
236 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<::SubChunk>>> mSubChunksToPruneOutsideRange;
237 ::ll::TypedStorage<8, 8, ::gsl::not_null<::std::unique_ptr<::Bedrock::LevelChunkTimings>>> mChunkTimings;
238 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameEventListenerRegistry>> mGameEventListenerRegistry;
239 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mSnowRandomValue;
240 ::ll::TypedStorage<1, 1, bool> mIsClientGenerated;
241 ::ll::TypedStorage<1, 1, bool> mWasClientGenerated;
242 ::ll::TypedStorage<1, 1, bool> mIsEmptyClientChunk;
243 ::ll::TypedStorage<1, 1, bool> mActorStorageUpdatedAfterCheckingForReplacementData;
244 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsTransient;
245 ::ll::TypedStorage<1, 1, bool> mDidSaveJigsawStructureBlueprints;
246 ::ll::TypedStorage<8, 856, ::LevelChunkVolumeData> mLevelChunkVolumeData;
247 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mMoveLockMutex;
248 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsBeingMoved;
249 ::ll::TypedStorage<1, 1, ::std::atomic<::LevelChunkCreationMode>> mChunkCreationMode;
254 LevelChunk& operator=(LevelChunk
const&);
255 LevelChunk(LevelChunk
const&);
265 ::SubChunkInitMode initBlocks,
266 bool initializeMetaData,
267 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
290 MCNAPI
void _handleHeightmapDataFromSubChunkPacketWithDeserializationChanges(
296 MCAPI
void _lightingCallbacks(
303 MCAPI
void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
324 MCNAPI
void clearBlockEntitiesInSubChunk(
330 MCNAPI
void clientSubChunkRequestGenerateLightingForSubChunk(
::ChunkViewSource& neighborhood,
short absoluteIndex);
332 MCAPI
void deserializeBiomes(
::IDataInput& stream,
bool fromNetwork);
345 ::std::optional<::DeserializationChanges*> deserializationChanges
352 ::std::optional<schar> absoluteIndex,
353 ::std::optional<::DeserializationChanges*> deserializationChanges
360 MCAPI
void finalizePostProcessing();
369 bool enforceBorderCheck,
373 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
375 bool iteratePastInitialBlocking,
380 MCAPI
void getActors(
383 ::std::vector<::Actor*>& actors
393 MCNAPI ::std::array<::ChunkLocalHeight, 256> getEntireLightingHeightMap()
const;
397 getEntities(::ActorType type,
::AABB const& bb, ::std::vector<::Actor*>& es,
bool ignoreTargetType)
const;
399 MCAPI
void getEntities(
400 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
402 ::std::vector<::Actor*>& entities,
404 ::std::function<
bool(
::Actor*)> selector
410 MCAPI ::SubChunk* getSubChunk(
short absoluteIndex);
418 MCNAPI
void handleHeightmapDataFromSubChunkPacket(
419 short subChunkAbsoluteIndex,
421 ::std::optional<::DeserializationChanges*> deserializationChanges
430 MCNAPI
void moveLevelChunk(::LevelChunk&& otherChunk, uint64 subChunkRequestLimit);
442 ::std::shared_ptr<::BlockActor> blockEntity,
446 MCAPI
void populateHeightMapDataForSubChunkPacket(
447 short subChunkAbsoluteIndex,
454 MCNAPI
void recalculateChunkSkyLight();
457 MCAPI
void recomputeHeightMap(
bool resetLighting);
461 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(
::BlockPos const& blockPos);
471 MCAPI
void serializeBlockEntitiesForSubChunk(
477 MCAPI
bool serializeBorderBlocks(
::IDataOutput& stream)
const;
481 bool markProcessedOnChunkDisard,
482 ::std::function<
void(::std::string
const&)> addLiveActorCallback,
483 ::std::function<
void(::std::string
const&)> addActorKeyCallback,
484 ::std::function<
void(::std::string
const&)> addSerializedActor
499 MCAPI ::Block
const& setBlock(
503 ::std::shared_ptr<::BlockActor> blockEntity,
509 MCAPI
void setBlockVolume(
::BlockVolume const& box, uint yOffset);
514 MCNAPI
void setClientNeedsToRequestSubchunks(::std::optional<uint64> requestLimit);
516 MCNAPI
void setEmptyClientChunk();
524 MCAPI
void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
528 MCAPI
void tickImpl(
::BlockSource& tickRegion,
::Tick const& tick, ::std::function<
void()> spawnerCallback);
530 MCAPI
bool tryChangeState(::ChunkState from, ::ChunkState to);
540 MCNAPI static ::std::unique_ptr<::LevelChunk, ::LevelChunkPhase1Deleter>
createNew(
544 ::SubChunkInitMode initBlocks,
545 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
548 MCAPI static ::std::unique_ptr<::LevelChunk>
549 createNewNoCustomDeleter(
::Dimension& dimension,
::ChunkPos cp,
bool readOnly, ::SubChunkInitMode initBlocks);
551 MCNAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>>
deserialize3DBiomes(
554 ushort dimensionHeightInSubchunks,
561 MCNAPI static ::std::
562 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeIdType, 256>, ::std::vector<::SubChunk>>
573 ::SubChunkInitMode initBlocks,
574 bool initializeMetaData,
575 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode