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