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