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/common/BiomeIdType.h"
7#include "mc/common/BrightnessPair.h"
8#include "mc/deps/core/container/small_vector.h"
9#include "mc/deps/core/container/small_vector_base.h"
10#include "mc/deps/core/utility/buffer_span.h"
11#include "mc/deps/game_refs/WeakRef.h"
12#include "mc/network/packet/SubChunkPacket.h"
13#include "mc/platform/threading/Mutex.h"
14#include "mc/platform/threading/SpinLockImpl.h"
15#include "mc/platform/threading/UniqueLock.h"
16#include "mc/world/actor/ActorType.h"
17#include "mc/world/level/BlockPos.h"
18#include "mc/world/level/ChunkLocalHeight.h"
19#include "mc/world/level/ChunkPos.h"
20#include "mc/world/level/Tick.h"
21#include "mc/world/level/block/chunk_volume/VolumeOf.h"
22#include "mc/world/level/chunk/ChunkCachedDataState.h"
23#include "mc/world/level/chunk/ChunkDebugDisplaySavedState.h"
24#include "mc/world/level/chunk/ChunkState.h"
25#include "mc/world/level/chunk/ChunkTerrainDataState.h"
26#include "mc/world/level/chunk/ColumnCachedData.h"
27#include "mc/world/level/chunk/DirtyTicksCounter.h"
28#include "mc/world/level/chunk/LevelChunkBlockActorStorage.h"
29#include "mc/world/level/chunk/LevelChunkFormat.h"
30#include "mc/world/level/chunk/LevelChunkNeighbor.h"
31#include "mc/world/level/chunk/LevelChunkVolumeData.h"
32#include "mc/world/level/chunk/SubChunkInitMode.h"
33#include "mc/world/level/chunk/SubChunkStorage.h"
34#include "mc/world/level/chunk/level_chunk_ticking/Entity.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;
47class BlockSource;
49class BlockVolume;
50class ChunkBlockPos;
51class ChunkSource;
52class ChunkViewSource;
53class Dimension;
54class EntityContext;
56class IDataInput;
57class IDataOutput;
58class ILevel;
60class Random;
61class SaveContext;
62class StringByteInput;
63class SubChunkPos;
64class Vec3;
65class WeakEntityRef;
66class Weather;
68struct ActorLink;
69struct BiomeChunkState;
70struct BlockID;
71struct Brightness;
74struct NibblePair;
75struct SubChunk;
76namespace LevelChunkTicking { struct Registry; }
77// clang-format on
78
79class LevelChunk {
80public:
81 // LevelChunk inner types declare
82 // clang-format off
83 class Neighbors;
84 struct SpawningArea;
85 struct Telemetry;
86 // clang-format on
87
88 // LevelChunk inner types define
89 enum class DeserializeEntityResult : int {
90 FailedToLoadActor = 0,
91 FailedToAddToLevel = 1,
92 Succeeded = 2,
93 };
94
95 enum class Finalization : int {
96 NeedsInstaticking = 0,
97 NeedsPopulation = 1,
98 Done = 2,
99 };
100
101 class Neighbors {
102 public:
103 // member variables
104 // NOLINTBEGIN
105 ::ll::TypedStorage<1, 1, uchar> mNeighbors;
106 // NOLINTEND
107
108 public:
109 // static variables
110 // NOLINTBEGIN
111 MCAPI static ::std::array<::std::pair<::LevelChunkNeighbor, ::ChunkPos>, 8> const& sOffsetMap();
112 // NOLINTEND
113 };
114
116 public:
117 // member variables
118 // NOLINTBEGIN
119 ::ll::TypedStorage<4, 24, ::BoundingBox> aabb;
120 ::ll::TypedStorage<1, 1, ::HardcodedSpawnAreaType> type;
121 // NOLINTEND
122 };
123
124 struct Telemetry {
125 public:
126 // member variables
127 // NOLINTBEGIN
128 ::ll::TypedStorage<1, 1, bool> mWasStored;
129 ::ll::TypedStorage<1, 1, bool> mWasGenerated;
130 ::ll::TypedStorage<1, 1, bool> mWasRequestedInsideTickRange;
131 ::ll::TypedStorage<1, 1, bool> mWasLoadedInsideTickRange;
132 // NOLINTEND
133 };
134
135 using BBorder = bool;
136
138
139 using BlockActorVector = ::std::vector<::std::shared_ptr<::BlockActor>>;
140
141public:
142 // member variables
143 // NOLINTBEGIN
144 ::ll::TypedStorage<8, 80, ::Bedrock::Threading::Mutex> mBlockEntityAccessLock;
145 ::ll::TypedStorage<8, 8, ::ILevel&> mLevel;
146 ::ll::TypedStorage<8, 8, ::Dimension&> mDimension;
147 ::ll::TypedStorage<4, 12, ::BlockPos> mMin;
148 ::ll::TypedStorage<4, 12, ::BlockPos> mMax;
149 ::ll::TypedStorage<8, 8, ::ChunkPos> mPosition;
150 ::ll::TypedStorage<1, 1, bool> mLightingFixupDone;
151 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mLightingTaskActive;
152 ::ll::TypedStorage<1, 1, bool> mReadOnly;
153 ::ll::TypedStorage<8, 8, ::ChunkSource*> mGenerator;
154 ::ll::TypedStorage<4, 4, ::LevelChunkTicking::Entity> mTmpTickingEntity;
155 ::ll::TypedStorage<1, 2, ::std::optional<::LevelChunkFormat>> mLoadedFormat;
156 ::ll::TypedStorage<8, 32, ::std::string> mSerializedEntitiesBuffer;
157 ::ll::TypedStorage<8, 32, ::std::string> mFailedSerializedEntitiesBuffer;
158 ::ll::TypedStorage<1, 1, bool> mHadSerializedEntities;
159 ::ll::TypedStorage<8, 24, ::std::vector<::ActorLink>> mUnresolvedActorLinks;
160 ::ll::TypedStorage<1, 1, ::std::atomic<::ChunkState>> mLoadState;
161 ::ll::TypedStorage<1, 1, ::ChunkTerrainDataState> mTerrainDataState;
162 ::ll::TypedStorage<1, 1, ::ChunkDebugDisplaySavedState> mDebugDisplaySavedState;
163 ::ll::TypedStorage<1, 1, ::ChunkCachedDataState> mCachedDataState;
164 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mCachedDataStateSpinLock;
165 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mClientRequestHeightmapAdjustSpinLock;
166 ::ll::TypedStorage<8, 8, ::Tick> mLastTick;
167 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mTickQueue;
168 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::BlockTickingQueue>> mRandomTickQueue;
169 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunk>> mSubChunks;
170 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SpinLockImpl>>> mSubChunkSpinLocks;
171 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> mBiomeSubchunks;
172 ::ll::TypedStorage<2, 512, ::std::array<::BiomeIdType, 256>> m2DBiomes;
173 ::ll::TypedStorage<8, 8, ::std::shared_mutex> mBiomesMutex;
174 ::ll::TypedStorage<4, 2048, ::std::array<::ColumnCachedData, 256>> mCachedData;
175 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mHeightmap;
176 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRenderHeightmap;
177 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<short>>> mPreWorldGenHeightmap;
178 ::ll::TypedStorage<2, 2, ::ChunkLocalHeight> mNonAirMaxHeight;
179 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BiomeIdType, ::BiomeChunkState>> mBiomeStates;
180 ::ll::TypedStorage<2, 2, ushort> m3dBiomeStackSize;
181 ::ll::TypedStorage<1, 1, bool> mHasCachedTemperatureNoise;
182 ::ll::TypedStorage<1, 256, ::std::array<bool, 256>> mBorderBlockMap;
183 ::ll::TypedStorage<4, 4, int> mCurrentInstatick;
184 ::ll::TypedStorage<4, 4, ::LevelChunk::Finalization> mFinalized;
185 ::ll::TypedStorage<1, 1, bool> mIsRedstoneLoaded;
186 ::ll::TypedStorage<1, 1, bool> mOwnedByTickingThread;
187 ::ll::TypedStorage<1, 1, bool> mUse3DBiomeMaps;
188 ::ll::TypedStorage<1, 1, bool> mLevelChunkHas3dBiomeTag;
189 ::ll::TypedStorage<1, 4, ::LevelChunk::Telemetry> mTelemetry;
190 ::ll::TypedStorage<4, 48, ::DirtyTicksCounter[6]> mFullChunkDirtyTicksCounters;
191 ::ll::TypedStorage<4, 8, ::DirtyTicksCounter> mChunkActorsDirtyTicksCounter;
192 ::ll::TypedStorage<2, 512, ::std::array<::ChunkLocalHeight, 256>> mRainHeights;
193 ::ll::TypedStorage<8, 24, ::std::vector<::WeakEntityRef>> mEntities;
194 ::ll::TypedStorage<8, 24, ::std::vector<::std::string>> mRemovedActorStorageKeys;
195 ::ll::TypedStorage<8, 136, ::LevelChunkBlockActorStorage> mBlockEntities;
196 ::ll::TypedStorage<8, 24, ::std::vector<::std::shared_ptr<::BlockActor>>> mPreservedBlockEntities;
197 ::ll::TypedStorage<8, 24, ::std::vector<::WeakRef<::EntityContext>>> mVolumes;
198 ::ll::TypedStorage<1, 2, ::BrightnessPair> mDefaultBrightness;
199 ::ll::TypedStorage<8, 24, ::std::vector<::LevelChunk::SpawningArea>> mSpawningAreas;
200 ::ll::TypedStorage<8, 8, ::std::chrono::steady_clock::time_point> mLastNetworkLightingTime;
201 ::ll::TypedStorage<8, 8, uint64> mLoadedMetaDataHash;
202 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::LevelChunkMetaData>> mMetaData;
203 ::ll::TypedStorage<1, 1, bool> mClientNeedsToRequestSubChunks;
204 ::ll::TypedStorage<1, 1, bool> mLevelChunkHasHadOriginalLighting;
205 ::ll::TypedStorage<4, 16, float[2][2]> mChunkInterpolants;
206 ::ll::TypedStorage<1, 1, bool> mbChunkHasConverterTag;
207 ::ll::TypedStorage<1, 1, ::LevelChunk::Neighbors> mSavedNeighbors;
208 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mGenerationSeed;
209 ::ll::TypedStorage<1, 1, bool> mGeneratedPreCavesAndCliffsBlending;
210 ::ll::TypedStorage<1, 1, bool> mOnChunkLoadedCalled;
211 ::ll::TypedStorage<1, 1, bool> mAllSerializedEntitiesLoaded;
212 ::ll::TypedStorage<8, 32, ::std::string> mOutOfBoundsBlockEntitiesBuffer;
213 ::ll::TypedStorage<1, 1, bool> mSaveNonActorDataIfDirty;
214 ::ll::TypedStorage<1, 1, bool> mSaveIfNeverSaved;
215 ::ll::TypedStorage<4, 4, ::std::atomic<int>> mSnowRandomValue;
216 ::ll::TypedStorage<1, 1, bool> mHasSubChunksToPrune;
217 ::ll::TypedStorage<1, 1, bool> mHaveSubChunksBeenPruned;
218 ::ll::TypedStorage<1, 1, bool> mShouldShiftUpFlatWorldSubChunks;
219 ::ll::TypedStorage<8, 24, ::SpinLockImpl> mSubChunksToPruneLock;
220 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::std::vector<::SubChunk>>> mSubChunksToPruneOutsideRange;
221 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::GameEventListenerRegistry>> mGameEventListenerRegistry;
222 ::ll::TypedStorage<1, 1, bool> mIsClientGenerated;
223 ::ll::TypedStorage<1, 1, bool> mWasClientGenerated;
224 ::ll::TypedStorage<1, 1, bool> mIsEmptyClientChunk;
225 ::ll::TypedStorage<1, 1, bool> mActorStorageUpdatedAfterCheckingForReplacementData;
226 ::ll::TypedStorage<1, 1, ::std::atomic<bool>> mIsTransient;
227 ::ll::TypedStorage<8, 856, ::LevelChunkVolumeData> mLevelChunkVolumeData;
228 // NOLINTEND
229
230public:
231 // prevent constructor by default
232 LevelChunk& operator=(LevelChunk const&);
233 LevelChunk(LevelChunk const&);
234 LevelChunk();
235
236public:
237 // member functions
238 // NOLINTBEGIN
239 MCAPI LevelChunk(
240 ::Dimension& dimension,
241 ::ChunkPos const& cp,
242 bool readOnly,
243 ::SubChunkInitMode initBlocks,
244 bool initializeMetaData,
245 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
246 );
247
248 MCAPI void _addEntityToVolumes(::gsl::not_null<::Actor*> actor);
249
250 MCAPI void _checkAndInferMetaDataAfterDeserialization();
251
252 MCAPI ::std::shared_ptr<::BlockActor> _createBlockEntity(
253 ::BlockPos const& block,
254 ::BlockSource* currentSource,
255 ::Block const& current,
256 ::Block const& old
257 );
258
259 MCAPI void _deserializeBiomes(::IDataInput& stream, ::BiomeRegistry const& biomeRegistry, bool fromNetwork);
260
261 MCAPI void _deserializeBlockEntities(::IDataInput& stream, ::LevelChunkBlockActorStorage& blockEntityMap);
262
263 MCAPI void _deserializeCCsubChunks(short index, ::StringByteInput& stream);
264
265 MCAPI ::LevelChunk::DeserializeEntityResult
266 _deserializeEntity(::BlockSource& source, ::IDataInput& stream, ::std::vector<::ActorLink>& links);
267
268 MCAPI bool _deserializeSubChunk(short index, ::StringByteInput& stream);
269
270 MCAPI void _dispatchBlockBreakEvents(
271 ::BlockPos const& pos,
272 ::Block const& oldBlock,
273 ::Block const& current,
274 ::BlockSource* currentSource,
275 ::BlockChangeContext const& changeSourceContext
276 );
277
278 MCAPI void _fixupCommandBlocksOnTickingQueue(::BlockSource& tickRegion);
279
280 MCAPI void _fixupCorruptedBlockActors(
281 ::LevelChunkBlockActorStorage& deserialized,
283 ) const;
284
285 MCAPI void _generateOriginalLighting(::ChunkViewSource& neighborhood, bool enforceBorderCheck);
286
287 MCAPI void _generateOriginalLightingSubChunk(::BlockSource& source, uint64 subchunkIdx, bool);
288
289#ifdef LL_PLAT_C
290 MCAPI void _handleHeightmapDataFromSubChunkPacketWithDeserializationChanges(
291 short subChunkIndex,
292 ::SubChunkPacket::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 _makeUniformBiomes(::Biome const& biome);
304
305 MCAPI void _placeBlockEntity(::std::shared_ptr<::BlockActor> te);
306
307 MCAPI bool _recalcHeight(::ChunkBlockPos const& start, ::BlockSource* source);
308
309 MCAPI void _removeCallbacks(
310 ::ChunkBlockPos const& pos,
311 ::Block const& oldBlock,
312 ::Block const& current,
313 ::BlockSource* currentSource,
314 ::BlockChangeContext const& changeSourceContext
315 );
316
317 MCAPI void _replaceBiomeStorage(
318 ushort subChunkIndex,
319 ::std::unique_ptr<::SubChunkStorage<::Biome>> newStorage,
321 );
322
323 MCAPI void _set2DBiomesFrom3D(::IDataInput& stream);
324
325 MCAPI void _setAllBiomesFrom2D(::std::array<::BiomeIdType, 256>& legacyBiomes);
326
327 MCAPI void _setBiome(::Biome const& biome, ::ChunkBlockPos const& pos, bool fillYDimension);
328
329 MCAPI void _setBiome(
330 ::Biome const& biome,
331 ushort subChunkIndex,
332 ushort storageIndex,
334 );
335
336 MCAPI void _tickSnowAndIce(::BlockSource& region, ::Random& random, int xOffset, int zOffset, ::Weather& weather);
337
338 MCAPI void addEntity(::WeakEntityRef entityRef);
339
340 MCAPI void addHardcodedSpawningArea(::BoundingBox const& spawnerAABB, ::HardcodedSpawnAreaType type);
341
342#ifdef LL_PLAT_C
343 MCAPI void addSubChunkBlockEntitiesToLevelChunk(::LevelChunkBlockActorStorage& blockActorMap);
344#endif
345
346 MCAPI bool applySeasonsPostProcess(::BlockSource& region);
347
348 MCAPI bool checkSeasonsPostProcessDirty() const;
349
350#ifdef LL_PLAT_C
351 MCAPI void clearBlockEntitiesInSubChunk(
352 schar absoluteIndex,
353 ::LevelChunkBlockActorStorage const* blockActorMap,
354 ::BlockSource* region
355 );
356#endif
357
358 MCAPI void clientSubChunkRequestGenerateLightingForSubChunk(::ChunkViewSource& neighborhood, short absoluteIndex);
359
360 MCAPI void deserialize2DMaps(::IDataInput& stream);
361
362#ifdef LL_PLAT_C
363 MCAPI void deserializeBiomes(::IDataInput& stream, bool fromNetwork);
364#endif
365
366 MCAPI void deserializeBlockEntities(::IDataInput& stream);
367
368#ifdef LL_PLAT_C
369 MCAPI void deserializeBorderBlocks(::IDataInput& stream);
370#endif
371
372 MCAPI bool deserializeKey(::std::string_view key, ::std::string_view value);
373
374 MCAPI void deserializeMetaDataHash(::IDataInput& stream);
375
376 MCAPI void deserializeSubChunk(
377 uchar idx,
378 ::IDataInput& stream,
379 ::std::optional<schar> absoluteIndex,
380 ::std::optional<::DeserializationChanges*> deserializationChanges
381 );
382
383 MCAPI void discardPrunedSubChunks();
384
385 MCAPI void fetchBiomes(::Bedrock::small_vector_base<::gsl::not_null<::Biome const*>>& output) const;
386
387 MCAPI void finalizeDeserialization();
388
389 MCAPI void finalizePostProcessing();
390
391 MCAPI ::Vec3 findLightningTarget(::BlockPos const& pos, ::BlockSource& region) const;
392
393 MCAPI bool generateOriginalLighting(::ChunkViewSource& neighborhood, bool enforceBorderCheck);
394
395 MCAPI ::ChunkLocalHeight getAboveTopSolidBlock(
396 ::ChunkBlockPos const& start,
397 bool iteratePastInitialBlocking,
398 bool includeWater,
399 bool includeLeaves
400 ) const;
401
402 MCAPI void getActors(
403 ::ActorDefinitionIdentifier const& actorDefinitionId,
404 ::AABB const& bb,
405 ::std::vector<::Actor*>& actors
406 ) const;
407
408 MCAPI ::buffer_span_mut<::SubChunk> getAllSubChunks();
409
410 MCAPI ::Biome const& getBiome(::ChunkBlockPos const& pos) const;
411
412 MCAPI ::Block const& getBlock(::ChunkBlockPos const& pos) const;
413
414 MCAPI ::BrightnessPair getBrightness(::ChunkBlockPos const& pos) const;
415
416#ifdef LL_PLAT_C
417 MCAPI ::std::array<::ChunkLocalHeight, 256> getEntireLightingHeightMap() const;
418#endif
419
420 MCAPI void getEntities(
421 ::gsl::span<::gsl::not_null<::Actor const*>> ignoredEntities,
422 ::AABB const& bb,
423 ::std::vector<::Actor*>& entities,
424 bool useHitbox
425 ) const;
426
427 MCAPI void
428 getEntities(::ActorType type, ::AABB const& bb, ::std::vector<::Actor*>& es, bool ignoreTargetType) const;
429
430 MCAPI ::Block const& getExtraBlock(::ChunkBlockPos const& localPos) const;
431
432 MCAPI short getHighestNonAirSubChunkIndex() const;
433
434 MCAPI ::std::shared_ptr<::LevelChunkMetaData> getMetaDataCopy() const;
435
436 MCAPI ::Brightness getRawBrightness(::ChunkBlockPos const& pos, ::Brightness skyDampen) const;
437
438#ifdef LL_PLAT_C
439 MCAPI ::SubChunk* getSubChunk(short absoluteIndex);
440#endif
441
442 MCAPI ::SubChunk const* getSubChunksToPruneOutsideDimensionRange(uint64 index) const;
443
444 MCAPI ::BlockPos const getTopRainBlockPos(::ChunkBlockPos const& pos);
445
446#ifdef LL_PLAT_C
447 MCAPI void handleHeightmapDataFromSubChunkPacket(
448 short subChunkAbsoluteIndex,
449 ::SubChunkPacket::SubChunkPacketData const& subChunkPacketData,
450 ::std::optional<::DeserializationChanges*> deserializationChanges
451 );
452#endif
453
454 MCAPI bool hasEntity(::WeakEntityRef entityRef) const;
455
456 MCAPI bool hasSubChunksToPrune() const;
457
458 MCAPI bool isNonActorDataDirty() const;
459
460 MCAPI void legacyDeserializeBlockExtraData(::IDataInput& stream);
461
462 MCAPI void legacyDeserializeTerrain(::IDataInput& stream);
463
464 MCAPI void markForTickingThisFrame(::LevelChunkTicking::Registry& registry);
465
466 MCAPI ::LevelChunk& operator=(::LevelChunk&& otherChunk);
467
468 MCAPI void placeCallbacks(
469 ::ChunkBlockPos const& pos,
470 ::Block const& old,
471 ::Block const& current,
472 ::BlockSource* currentSource,
473 ::std::shared_ptr<::BlockActor> blockEntity,
474 ::BlockChangeContext const& changeSourceContext
475 );
476
477 MCAPI void populateHeightMapDataForSubChunkPacket(
478 short subChunkAbsoluteIndex,
479 ::SubChunkPacket::SubChunkPacketData& subChunkPacketData
480 ) const;
481
482#ifdef LL_PLAT_C
483 MCAPI void recalculateChunkSkyLight();
484#endif
485
486 MCAPI void recomputeHeightMap(bool resetLighting);
487
488 MCAPI ::std::shared_ptr<::BlockActor> removeBlockEntity(::BlockPos const& blockPos);
489
490 MCAPI bool removeEntityFromChunk(::WeakEntityRef entityRef);
491
492 MCAPI bool removeEntityFromWorld(::WeakEntityRef entityRef);
493
494 MCAPI void removeHardcodedSpawningArea(::HardcodedSpawnAreaType type);
495
496 MCAPI void serializeBiomeStates(::IDataOutput& stream) const;
497
498 MCAPI void serializeBiomes(::IDataOutput& stream) const;
499
500 MCAPI void serializeBlockEntities(::IDataOutput& stream, ::SaveContext const& saveContext) const;
501
502 MCAPI void serializeBlockEntitiesForSubChunk(
503 ::IDataOutput& stream,
504 ::SubChunkPos const& subChunkPos,
505 ::SaveContext const& saveContext
506 ) const;
507
508 MCAPI bool serializeBorderBlocks(::IDataOutput& stream) const;
509
510 MCAPI void serializeEntities(
511 ::std::string& buffer,
512 bool markProcessedOnChunkDisard,
513 ::std::function<void(::std::string const&)> addLiveActorCallback,
514 ::std::function<void(::std::string const&)> addActorKeyCallback,
515 ::std::function<void(::std::string const&)> addSerializedActor
516 ) const;
517
518 MCAPI void serializeEntityRemovals(::std::function<void(::std::string const&)> callback);
519
520#ifdef LL_PLAT_C
521 MCAPI void serializeTicks(::IDataOutput& stream) const;
522#endif
523
524 MCAPI void setAllBlockTypeIDAndData(::buffer_span<::BlockID> ids, ::buffer_span<::NibblePair> data);
525
526 MCAPI void setBiomeFromVolume(::ChunkVolume::VolumeOf<::Biome> const& volume);
527
528 MCAPI ::Block const& setBlock(
529 ::ChunkBlockPos const& pos,
530 ::Block const& block,
531 ::BlockSource* issuingSource,
532 ::std::shared_ptr<::BlockActor> blockEntity,
533 ::BlockChangeContext const& changeSourceContext
534 );
535
536 MCAPI void setBlockSimple(::ChunkBlockPos const& pos, ::Block const& block);
537
538 MCAPI void setBlockVolume(::BlockVolume const& box, uint yOffset);
539
540#ifdef LL_PLAT_C
541 MCAPI void setClientNeedsToRequestSubchunks(::std::optional<uint64> requestLimit);
542#endif
543
544 MCAPI ::Block const&
545 setExtraBlock(::ChunkBlockPos const& localPos, ::Block const& block, ::BlockSource* issuingSource);
546
547 MCAPI void setMetaData(::std::shared_ptr<::LevelChunkMetaData> metaData);
548
549 MCAPI void setPendingEntities(::std::string entitiesData);
550
551 MCAPI void setPreWorldGenHeightMap(::std::unique_ptr<::std::vector<short>> heightmap);
552
553 MCAPI void setSaved();
554
555 MCAPI void setUnsaved();
556
557 MCAPI void setupRedstoneCircuit(::BlockSource& resource);
558
559 MCAPI void tickBlockEntities(::BlockSource& tickRegion);
560
561 MCAPI void tickBlocks(::BlockSource& region);
562
563 MCAPI void tickImpl(::BlockSource& tickRegion, ::Tick const& tick, ::std::function<void()> spawnerCallback);
564
565 MCAPI void trySpawnSkeletonTrap(::BlockSource& region, ::BlockPos const& pos);
566
567#ifdef LL_PLAT_S
568 MCAPI void updateLoadedMetaDataHash();
569#endif
570
571 MCAPI void validateAndFixBiomeStates();
572
573 MCAPI ~LevelChunk();
574 // NOLINTEND
575
576public:
577 // static functions
578 // NOLINTBEGIN
579#ifdef LL_PLAT_C
580 MCAPI static ::std::unique_ptr<::LevelChunk, ::LevelChunkPhase1Deleter> createNew(
581 ::Dimension& dimension,
582 ::ChunkPos cp,
583 bool readOnly,
584 ::SubChunkInitMode initBlocks,
585 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
586 );
587
588 MCAPI static ::std::unique_ptr<::LevelChunk>
589 createNewNoCustomDeleter(::Dimension& dimension, ::ChunkPos cp, bool readOnly, ::SubChunkInitMode initBlocks);
590#endif
591
592 MCAPI static ::std::tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeIdType, 256>>
593 deserialize2DData(::IDataInput& stream, ::std::optional<::LevelChunkFormat> const& lcFormat, bool isClientSide);
594
595 MCAPI static ::std::pair<ushort, ::std::vector<::std::unique_ptr<::SubChunkStorage<::Biome>>>> deserialize3DBiomes(
596 ::IDataInput& stream,
597 ::BiomeRegistry const& biomeRegistry,
598 ushort dimensionHeightInSubchunks,
599 ::Biome const* defaultBiome,
600 bool fromNetwork
601 );
602
603 MCAPI static ::std::optional<::BlockPos> findExposedLightningRod(::BlockPos const& pos, ::BlockSource& region);
604
605 MCAPI static void serializeEntities(
606 ::std::vector<::WeakEntityRef> const& entities,
607 ::std::string const& serializedEntitiesBuffer,
608 ::std::string const& failedSerializedEntitiesBuffer,
609 ::std::string& buffer,
610 bool markProcessedOnChunkDisard,
611 ::std::function<void(::std::string const&)> addLiveActorCallback,
612 ::std::function<void(::std::string const&)> addActorKeyCallback,
613 ::std::function<void(::std::string const&)> addSerializedActor
614 );
615
616 MCAPI static ::std::
617 tuple<::std::array<::ChunkLocalHeight, 256>, ::std::array<::BiomeIdType, 256>, ::std::vector<::SubChunk>>
618 staticDeserializeLegacyTerrain(::IDataInput& stream, short minY, ushort dimensionSizeInSubchunks);
619 // NOLINTEND
620
621public:
622 // constructor thunks
623 // NOLINTBEGIN
624 MCAPI void* $ctor(
625 ::Dimension& dimension,
626 ::ChunkPos const& cp,
627 bool readOnly,
628 ::SubChunkInitMode initBlocks,
629 bool initializeMetaData,
630 ::LevelChunkBlockActorStorage::TrackingMode blockActorTrackingMode
631 );
632 // NOLINTEND
633
634public:
635 // destructor thunk
636 // NOLINTBEGIN
637 MCAPI void $dtor();
638 // NOLINTEND
639};
Definition AABB.h:18
Definition Actor.h:106
Definition UniqueLock.h:8
Definition small_vector_base.h:8
Definition small_vector.h:8
Definition BiomeRegistry.h:38
Definition Biome.h:23
Definition BlockActor.h:30
Definition BlockChangeContext.h:10
Definition BlockPos.h:19
Definition BlockSource.h:71
Definition BlockTickingQueue.h:25
Definition BlockVolume.h:13
Definition Block.h:43
Definition BoundingBox.h:13
Definition ChunkBlockPos.h:10
Definition ChunkPos.h:11
Definition ChunkSource.h:38
Definition ChunkViewSource.h:22
Definition VolumeOf.h:8
Definition Dimension.h:86
Definition EntityContext.h:16
Definition GameEventListenerRegistry.h:10
Definition IDataInput.h:8
Definition IDataOutput.h:5
Definition ILevel.h:218
Definition LevelChunkBlockActorStorage.h:14
Definition LevelChunkMetaData.h:8
Definition LevelChunk.h:101
Definition Random.h:10
Definition SaveContext.h:5
Definition StringByteInput.h:9
Definition SubChunkPos.h:5
Definition SubChunkStorage.h:9
Definition Vec3.h:10
Definition WeakEntityRef.h:14
Definition Weather.h:19
Definition _HeaderOutputPredefine.h:241
Definition buffer_span.h:6
Definition ActorDefinitionIdentifier.h:15
Definition BiomeChunkState.h:5
Definition BlockID.h:8
Definition Brightness.h:8
Definition DeserializationChanges.h:14
Definition LevelChunkPhase1Deleter.h:5
Definition Registry.h:10
Definition LevelChunk.h:115
Definition LevelChunk.h:124
Definition NibblePair.h:5
Definition SubChunkPacket.h:68
Definition SubChunk.h:25
Definition Tick.h:5
Definition buffer.h:5