Skip to content
LeviMC
English
AutoLightDark
LeviLamina
Loading...
Searching...
No Matches
LevelChunk.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/container/small_vector.h"
7#include "mc/deps/game_refs/WeakRef.h"
8#include "mc/network/packet/SubChunkPacketPayload.h"
9#include "mc/platform/brstd/function_ref.h"
10#include "mc/platform/threading/SpinLockImpl.h"
11#include "mc/world/actor/ActorType.h"
12#include "mc/world/level/BlockPos.h"
13#include "mc/world/level/ChunkLocalHeight.h"
14#include "mc/world/level/ChunkPos.h"
15#include "mc/world/level/NeighborChangedQueue.h"
16#include "mc/world/level/Tick.h"
17#include "mc/world/level/biome/BiomeIdType.h"
18#include "mc/world/level/block/BrightnessPair.h"
19#include "mc/world/level/chunk/ChunkCachedDataState.h"
20#include "mc/world/level/chunk/ChunkDebugDisplaySavedState.h"
21#include "mc/world/level/chunk/ChunkState.h"
22#include "mc/world/level/chunk/ChunkTerrainDataState.h"
23#include "mc/world/level/chunk/ColumnCachedData.h"
24#include "mc/world/level/chunk/DirtyTicksCounter.h"
25#include "mc/world/level/chunk/LevelChunkBiomes.h"
26#include "mc/world/level/chunk/LevelChunkBlockActorStorage.h"
27#include "mc/world/level/chunk/LevelChunkCreationMode.h"
28#include "mc/world/level/chunk/LevelChunkFormat.h"
29#include "mc/world/level/chunk/LevelChunkNeighbor.h"
30#include "mc/world/level/chunk/LevelChunkVolumeData.h"
31#include "mc/world/level/chunk/SubChunkInitMode.h"
32#include "mc/world/level/chunk/SubChunkStorage.h"
33#include "mc/world/level/chunk/level_chunk_ticking/Entity.h"
34#include "mc/world/level/levelgen/ChunkGenContext.h"
35#include "mc/world/level/levelgen/structure/BoundingBox.h"
36#include "mc/world/level/levelgen/v1/HardcodedSpawnAreaType.h"
37
38// auto generated forward declare list
39// clang-format off
40class AABB;
41class Actor;
42class Biome;
43class BiomeRegistry;
44class Block;
45class BlockActor;
48class BlockSource;
50class BlockVolume;
51class ChunkBlockPos;
52class ChunkSource;
53class ChunkViewSource;
54class Dimension;
55class EntityContext;
57class IDataInput;
58class IDataOutput;
59class ILevel;
61class SaveContext;
62class StringByteInput;
63class SubChunkPos;
64class WeakEntityRef;
66struct ActorLink;
67struct BiomeChunkState;
70struct SubChunk;
71namespace Bedrock { class LevelChunkTimings; }
72namespace Bedrock { struct LevelChunkTimingData; }
73namespace LevelChunkTicking { struct Registry; }
74// clang-format on
75
76class LevelChunk {
77public:
78 [[nodiscard]] ::BlockTickingQueue const& getTickQueue() const { return *mTickQueue; }
79
80 [[nodiscard]] ::BlockTickingQueue& getTickQueue() {
81 return *mTickQueue;
82 } // NOLINT(readability-make-member-function-const)
83
84 // LLAPI void populateHeightMapDataForSubChunkPacket(
85 // short subChunkAbsoluteIndex,
86 // ::SubChunkPacketPayload::SubChunkPacketData& subChunkPacketData
87 // ) const;
88
89 LLAPI void serializeBiomes(::IDataOutput& stream) const;
90
91 LLAPI void deserializeBorderBlocks(::IDataInput& stream);
92
93public:
94 // LevelChunk inner types declare
95 // clang-format off
96 class Neighbors;
97 struct SpawningArea;
98 struct Telemetry;
99 // clang-format on
100
101 // LevelChunk inner types define
102 enum class DeserializeEntityResult : int {
103 FailedToLoadActor = 0,
104 FailedToAddToLevel = 1,
105 Succeeded = 2,
106 };
107
108 enum class Finalization : int {
109 NeedsInstaticking = 0,
110 NeedsPopulation = 1,
111 Done = 2,
112 };
113
114 class Neighbors {
115 public:
116 // member variables
117 // NOLINTBEGIN
118 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
119 // NOLINTEND
120
121 public:
122 // static variables
123 // NOLINTBEGIN
124 MCNAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8> const& sOffsetMap();
125 // NOLINTEND
126 };
127
129 public:
130 // member variables
131 // NOLINTBEGIN
132 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
133 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
134 // NOLINTEND
135 };
136
137 struct Telemetry {
138 public:
139 // member variables
140 // NOLINTBEGIN
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;
145 // NOLINTEND
146 };
147
148 using BBorder = bool;
149
151
152 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
153
154 using MoveLock = ::std::lock_guard<::SpinLockImpl>;
155
156 using MoveLockMutex = ::SpinLockImpl;
157
158public:
159 // member variables
160 // NOLINTBEGIN
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;
250 // NOLINTEND
251
252public:
253 // prevent constructor by default
254 LevelChunk& operator=(LevelChunk const&);
255 LevelChunk(LevelChunk const&);
256 LevelChunk();
257
258public:
259 // member functions
260 // NOLINTBEGIN
261 MCAPI LevelChunk(
262 ::Dimension& dimension,
263 ::ChunkPos const& cp,
264 bool readOnly,
265 ::SubChunkInitMode initBlocks,
266 bool initializeMetaData,
267 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
268 );
269
270 MCNAPI void _addEntityToVolumes(::gsl::not_null<::Actor*> actor);
271
272#ifdef LL_PLAT_C
273 MCNAPI void _deserializeBiomes(::IDataInput& stream, ::BiomeRegistry const& biomeRegistry, bool fromNetwork);
274#endif
275
276#ifdef LL_PLAT_S
277 MCNAPI void _deserializeBiomes(::IDataInput& stream, ::BiomeRegistry const& biomeRegistry, bool fromNetwork);
278#endif
279
281
282 MCNAPI bool _deserializeSubChunk(short index, ::StringByteInput& stream);
283
285 ::LevelChunkBlockActorStorage& deserialized,
287 ) const;
288
289#ifdef LL_PLAT_C
290 MCNAPI void _handleHeightmapDataFromSubChunkPacketWithDeserializationChanges(
291 short subChunkIndex,
292 ::SubChunkPacketPayload::SubChunkPacketData const& subChunkPacketData
293 );
294#endif
295
296 MCAPI void _lightingCallbacks(
297 ::ChunkBlockPos const& pos,
298 ::Block const& old,
299 ::Block const& current,
300 ::BlockSource* currentSource
301 );
302
303 MCAPI void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
304
305 MCNAPI bool _recalcHeight(::ChunkBlockPos const& start, ::BlockSource* source);
306
307 MCNAPI void _set2DBiomesFrom3D(::IDataInput& stream);
308
309 MCNAPI void _setAllBiomesFrom2D(::std::array<::BiomeIdType, 256>& legacyBiomes);
310
311 MCAPI void _setBiome(::Biome const& biome, ::ChunkBlockPos const& pos, bool fillYDimension);
312
313 MCNAPI void addEntity(::WeakEntityRef entityRef);
314
315 MCNAPI void addHardcodedSpawningArea(::BoundingBox const& spawnerAABB, ::HardcodedSpawnAreaType type);
316
318
319 MCNAPI void changeState(::ChunkState from, ::ChunkState to);
320
321 MCNAPI bool checkSeasonsPostProcessDirty() const;
322
323#ifdef LL_PLAT_C
324 MCNAPI void clearBlockEntitiesInSubChunk(
325 schar absoluteIndex,
326 ::LevelChunkBlockActorStorage const* blockActorMap,
327 ::BlockSource* region
328 );
329
330 MCNAPI void clientSubChunkRequestGenerateLightingForSubChunk(::ChunkViewSource& neighborhood, short absoluteIndex);
331
332 MCAPI void deserializeBiomes(::IDataInput& stream, bool fromNetwork);
333#endif
334
336
337 MCNAPI bool deserializeKey(::std::string_view key, ::std::string_view value);
338
340
341#ifdef LL_PLAT_C
342 MCNAPI void deserializeSubChunk(
343 ::IDataInput& stream,
344 short absoluteIndex,
345 ::std::optional<::DeserializationChanges*> deserializationChanges
346 );
347#endif
348
350 uchar idx,
351 ::IDataInput& stream,
352 ::std::optional<schar> absoluteIndex,
353 ::std::optional<::DeserializationChanges*> deserializationChanges
354 );
355
356 MCAPI void fetchBlocks(::BlockPos const& volumeOrigin, ::BlockVolume& volume) const;
357
359
360 MCAPI void finalizePostProcessing();
361
363 ::LevelChunkBlockActorStorage& blockActorMap,
365 );
366
368 ::ChunkViewSource& neighborhood,
369 bool enforceBorderCheck,
370 ::brstd::function_ref<void()> prepareNeighborhood
371 );
372
373 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
374 ::ChunkBlockPos const& start,
375 bool iteratePastInitialBlocking,
376 bool includeWater,
377 bool includeLeaves
378 ) const;
379
380 MCAPI void getActors(
381 ::ActorDefinitionIdentifier const& actorDefinitionId,
382 ::AABB const& bb,
383 ::std::vector<::Actor*>& actors
384 ) const;
385
386 MCAPI ::Biome const& getBiome(::ChunkBlockPos const& pos) const;
387
388 MCAPI ::Block const& getBlock(::ChunkBlockPos const& pos) const;
389
390 MCAPI ::BlockActor* getBlockEntity(::ChunkBlockPos const& localPos);
391
392#ifdef LL_PLAT_C
393 MCNAPI ::std::array<::ChunkLocalHeight, 256> getEntireLightingHeightMap() const;
394#endif
395
396 MCAPI void
397 getEntities(::ActorType type, ::AABB const& bb, ::std::vector<::Actor*>& es, bool ignoreTargetType) const;
398
399 MCAPI void getEntities(
400 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
401 ::AABB const& bb,
402 ::std::vector<::Actor*>& entities,
403 bool useHitbox,
404 ::std::function<bool(::Actor*)> selector
405 ) const;
406
407 MCNAPI ::std::shared_ptr<::LevelChunkMetaData> getMetaDataCopy() const;
408
409#ifdef LL_PLAT_C
410 MCAPI ::SubChunk* getSubChunk(short absoluteIndex);
411#endif
412
413 MCNAPI ::Bedrock::LevelChunkTimingData getTimingDataDiagnosticOnly() const;
414
415 MCNAPI ::BlockPos const getTopRainBlockPos(::ChunkBlockPos const& pos);
416
417#ifdef LL_PLAT_C
418 MCNAPI void handleHeightmapDataFromSubChunkPacket(
419 short subChunkAbsoluteIndex,
420 ::SubChunkPacketPayload::SubChunkPacketData const& subChunkPacketData,
421 ::std::optional<::DeserializationChanges*> deserializationChanges
422 );
423#endif
424
426
427 MCNAPI void moveAssignFrom(::LevelChunk&& otherChunk);
428
429#ifdef LL_PLAT_C
430 MCNAPI void moveLevelChunk(::LevelChunk&& otherChunk, uint64 subChunkRequestLimit);
431#endif
432
433 MCNAPI bool nonActorDataNeedsSaving(int wait, int maxWait) const;
434
435 MCNAPI void onDiscarded();
436
437 MCNAPI void placeCallbacks(
438 ::ChunkBlockPos const& pos,
439 ::Block const& old,
440 ::Block const& current,
441 ::BlockSource* currentSource,
442 ::std::shared_ptr<::BlockActor> blockEntity,
443 ::BlockChangeContext const& changeSourceContext
444 );
445
446 MCAPI void populateHeightMapDataForSubChunkPacket(
447 short subChunkAbsoluteIndex,
449 ) const;
450
452
453#ifdef LL_PLAT_C
454 MCNAPI void recalculateChunkSkyLight();
455#endif
456
457 MCAPI void recomputeHeightMap(bool resetLighting);
458
460
461 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(::BlockPos const& blockPos);
462
464
466
467 MCNAPI void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type);
468
469 MCAPI void serializeBlockEntities(::IDataOutput& stream, ::SaveContext const& saveContext) const;
470
471 MCAPI void serializeBlockEntitiesForSubChunk(
472 ::IDataOutput& stream,
473 ::SubChunkPos const& subChunkPos,
474 ::SaveContext const& saveContext
475 ) const;
476
477 MCAPI bool serializeBorderBlocks(::IDataOutput& stream) const;
478
479 MCNAPI void serializeEntities(
480 ::std::string& buffer,
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
485 ) const;
486
487 MCNAPI void serializeEntityRemovals(::std::function<void(::std::string const&)> callback);
488
489 MCNAPI void serializeNamedTicks(::IDataOutput& stream) const;
490
491 MCNAPI void serializeNeighborChanges(::IDataOutput& stream) const;
492
493 MCNAPI void serializeRandomTicks(::IDataOutput& stream) const;
494
495 MCNAPI void serializeTicks(::IDataOutput& stream) const;
496
497 MCNAPI void setBiomeStorages(::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>> biomeStorages);
498
499 MCAPI ::Block const& setBlock(
500 ::ChunkBlockPos const& pos,
501 ::Block const& block,
502 ::BlockSource* issuingSource,
503 ::std::shared_ptr<::BlockActor> blockEntity,
504 ::BlockChangeContext const& changeSourceContext
505 );
506
507 MCAPI void setBlockSimple(::ChunkBlockPos const& pos, ::Block const& block);
508
509 MCAPI void setBlockVolume(::BlockVolume const& box, uint yOffset);
510
511 MCNAPI void setBorder(::ChunkBlockPos const& pos, bool val);
512
513#ifdef LL_PLAT_C
514 MCNAPI void setClientNeedsToRequestSubchunks(::std::optional<uint64> requestLimit);
515
516 MCNAPI void setEmptyClientChunk();
517#endif
518
519 MCAPI ::Block const&
520 setExtraBlock(::ChunkBlockPos const& localPos, ::Block const& block, ::BlockSource* issuingSource);
521
522 MCNAPI void setPendingEntities(::std::string entitiesData);
523
524 MCAPI void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
525
526 MCAPI void tickBlockEntities(::BlockSource& tickRegion);
527
528 MCAPI void tickImpl(::BlockSource& tickRegion, ::Tick const& tick, ::std::function<void()> spawnerCallback);
529
530 MCAPI bool tryChangeState(::ChunkState from, ::ChunkState to);
531
533
534 MCAPI ~LevelChunk();
535 // NOLINTEND
536
537public:
538 // static functions
539 // NOLINTBEGIN
540 MCNAPI static ::std::unique_ptr<::LevelChunk, ::LevelChunkPhase1Deleter> createNew(
541 ::Dimension& dimension,
542 ::ChunkPos cp,
543 bool readOnly,
544 ::SubChunkInitMode initBlocks,
545 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
546 );
547
548 MCAPI static ::std::unique_ptr<::LevelChunk>
549 createNewNoCustomDeleter(::Dimension& dimension, ::ChunkPos cp, bool readOnly, ::SubChunkInitMode initBlocks);
550
551 MCNAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> deserialize3DBiomes(
552 ::IDataInput& stream,
553 ::BiomeRegistry const& biomeRegistry,
554 ushort dimensionHeightInSubchunks,
555 ::Biome const* defaultBiome,
556 bool fromNetwork
557 );
558
559 MCNAPI static ::std::optional<::BlockPos> findExposedLightningRod(::BlockPos const& pos, ::BlockSource& region);
560
561 MCNAPI static ::std::
562 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeIdType, 256>, ::std::vector<::SubChunk>>
563 staticDeserializeLegacyTerrain(::IDataInput& stream, short minY, ushort dimensionSizeInSubchunks);
564 // NOLINTEND
565
566public:
567 // constructor thunks
568 // NOLINTBEGIN
569 MCAPI void* $ctor(
570 ::Dimension& dimension,
571 ::ChunkPos const& cp,
572 bool readOnly,
573 ::SubChunkInitMode initBlocks,
574 bool initializeMetaData,
575 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
576 );
577 // NOLINTEND
578
579public:
580 // destructor thunk
581 // NOLINTBEGIN
582 MCAPI void $dtor();
583 // NOLINTEND
584};
Definition AABB.h:18
Definition Actor.h:116
Definition LevelChunkTimings.h:17
Definition small_vector.h:11
Definition BiomeRegistry.h:37
Definition Biome.h:23
Definition BlockActor.h:30
Definition BlockChangeContext.h:11
Definition BlockNamedTickEventManager.h:21
Definition BlockPos.h:14
Definition BlockSource.h:72
Definition BlockTickingQueue.h:27
Definition BlockVolume.h:14
Definition Block.h:42
Definition BoundingBox.h:13
Definition ChunkBlockPos.h:10
Definition ChunkPos.h:13
Definition ChunkSource.h:37
Definition ChunkViewSource.h:23
Definition Dimension.h:86
Definition EntityContext.h:15
Definition GameEventListenerRegistry.h:10
Definition IDataInput.h:8
Definition IDataOutput.h:5
Definition ILevel.h:223
Definition LevelChunkBlockActorStorage.h:16
Definition LevelChunkMetaData.h:8
Definition LevelChunk.h:114
static MCAPI ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos >, 8 > const & sOffsetMap()
MCAPI bool removeEntityFromChunk(::WeakEntityRef entityRef)
MCAPI void _fixupCorruptedBlockActors(::LevelChunkBlockActorStorage &deserialized, ::buffer_span_mut<::SubChunk > subchunks) const
static MCAPI ::std::optional<::BlockPos > findExposedLightningRod(::BlockPos const &pos, ::BlockSource &region)
MCAPI void serializeRandomTicks(::IDataOutput &stream) const
MCAPI void addEntity(::WeakEntityRef entityRef)
MCAPI void releasePreservedBlockEntities(::BlockSource &tickRegion)
MCAPI void markForTickingThisFrame(::LevelChunkTicking::Registry &registry)
MCAPI void finalizeDeserialization()
MCAPI void serializeTicks(::IDataOutput &stream) const
MCAPI void onDiscarded()
MCAPI void deserializeSubChunk(uchar idx, ::IDataInput &stream, ::std::optional< schar > absoluteIndex, ::std::optional<::DeserializationChanges * > deserializationChanges)
MCAPI ::std::shared_ptr<::LevelChunkMetaData > getMetaDataCopy() const
MCAPI::Bedrock::LevelChunkTimingData getTimingDataDiagnosticOnly() const
MCAPI void setBiomeStorages(::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome > > > biomeStorages)
MCAPI bool nonActorDataNeedsSaving(int wait, int maxWait) const
MCAPI void serializeNeighborChanges(::IDataOutput &stream) const
MCAPI void setBorder(::ChunkBlockPos const &pos, bool val)
static MCAPI ::std::tuple<::std::array<::ChunkLocalHeight, 256 >, ::std::array<::BiomeIdType, 256 >, ::std::vector<::SubChunk > > staticDeserializeLegacyTerrain(::IDataInput &stream, short minY, ushort dimensionSizeInSubchunks)
MCAPI::BlockPos const getTopRainBlockPos(::ChunkBlockPos const &pos)
MCAPI bool checkSeasonsPostProcessDirty() const
MCAPI void _deserializeBlockEntities(::IDataInput &stream, ::LevelChunkBlockActorStorage &blockEntityMap)
MCAPI void _set2DBiomesFrom3D(::IDataInput &stream)
MCAPI bool _deserializeSubChunk(short index, ::StringByteInput &stream)
MCAPI void _setAllBiomesFrom2D(::std::array<::BiomeIdType, 256 > &legacyBiomes)
MCAPI void serializeEntities(::std::string &buffer, bool markProcessedOnChunkDisard, ::std::function< void(::std::string const &)> addLiveActorCallback, ::std::function< void(::std::string const &)> addActorKeyCallback, ::std::function< void(::std::string const &)> addSerializedActor) const
MCAPI void serializeEntityRemovals(::std::function< void(::std::string const &)> callback)
MCAPI bool _recalcHeight(::ChunkBlockPos const &start, ::BlockSource *source)
MCAPI void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type)
MCAPI void deserializeBlockEntities(::IDataInput &stream)
MCAPI void finalizeSubChunkDeserialization(::LevelChunkBlockActorStorage &blockActorMap, ::buffer_span_mut<::SubChunk > subchunks)
MCAPI bool deserializeKey(::std::string_view key, ::std::string_view value)
MCAPI void changeState(::ChunkState from, ::ChunkState to)
MCAPI void placeCallbacks(::ChunkBlockPos const &pos, ::Block const &old, ::Block const &current, ::BlockSource *currentSource, ::std::shared_ptr<::BlockActor > blockEntity, ::BlockChangeContext const &changeSourceContext)
MCAPI bool applySeasonsPostProcess(::BlockSource &region)
MCAPI void pruneBiomesAboveHeightmap()
MCAPI void _addEntityToVolumes(::gsl::not_null<::Actor * > actor)
MCAPI void setPendingEntities(::std::string entitiesData)
MCAPI void moveAssignFrom(::LevelChunk &&otherChunk)
MCAPI bool generateOriginalLighting(::ChunkViewSource &neighborhood, bool enforceBorderCheck, ::brstd::function_ref< void()> prepareNeighborhood)
static MCAPI ::std::unique_ptr<::LevelChunk, ::LevelChunkPhase1Deleter > createNew(::Dimension &dimension, ::ChunkPos cp, bool readOnly, ::SubChunkInitMode initBlocks, ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode)
MCAPI void deserializeMetaDataHash(::IDataInput &stream)
MCAPI void serializeNamedTicks(::IDataOutput &stream) const
MCAPI bool removeEntityFromWorld(::WeakEntityRef entityRef)
static MCAPI ::std::pair< ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome > > > > deserialize3DBiomes(::IDataInput &stream, ::BiomeRegistry const &biomeRegistry, ushort dimensionHeightInSubchunks, ::Biome const *defaultBiome, bool fromNetwork)
MCAPI void validateAndFixBiomeStates()
MCAPI void addHardcodedSpawningArea(::BoundingBox const &spawnerAABB, ::HardcodedSpawnAreaType type)
Definition SaveContext.h:5
Definition SpinLockImpl.h:5
Definition StringByteInput.h:9
Definition SubChunkPos.h:5
Definition SubChunkStorage.h:30
Definition WeakEntityRef.h:14
Definition function_ref.h:60
Definition _HeaderOutputPredefine.h:352
Definition ActorDefinitionIdentifier.h:15
Definition LevelChunkTimingData.h:12
Definition BiomeChunkState.h:5
Definition DeserializationChanges.h:14
Definition LevelChunkPhase1Deleter.h:5
Definition Registry.h:10
Definition LevelChunk.h:128
Definition LevelChunk.h:137
Definition SubChunkPacketPayload.h:64
Definition SubChunk.h:26
Definition Tick.h:5
Definition buffer.h:5