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